-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate JUnit/XML test report #204
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, what a great feature! Take a look at my requested changes and let me know what you think.
Co-Authored-By: fchauvel <franck.chauvel@gmail.com>
Co-Authored-By: fchauvel <franck.chauvel@gmail.com>
Thanks for looking at my code. I implemented the changes you suggested. There are other features I'd like to implement, including:
What do you think? |
I'm certainly open to your ideas (though I suggest they should each come in separate pull requests!). Given that I have never had anyone request these features, I would definitely want to focus on keeping the code fairly clean and making the new output optional in most cases. You did a good job on both of those in this PR. 😄 Green does not currently do any time measurements other than the one from start-to-finish of the entire run. You could add more timing measurements and output as a new option. Same with more fine-grained count summaries (I assume you mean per-module, because suites are a messy catch-all recursive construct and don't map one-to-one to modules at all). Where would you put the output? Are you thinking in-line with verbose output, or as a supplemental report after the run? Oh, you should also be aware that Green runs tests simultaneously in multiple subprocesses. You'll want to take that into account if you start timing individual parts, because the times of tests from different processes will overlap. It would be really nice to get a sum of all processor time and combine that with the total time to produce a "speedup" measurement. Some of the environment is output already if you do |
…les/ into our testing coverage.
✅ This shipped in 2.15.0, which was just released. |
Hi,
I added an option
-j
(or--junit-report
) that serializes a GreenTestResult into an JUnit/XML file. I think this addresses Issue #104, a feature I also need.I added a new module
reporting.py
, which contains an JUnitXML class. I then import this class in thecmdline.py
module, once tests are run. A few preliminary unit tests are in the moduletest.test_reporting.py
. Note that I had to comment out the deletion of captured output, once they have been displayed (seeresult.py
) otherwise they are no longer available and I cannot include them in the report. The tests seems to pass (on my machine), but there may be consequences I do not foresee.This implies a new dependency to lxml 4.3.3, which I use to generate the XML tree.
Does it sounds like a good approach? I can refine or adjust as needed.