Skip to content

Test listeners specified in parent testng.xml file are not included in testng-failed.xml file #2879

@matijalucman

Description

@matijalucman

TestNG Version:

7.7.1

Expected behavior

The test listeners specified in the parent testng.xml file should be included in the testng-failed.xml file when running the test from the child testng.xml file.

Actual behavior

In the case when tests are specified in child testng.xml, for example:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Automated tests" verbose="1" thread-count="3" parallel="tests">

    <test name="Test" preserve-order="true">

        <classes>
            <class name="com.test.tests.Test"/>
        </classes>
    </test>

</suite>

and run using parent testng.xml where test listeners are specified, for example:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Tests" preserve-order="true">

    <listeners>
        <listener class-name="com.test.listeners.Listener"/>
    </listeners>

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

</suite>

test listener won't be specified in the automatically generated test-failed.xml file in the case of test failure:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite thread-count="3" parallel="tests" name="Failed suite [Test]" guice-stage="DEVELOPMENT">
  <test thread-count="3" parallel="tests" name="Test(failed)">
    <classes>
      <class name="com.test.tests.Test">
        <methods>
          <include name="methodSetUp"/>
          <include name="closeInstance"/>
          <include name="refreshInstance"/>
          <include name="Test_test" invocation-numbers="0"/>
          <include name="setUpWebDriver"/>
        </methods>
      </class> 
    </classes>
  </test> 
</suite>

This same case worked correctly (test listeners from the parent testng.xml file were specified in testng-failed.xml file in the case of test failure) when we were using version 6.14.3., after migrating to version 7.7.1, it stopped working.

Is the issue reproducible on runner?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions