Wednesday, May 6, 2015

TestNG parameters

TestNG Parameterization is used to pass parameters to tests as arguments. This is supported by using the TestNG @Parameters annotation.

1. Using @Parameters

2. Using @DataProvider


We can pass string types using @Parameters annotation to the test methods at run-time.

@Parameters ({"param-name"})
@Test
public void TestOne(String param){
}


@Parameters annotation can be used with the following annotation methods:

@BeforeXXX
@AfterXXX
@Factory
@Test

@Parameters can be used to initialize variables and use them in a class or test or maybe for the whole test suite execution.

No comments:

Post a Comment

Selenium 3 vs Selenium 4