TestNG Tutorials 43: Difference Between “Parameters” and “parameter” in TestNG
Hello Folks,
I was asked this question in an interview and I was like “Are there two terms “Parameters” and “parameter” in TestNG?“.
Yes, There are two different terms, “Parameters” and “parameter“. We have used both termas many times but didn’t notice minor thing.
“Parameters” is an annotation which allows us to create parameterized methods in a TestNG class. For example:
[java]
public class ParametersThroughXML {
/* We need to add Parameters annotation to read value from testng xml. Note here that * attribute name passed in Parameters must be same as testng xml. */ @Parameters({“confBeforeParameter”}) @BeforeMethod public void configurationBeforeMethod(String confBeforeParameter) { System.out.println(“Paramters for before configuration method: “+confBeforeParameter);
}