I have an XML configured like this
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="SuiteName" verbose="7">
<test name="TestName">
<method-selectors>
<method-selector>
<script language="beanshell">
<![CDATA[
driverType = System.getProperty("driverType");
if (driverType.equals("IOS")){
return groups.containsKey("All") && (!groups.containsKey("wip") && !groups.containsKey("iOS"));
} else {
return groups.containsKey("All") && (!groups.containsKey("wip"));
}
]]></script>
</method-selector>
</method-selectors>
<classes>
<class name="classnameHere"/>
</classes>
</test>
</suite>
Now I have a Jenkins job that sends a command -DsuiteXmlFile=${suiteXmlfile}.xml (i have multiple suites XML files configured)
The tests create reports that contain in name the "suiteXmlFile" param value, but for debug or when I have to run something not form Jenkins I just right click on the XML file but the reporter see suiteXmlFile as empty (obviously).
I tried System.setProperty("suiteXmlFile","suiteName"); (i use this inside methods and works well) but from the XML file it seems it doesn't work. Is there any other way to set that property?
System.setProperty("suiteXmlFile","suiteName") actually works. the problem was that I was trying to read that property before it was set by xml