Here is the scenario:
Have a shell script that calls ant with one argument. The ant in turn executes testng.xml (suite file) passing the same argument and testng in turn executes the test within passing the same argument.
In my case, I am passing the browser string eg.(firefox, iexplore) argument that will specify which browser test will run on. I want to be able to have my test result output tell me which browser the test run in.
I grab the argument from command line in ant by so:
...
<sysproperty key="browser" value="${browser}"/>
I was thinking that since ant calls testng.xml, i can do the same in testng.xml
I went to testng.xml and did something like:
<suite name="AcceptanceSuite_${browser}">
<test name="Acceptance Test_${browser}" >
I hope i didnt lose anybody. Not the best in explaining things but simply need away of capturing this argument in testng.xml and including that in the suite name
In build.xml file, set delegateCommandSystemProperties=true in testng tag and add
<sysproperty key="property" value="${property}"/>
under testng tag as follows:In testng file add "key" and "value" in parameter tag as follows:
Run ant from command-line and pass parameter value as follows:
This should work.
I think it should work with
<sysproperty>
if you setdelegateCommandSystemProperties
totrue
and nest the<sysproperty>
within<testng>
Not sure if you have nested the
<sysproperty>
?