0

I have test suite xml file that contains other test suites in the following format:

<suite-files>
    <suite-file path="debug1.xml" />
    <suite-file path="debug2.xml"/>

</suite-files>

Is there a way to add a dependency between the two sub suites? Meaning if debug1.xml fails, then debug2.xml should not be executed at all. TestNG does not provide any dependency on the <suite-files> level. Can this be done, perhaps, through some listener?

gandalf_the_cool
  • 659
  • 2
  • 9
  • 23

1 Answers1

1

You can define TestNG groups in your test code and arrange the dependencieslike:

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >

<suite name="test">

    <groups>
        <dependencies>
            <group name="debug1" depends-on=""/>
            <group name="debug2" depends-on="debug1"/>
        </dependencies>
    </groups>
    <suite-files>
        <suite-file path="debug1.xml"/>
        <suite-file path="debug2.xml"/>
    </suite-files>
</suite>

References:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks for the effort, but the above xml snippet, is not a valid one, since you cannot have groups and suite-files. Furthermore, grouping seems not to be running in parallel mode, and dependency didn't work correctly for me.Additionally I prefer to organise my tests in suites, and not tag them, by group name. More maintainability for me that way. Any other ideas? – gandalf_the_cool Jun 25 '19 at 09:56