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
Actually, you can run the tests using Maven directly on the terminal:
mvn test
More details here, with options.
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.
Explore related questions
See similar questions with these tags.