RE: How to run TestNG suite through command prompt?

Answered

How to run TestNG suite through command prompt?

kishore Train Asked on September 5, 2014 in Selenium WebDriver.
Add Comment
1 Answers
Best answer

Hi Kishore,

i have given the steps to run TestNG via command prompt. You doesn’t need eclipse to run the suite. I hope it will work.

This is how you can compile and run testng tests from command line. Follow the steps below:

1. Download and Install JDK from http://java.sun.com/javase/downloads/index.jsp

2. The below bat file compiles and runs the dataProviderExample test explained in my earlier blog post. Read that post before trying this.

3. The project folder is at C:\MyEclipseWorkspace\dataDrivenTestProject. You would have to modify javaTestProjectPath variable in the bat file if your project folder lies elsewhere.

4. Java development kit or JDK is installed at C:\Program Files\java\jdk1.6.0_18, You need to change this if your jdk folder path is different from this. This will happen if you are using a different version of java than mine.

5. The testng.xml file given below is placed at C:\MyEclipseWorkspace\dataDrivenTestProject.


6. Open Notepad and copy paste the below commands. Unselect word wrap from format–>word wrap in Notepad. This will ensure that there are no unwanted line breaks. Now save the file as testng.bat anywhere in your local machine. Double click the bat file to run.


Read the REM statements in the bat file to understand the commands used.

Regards,
Vaidy

Doctor Answered on September 5, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.