Sorry for the late response ...
Yehven - In Jenkins configure the build to be parameterized, with a parameter type of string and name of 'specifiedUrls'. This works for other TestNG projects I have, but not when using a factory.
Krishnan - No, I don't mean VM parameters, I mean parameters that are made available to the build process.
As I mentioned, this does work other TestNG builds where I am not using a factory, such as the following:
In Jenkins
Create a maven based project, in that project two build parameters are specified:
environment - dev, test, prod, for instance
browser - chrome, firefox, iexplore
The POM - Notice the system properties for environment and browser
....
<build>
<finalName>seleniumTest</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Skip the normal tests, we'll run them in the integration-test phase -->
<skip>true</skip>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<systemProperties>
<property>
<name>environment</name>
<value>${environment}</value>
</property>
<property>
<name>browser</name>
<value>${browser}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>integration-test</id>
<activation>
<property>
<name>!maven.test.skip</name>
</property>
</activation>
</profile>
</profiles>
....
test-ng.xml - Doesn't need to know anything about those parameters
....
<suite name="Web Regression Suite" parallel="none">
<test name="Audience Statistics Tests" preserve-order="true">
<classes>
<class name="com.lotame.test.webDriverRegression.AudienceStatisticsSuiteGrid"/>
</classes>
</test>
</suite>
....
This is the Class - Notice I pick up the two parameters environment and browser
....
@Parameters({"environment", "browser"})
@BeforeSuite
public static void initEnvironment(@Optional String environment , @Optional String browser)
{
TestEnvironmentSetup setup = new TestEnvironmentSetup(environment, browser);
driver = setup.getDriver();
env = setup.getEnvironment();
}
.....
Craig