I am using testNG with Selenium webdriver2.0.
In my testNG.xml I have
Looks like your config-file parameter is not defined at the level. There are several ways to solve this:
1. Make sure the element is defined within tag but outside of any :
2. If you want to have the default value for the parameter in the Java code despite the fact it is specified in testng.xml or not, you can add @Optional annotation to the method parameter:
@BeforeSuite
@Parameters( {"config-file"} )
public void initFramework(@Optional("src/test/resources/config.properties/") String configfile) {
//method implementation here
}
EDIT (based on posted testng.xml):
Option 1:
Option 2:
@BeforeTest
@Parameters( {"config-file"} )
public void initFramework(@Optional("src/test/resources/config.properties/") String configfile) {
//method implementation here
}
In any case, I would recommend not having two parameters with almost identical names, identical values, and different scope.