You could store them in an .INI file and read this during your tests in your @BeforeClass using:

Preferences args = new IniFile(new File(fname));

Since my tests are coming from HP ALM and the testng-suite.xml is generated automatically, I simply added my as parameters into the XML.
You could also use to add the lines into your testng-suite.xml

<suite verbose="-1" name="TestAutomationTest.MBC-POS-Suite" configfailurepolicy="skip" preserve-order="true">
    <parameter name=".url" value="" />

You can access them then in your test method, each parameter is one argument in your test method:

@Parameters({"selenium.url", "timeOut.msec"})
public void testMethod(String url, int timeout)

Source link


Please enter your comment!
Please enter your name here