postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.78k stars 1.15k forks source link

Using JUnit reporter generates the wrong name per test #3230

Open rion18 opened 2 months ago

rion18 commented 2 months ago

Issue

When using newman with the JUnit reporter, it seems that the name for every test is the name of the collection as setup in Postman. This is wrong, as it should reflect the ACTUAL test we're running.

For instance for this file:

  "info": {
    "_postman_id": "123",
    "name": "A test for JUnit reports API",
  },
  "item": [
    {
      "name": "Contract and Integration Tests",
      "item": [
        {
          "name": "Execute an awesome test",
          "event": []
        },
        {
          "name": "Execute another test",
          "event": []
        }
      ]
    }
  ]
}

Expected

I would expect the JUnit report to output TWO tests on the report:

Contract and Integration Tests > Execute an awesome test
Contract and Integration Tests > Execute another test

Current situation

Instead, I get this:

I would expect the JUnit report to output TWO tests on the report:

ATestForJUnitReportsAPI
ATestForJUnitReportsAPI

According to xmlbuilder-js CHANGELOG, they

Renamed attributes property to attribs to prevent name clash with DOM property with the same name.

I'll create a PR to fix this.