1

I run my test using Java, Selenium and TestNG.

When I execute my test suite I have it set up where the testng.xml has all the configurations to run my tests. I am wondering, if I can set up some UI component that does the same thing as the xml?

I am asking because I have nontechnical people in my staff and I don't want them to have to download an IDE, check out the project, etc. I want to create some UI where they can just go there and hit a button and the tests runs just like how I can right click on the testng.xml and hit run.

2 Answers 2

1

Actually, you can run the tests using Maven directly on the terminal:

mvn test

More details here, with options.

0

If you want to run your testng.xml files without any IDE or build tool, first you need to install Java on the system. In addition, you also need to set its path into the environment variable.

And first, you need to compile Java code using the command prompt. For this, you need to open the command prompt and go to the PROJECT_HOME directory.

Type Following command in terminal

javac -classpath libs/* -d ./bin ./src1/com/example/tests/*.java ./src2/com1/example1/tests1/*.java

if you are using windows then

dir /s /B *.java > javaFilePath.txt

This command will search all the .java files in current and subdirectory and put the entire Java file path in ‘javaFilePath.txt’ file.

You can compile the entire Java file using the below command.

javac -classpath libs/* -d ./bin @javaFilePath.txt

if you are using Ubuntu then

$find -name “*.java” > sources.txt$ javac -classpath libs/* -d ./bin @javaFilePath.txt

and after run the testing.xml file with using below command

java -cp bin;libs/* org.testng.TestNG TestNG/testng.xml

Now, you may run your testng.xml files without any IDE or build tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.