TestNG - Parameterization XML

One of the important features of TestNG is parameterization. This feature allows user to pass parameter values to test methods as arguments. This is supported by using the @Parametersannotation.
There are mainly two ways through which we can provide parameter values to test-methods: testng.xml or dataproviders.
Some times it may be required for us to pass values to test methods during run time. Like we can pass user name and password through testng.xml instead of hard coding it in testmethods. or we can pass browser name as parameter to execute in specific browser.

Let us now try to understand parameterization with a basic example.



 


Right click and run the testng.xml file as testng suite 

Output:






No comments:

Post a Comment

Note: Only a member of this blog may post a comment.