Single execution ID for multiple tests by using TestNG

This article explains how you can get a single Execution ID and use it later to analyze your results.

When you use TestNG, your XML file has a structure similar to the following.

Copy

</suite>

       <test name="ExecutionID using TestNG" enabled="true">
              <parameter name="driver.capabilities.platformName" value="ios"></parameter>
              <groups>
                     <run>
                        <include name="@WebSearch"/>
                     </run>
              </groups>
              <classes>
                    <class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory"/>
              </classes>
       </test>     
</suite>
 …

This will generate one test run result with a single Execution ID.

If you want to have more than one run covered by the same Execution ID, you need to remain in the frames of the same test. For the example in this article I have included another include like this:

Copy

</suite>

       <test name="ExecutionID using TestNG" enabled="true">
              <parameter name="driver.capabilities.platformName" value="ios"></parameter>
              <groups>
                     <run>
                            <include name="@WebSearch"/>
                            <include name="@WebResultsList"/>
                     </run>
              </groups>
              <classes>
                    <class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory"/>
              </classes>
       </test>     
</suite>
 …

This will provide you with two runs with the same Execution ID:

  and 

As you can see, the two runs started at a different time but have the same Execution ID.