Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

Describe how can we pass the parameter to test script using TestNG?

Category: TestNG

Using @Parameter annotation and ‘parameter’ tag in testng.xml we can pass parameters to test scripts.
Sample testng.xml –
Sample test script

public class TestFile {
@Test
@Parameters(“sampleParamName”)
public void parameterTest(String paramValue) {
System.out.println(“Value of sampleParamName is – ” + sampleParamName); }

Leave a Reply

Your email address will not be published. Required fields are marked *