How can I merge multiple TestNG suite results to o

2019-07-19 15:22发布

问题:

So here's an issue at my work. I've got a few TestNG cases that, if run within the primary batch of test cases, wreak havock throughout the other test cases. Rather than going through and changing all our test cases, I've made a group for the involved cases. I run the main test suite, excluding that group, and then make a second Ant call to run the affected group. This way all test cases pass, but I'm ending up having to create two TestNG reports so that the first one doesn't get overriden with the results from the second group.

So here's my question: is it possible to merge the second test result report with the first, or am I stuck with the two?

回答1:

I think that the only way you would be able to do this is to process the TestNG XML output after the two runs. You should be able to collate the XML files from the two runs and combine it into a single HTML report using the Ant JUnit Report task.

If you aren't happy with the output you get from this, it could be because TestNG organises its JUnit XML output oddly. You get better results (in my opinion) if you use the JUnitXMLReporter from my ReportNG project and run JUnit Report on that.

Alternatively, you might be able to use this XSLT reporter for TestNG to combine the XML output from the two test runs into a single HTML report, though I've no idea if it supports this or not.



回答2:

I think the Jenkins TestNG plugin will take a *.xml filter to concatenate multiple result files.