Mydisname
Mydisname

Reputation: 213

Jenkins test result parsing

I've got a Jenkins with a lot of jobs. These jobs do tests and produce test outputs in XML. Those XML test results look - pretty standard - like this:

<testsuites name="testsuitesname">
  <testsuite name="testsuitename">
    <testcase classname="classname" name="testcasename">
      blabla
    </testcase>
  </testsuite>
</testsuites>

When you use the Post-build action Publish JUnit test result report (found on the configuration page of a job) the structure of those published results of a build (in Jenkins) will be like this:

  1. <root> (headline: package)
  2. <classname> (headline: class)
  3. <testcasename> (headline: test name)

There is no <testsuitesname> and no <testsuitename> in this hierarchy like it is in the XML files.

Is there any option to either:

  1. add the <testsuitesname> and <testsuitename> to the hierarchy in the test result publishing hierarchy of a Jenkins build:

    1. (<root>)
    2. <testsuitesname>
    3. <testsuitename>
    4. <classname>
    5. <testclassname>

or

  1. somehow add more hierarchy to the <testcase> tag?

Background: Because my test results are quite large (big amount) I want to add more hierarchy/structure to it and not just two levels (like it is now) to gain more overview over all of those results.

Can anybody help me or had a similar problem?

Best

Andy

Upvotes: 5

Views: 3722

Answers (1)

Mydisname
Mydisname

Reputation: 213

Unfortunately I found no easy answer to change the behaviour of Jenkins in structuring the teststructure different. However, I found an improvement in my case which I want to share.

The hierarchy of test results in Jenkins is the following:

  1. Package
  2. Class
  3. Test name

Those can be defined within the <testcase>-tag as the following:

<testcase classname="packagename.classname" name="testname">

So within "name" you can define the last part of the hierarchy - the test name. Within "classname" you can define the first two parts of the hierarchy - the package and the class, seperated by a dot.

Keep in mind that there is only one dot allowed. It is not possible to create a deeper hierarchy by just adding more "seperated parts" in the classname tag only by adding more dots. If there are more dots than one, the last one counts.

So a "complete" example:

<testsuites name="testsuitesname">
  <testsuite name="testsuitename">
    <testcase classname="packagename.classname" name="testname">
      blabla
    </testcase>
  </testsuite>
</testsuites>

Upvotes: 7

Related Questions