weiwei / junitparser

Parses JUnit/xUnit Result XML files with ease
https://junitparser.readthedocs.io
Other
120 stars 52 forks source link

Preserve / add testsuites.name when merging with CLI tool #93

Closed yusijs closed 2 years ago

yusijs commented 2 years ago

When running junitparser merge --glob *.xml junit-report.xml where the files have <testsuites name=..">, the generated xml doesn't have the name-property for the testsuites tag. We're using this to group our tests, and we're having some issues with it.

I have found a couple workarounds which could work, but they are either messy/not stable (using sed to replace in the generated file) or more tedious to maintain (writing a custom python script where we append the name)

Would love a solution that could allow me to - in the cli - just run junitparser merge --glob *.xml junit-report.xml --suiteName "My Test Suite" which seems like a fairly straight forward thing to add in cli.py? Another option could be --suiteAttributes or similar which takes in a comma-separated list to be more flexible: junitparser merge --glob *.xml junit-report.xml --suiteAttributes "name=My Test Suite,custom=Custom Value"

I'm not super versed in python so I'm a bit concerned about messing around to much with this myself, but can always give it a stab if that would be better. :)

yusijs commented 2 years ago

I attempted a pr here -> https://github.com/weiwei/junitparser/pull/94

weiwei commented 2 years ago

@yusijs 2.8.0 release should contain your changes. Thanks for the PR!