Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JUnit XML "packages" in hudson

I'm generating XML's myself that look enough like JUnit for Hudson to read them. It works great except I can't figure out what the "packages" list is in the Hudson web GUI. How do I make an XML that will be interpreted by Hudson as a "package?"

<testsuites>
<testsuite>

  <testcase classname="class\name\that\is\really\folders" name="test_name.log" time="231">
  </testcase>
</testsuite>
</testsuites>

Hudson will list this as:

Package: (root)
Class: class\name\that\is\really\folders
Test Name: test_name.log

like image 879
whitey04 Avatar asked Jan 02 '12 06:01

whitey04


Video Answer


2 Answers

@pushy - I tried that before, but when I tried to prove you wrong I got it this time ;-).

<testsuites>
<testsuite name="package.name.of.your.testclass">

  <testcase classname="package.name.of.your.testclass.class\name\that\is\really\folders" name="test_name.log" time="231">
  </testcase>
</testsuite>
</testsuites>

You must prefix the classname of each test case with the testsuite name for it to be accepted as a "package".

like image 154
whitey04 Avatar answered Oct 31 '22 15:10

whitey04


No need for redundancy! Jenkins nicely infers the package and class names if you:

  • use the name attribute instead of classname
  • ensure the <testsuite> element's name attribute has at least two dot delimited "sections." Now all the enclosed <testcase> elements will get a package and class. The very last part will be the class name. The remainder will be be the package name.

Like this:

<testsuites>
    <testsuite name="packagename.classname">
      <testcase name="test_name.log" time="231"></testcase>
    </testsuite>
</testsuites>
like image 25
Leftium Avatar answered Oct 31 '22 14:10

Leftium