craigahobbs / unittest-parallel

Parallel unit test runner for Python with coverage support
MIT License
29 stars 5 forks source link

Generation of JUNITXML #16

Open b-guerra opened 11 months ago

b-guerra commented 11 months ago

Hi everyone, so sorry if this is not supposed to be raised as an issue, I am really new at github to be honest :)

I found your project MARVELOUS! I works wonder, and honestly has given me a way superior performance than pytest-parallel or pytest-xdist. The only thing I am not been able to find is how to generate JUNITXML like reports from it.

I found inside the flags the usage of the coverage report, which gives me a nice % of how each file of my project has been used, but havent found a report containing the failed and errors from the tests itself (which I will then send to my CodeBuild reports)

Could you please inform me if there is a way? If this is not how I should ask, I definitely apologize in advance.

b-guerra commented 11 months ago

I was reading the code of unittest-parallel, and I dont believe there is a easy way to do so... I then found this project https://github.com/xmlrunner/unittest-xml-reporting which appears to create a XMLTestRunner based on the TextTestRunner (that you guys are using within your project)

I have a question, would that be something doable? Using the xmlrunner as a additional plugin of unittest-parallel?

craigahobbs commented 11 months ago

This is potentially not hard to do. After thinking about it a bit, I think the best way to do it would be to add a new command line argument to override the default test runner class in a form like "xmlrunner.XMLTestRunner". This can be imported using Python's importlib. This avoids a dependency on unittest-xml-reporting and also potentially allows the use of other test runner classes. You would pass the test runner class to ParallelTestManager and use it (if provided) instead of the default test runner class. If this works feel free to create a pull request.

craigahobbs commented 2 months ago

I've created a branch to unittest-parallel that does the above. Does it work for your use case?

https://github.com/craigahobbs/unittest-parallel/tree/feature/custom-runner