O'Reilly logo

TestNg Beginner's Guide by Varun Menon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parameterization of test

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 Parameters and DataProvider annotations. There are mainly two ways through which we can provide parameter values to test-methods:

  • Through testng XML configuration file
  • Through DataProviders

Parameterization through testng.xml

If you need to pass some simple values such as String types to the test methods at runtime, you can use this approach of sending parameter values through TestNG XML configuration files. You have to use the Parameters annotation for passing parameter values to the test method.

Let's write a simple example of passing parameters to test ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required