Skip to content

Reporter.log report log output twice in junitreports *.xml files #3217

@eotsevych

Description

@eotsevych

TestNG Version
7.11.0

Current behavior
Using Reporter.log in test reports same log message twice in /junitreport/**.xml files, first inside <testcase>, second - after all <testcase> inside <testsuite>

    public void test1() {
        Reporter.log("[[PROPERTY|id=TC-1]]\n");
    }

Junitreport xml output

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="" failures="0" tests="1" name="com.example.demo1.MainPageTest" time="0.002" errors="0" timestamp="2025-03-06T23:19:28 EET" skipped="0">
  <testcase classname="com.example.demo1.MainPageTest" name="test1" time="0.002">
    <system-out>
      <![CDATA[[[PROPERTY|id=TC-1]]
]]>
    </system-out>
  </testcase> <!-- test1 -->
  <system-out>
    <![CDATA[[[PROPERTY|id=TC-1]]
]]>
  </system-out>
</testsuite> <!-- com.example.demo1.MainPageTest -->

Expected behavior
Log reported only once inside <testcase>

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitReportReporter -->
<testsuite hostname="" failures="0" tests="1" name="com.example.demo1.MainPageTest" time="0.002" errors="0" timestamp="2025-03-06T23:19:28 EET" skipped="0">
  <testcase classname="com.example.demo1.MainPageTest" name="test1" time="0.002">
    <system-out>
      <![CDATA[[[PROPERTY|id=TC-1]]
]]>
    </system-out>
  </testcase> <!-- test1 -->
</testsuite> <!-- com.example.demo1.MainPageTest -->

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions