5

I am trying to run multiple suites from one overall suite file. I define the suites I need to run and run the "master" suite file. I have used preserve-order to run each suite in sequence, however the behaviour is not as I would expect. It seems that it runs them straight away, one after the other, almost in parallel.

Does anyone know a way I can execute the suites, preserving the order, ideally waiting for first suite to finish before second suite will run?

My suite setup is as follows:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="My test suite" preserver-order=true>
    <suite-files>
        <suite-file path="Test1.xml"></suite-file>
        <suite-file path="Test2.xml"></suite-file>
        <suite-file path="Test3.xml"></suite-file>
    </suite-files>
</suite>

Regards, Jacko

Jacko Moore
  • 51
  • 1
  • 2

4 Answers4

0

Is the issue that you haven't specified the attribute correctly? It should be

preserve-order="true"

not

preserver-order=true

VolleyJosh
  • 161
  • 1
  • 1
  • 13
0

The best option is to remove suite-file tag (because it is not affected by preserve-order option by design) and refactor testng.xml to use test tags and dependencies on groups or preserver-order.

RocketRaccoon
  • 2,559
  • 1
  • 21
  • 30
0

According to the testng documentation,

By default, TestNG will run your tests in the order they are found in the XML file. If you want the classes and methods listed in this file to be run in an unpredictible order, set the preserve-order attribute to false

Moreover, if you want the execution to run in an unpredictable manner you can do it as following.

<suite name="My test suite" preserver-order="false">
    <suite-files>
        <suite-file path="Test1.xml"></suite-file>
        <suite-file path="Test2.xml"></suite-file>
        <suite-file path="Test3.xml"></suite-file>
    </suite-files>
</suite>

You have to specify the

preserve-order = "false"

not

preserve-order = false

Erangad
  • 671
  • 7
  • 16
-1

In Suite tag, specify attribute thread-count=1, parallel="false". Let me know if this works.

Mrunal Gosar
  • 4,595
  • 13
  • 48
  • 71
  • Thanks for the reply. I have tried this mechanism and the issue still occurs. The first suite is started and then straight away the second suite and third suite are executed. I can see this as the console output for each suite is intertwined and mixed. – Jacko Moore Sep 30 '14 at 09:24
  • Ok. Let me dig into the code and will get back to you in a day. – Mrunal Gosar Sep 30 '14 at 16:38