TestNG Parameterized Test using xml file
In last article we have discuss how to parametrized test using @DataProvider annotation in TestNG.
In this blog lets discuss how to pass parameter in test from xml file. First create a xml file in root dir of your project and named it TestNG.xml
Now write TestNG.xml as shown below
Now create tests. Here is first test i.e. 'LoginTest', make sure that it should be in 'package1' as we have mention it in xml as well.
Here is another two tests which is in 'package2' named 'CountEmail' and 'ComposeEmail'
*CountEmail
*ComposeEmail
Its time to run test, so do right click on TestNG.xml file and click on Run as TestNg Suite. LoginTest will run on firefox browser because value of browser is set to firefox in TestNG.XML and we are checking that value in 'LaunchCloseBrowser' and in the same manner other both tests will execute on chrome broswer.