I'm working on a script that generates test results in JUnit XML format that Jenkins accepts.
I read through some answers in StackOverFlow about this topic: JUnit XML format specification that Hudson supports and Spec. for JUnit XML Output but none of these talks about the detail of the "testsuites" attributes or options.
I want to show the total number of "testcase", total number of failed "testcase" and total number of skipped "testcase" from all the "testsuite" under the "testsuites".
ie <testsuites *something to add here to include the info demanded*>...</testsuites>
Is there a way to achieve that?
Any help will be greatly appreciated!
JUnit xml is a framework that was used in many applications in the test frameworks. By default, the test will generate xml files which are simple reports used for the execution of the test. These files are used to generate the report which was custom, we can also generate the reports as per the requirement of testing.
The JUnit plugin provides a publisher that consumes XML test reports generated during the builds and provides some graphical visualization of the historical test results (see JUnit graph for a sample) as well as a web UI for viewing test reports, tracking failures, and so on.
Create JUnit Test Case Class Create a java class, which is a JUnit test class, TestJunit. java in /work/testng/src. To execute the JUnit test cases, define the property junit="true" as in the xml above. The JUnit test case class TestJunit is defined in class name.
I think that information will be automatically computed by Jenkins. If not - don't bother adding it, it won't be displayed anyway.
Here's a useful tip on how to debug this sort of thing: create a job (let's name it jUnitReport) that "touches" a file (let's call it jUnit.xml) in a shell/batch build step; add 'Publish JUnit test resul report' and specify jUnit.xml in 'Test report XMLs' edit box. Run the job once - that will create its workspace. Now place valid jUnit.xml that you want to test in the workspace. Run the job again and examine how test results look.
It is important not to remove the 'touch' step - otherwise Jenkins will think of the test results as stale and fail the build.
You can now play with jUnit.xml without running actual tests and examine how it affects results Jenkins displays.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With