I am going to show you how we can run testng.xml file on terminal. Sometimes we need to run dozens or hundreds of test cases. We can run them all with one line command.
I have three java class under my project and I want to run all of them.
We have to add java classes that we want to run to testng.xml file. There is a detail of testng.xml file. I added ParallelTesting, FirstChromeSearch and MultipleBrowser. Last class, under the package that’s why I added this class with its package’s name. You can add as many cases as you want.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite">
<test verbose="2" preserve-order="true" name="Command Line Tests" >
We need to add plugin to pom.xml file.
Now we open terminal and go to testng.xml file’s path and run this command.
mvn clean test -DsuiteXmlFile=testng.xml
Now you can see test results on terminal. How many tests are fail or how many tests are success?
Thank you for reading.