testng-team / testng

TestNG testing framework
https://testng.org
Apache License 2.0
1.98k stars 1.02k forks source link

parameters are not inherited with <suite-file> inclusion #1026

Open hwcc opened 8 years ago

hwcc commented 8 years ago

For example: if we have a parent suite xml file parent.xml

<suite>
    <suite-files>
        <suite-file path = "./child.xml" />
    <suite-fies/>
    <test>
        ...
    <test/>
<suite/>

and a child suite xml file child.xml

<suite>
    <parameter name="a" value="b1" />
<suite/>

When executing it, the value of parameter a is missing because there isn't specified in the child.xml

This could happen for as well. I have not specifically tried

juherr commented 8 years ago

In fact, some nodes from <suite> of <suite-files> are just copied into the main suite.

Now, imagine the "a" parameter is already defined into the main suite. What will be the expected behavior?

The idea behind suite-files is to have the tests selection for a specific suite (with its own parameters for example). In your case, why not running each suite separately?

hwcc commented 8 years ago

Thanks @juherr for the reply. I have also considered what you have suggested - putting parameters in the main files and have children suites contains tests only. That still didn't work because in our tests, we define parameters not only on the suite level, but also under <class> <test> or even <method>. Those parameters were not copied over when children suites were part of the <suite-file> inclusion.

juherr commented 8 years ago

In fact, I was thinking about something like:

java org.testng.TestNG testng1.xml [testng2.xml testng3.xml ...]

http://testng.org/doc/documentation-main.html#running-testng

For example, maven supports it: https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#suiteXmlFiles