How to execute selenium test cases using bat file.

how to Run selenium test cases using bat file.

Step 1: Create a simple Java project and add TestNG class.
Step 2: Write some simple selenium code.

Step 3: Now select option convert to TestNg as shown in below screenshot.

Step 4: Click on finish

Step 5: It will create a testng.xml file as shown below:

Step 6: We are done with project setup steps, Lets create a bat now:
……………………………………………………………………………………………………………………………………..
set projectLocation=G:\JavaPractice\Cmd_Testng
cd %projectLocation%
set classpath=%projectLocation%\bin;%projectLocation%\lib\*
java org.testng.TestNG %projectLocation%\testng.xml
pause
…………………………………………………………………………………………………………………………………….

Step 7 : Double click on bat file to execute the test cases

3 Replies to “How to execute selenium test cases using bat file.”

Leave a Reply

Your email address will not be published. Required fields are marked *