1

I have a tricky question again and I hope you have a solution for me again.

Currently I have 2 testng.xml (testng1.xml and testng2.xml)

in testng1.xml
---------------
...
<suite name="Firefox Browser" verbose="1">
    <test name="FF">
        <parameter name="browserType" value="Firefox" />
        <classes>
            <class name="demo.Test01" />
            <class name="demo.Test02" />
         </classes>
    </test>    
</suite> 

in testng2.xml
---------------
...
<suite name="Chrome Browser" verbose="1">
    <test name="CH">
        <parameter name="browserType" value="Chrome" />
        <classes>
            <class name="demo.Test01" />
            <class name="demo.Test02" />
        </classes>
    </test>    
</suite> 

Okay,because of another issue (ATU report issue) I cannot combine these 2 testng files as 1 file (testng.xml) together, e.g.

testng.xml
----------
...
<suite name="Testsuite" verbose="1">
    <test name="FF">
        <parameter name="browserType" value="Firefox" />
        <classes>
            <class name="demo.Test01" />
            <class name="demo.Test02" />
        </classes>
    </test>    
    <test name="CH">
        <parameter name="browserType" value="Chrome" />
        <classes>
            <class name="demo.Test01" />
            <class name="demo.Test02" />
         </classes>
    </test>    
</suite> 

Question: Ist there a way how to define an xml file, e.g. allTestng.xml where I can run testng1.xml and testng2.xml ?

Important: testng1.xml should start and finish before testng2.xml can start.

Shafizadeh
  • 9,960
  • 12
  • 52
  • 89
lorenlai
  • 51
  • 7
  • 2
    Possible duplicate of [How to run TestNG test nodes in sequence but all inside classes in parallel for different browser capabilities?](http://stackoverflow.com/questions/31351565/how-to-run-testng-test-nodes-in-sequence-but-all-inside-classes-in-parallel-for) OR [TestNG method Sequence from TestNG.xml](http://stackoverflow.com/questions/22569420/testng-method-sequence-from-testng-xml) – Makjb lh Feb 28 '16 at 17:18

2 Answers2

0

You can create new testng.xml file and can call these suite testng.xml files with preserver-order='true' to execute in specified order. for example

 <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="My test suite" preserve-order="true">
<suite-files>
    <suite-file path="Testng1.xml"></suite-file>
    <suite-file path="Testng2.xml"></suite-file>
</suite-files>

above testng.xml file calls Testng1.xml suite file and then Testng2.xml.

I hope this is what you are looking for..

murali selenium
  • 3,847
  • 2
  • 11
  • 20
0

You can also use simply one testng.xml file with all your test cases inside, where cases are run one by one in following order. You are deciding which one to exclude or include into such test suite.

  <suite name="Suite" parallel="none">
    <parameter name="properties" value="Test.properties" />
    <test name="Test checks xyz">
        <classes>

            <class name="testpackage.testClass" />
            <methods>
                <include name="firstTestMethod" /> 
                <exclude name="secondTestMethod" />
          </methods>
        </classes>
      </test>
    </suite>
Slavo
  • 494
  • 4
  • 15