Sunday, July 21, 2019

Create Batch file and run

We can create batch file to execute selenium test cases with one click.
you no need to navigate or open eclipse and choose the test case to execute the cases.  once we set up all the cases as suite and create a batch file then we can run the batch file with one  click then it will execute test suite and send the result.

create a batch file is open note pad and save as "rub.bat" and select the file type save as "Batch file"
then it will save as batch.
inside the batch file you can mention what you want to run.
ex:
java -cp D:\sasiWorkspace\PlyMouth\bin; D:\sasiWorkspace\PlyMouth\lib-314159\* org.testng.TestNG testng.xml

It will run the testg.xml file
In this xml file we can mention the suite ( with number of test cases).
bin path from the project folder to get the .class files
lib path from the project folder or outside. it will access the libraries to execute the classes.

Open the command prompt and go to the batch file location.
Example your batch file saved in the your project folder inside the workspace.

D:\workspaceName\projectName>rub.bat

IT will execute the batch file and after complete the testsuite.

No comments:

Post a Comment