Sunday, October 8, 2017

Windows - Schedule Testng.xml to run automatically without Jenkins

1st create a batch file to run Testng.xml automatically.
For Maven project the batch file looks similar to below. If your project is not a maven project(you need to specify the path of the libs explicitly)

set projectLocation=<C:\SVN-IndirectWorkspace\...>
cd %projectLocation%
mvn clean test -DsuiteXmlFile=<Path of testng.xml>
pause

Ex(Maven Project):

set projectLocation=C:\SVN-IndirectWorkspace\TestProj\
cd %projectLocation%
mvn clean test -DsuiteXmlFile=testng.xml
pause

Ex(Normal Project):

set projectLocation=C:\GitRapo\MyProject
cd C:\GitRapo\MyProject
set classpath=C:\GitRapo\MyProject\bin;C:\GitRapo\MyProject\lib\*
java org.testng.TestNG C:\GitRapo\MyProject\testng.xml

Test the bat file once by executing it.

Now we can create a Windows Task to run this batch file on the desired time(Daily/weekly etc).

Follow the steps in this blog post:

http://sriramkukkadapu.blogspot.in/2017/08/how-to-schedule-batch-file-to-run.html




No comments:

Post a Comment