Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48008

Attachments are shown on a test class page only, not on a test case page

XMLWordPrintable

      It is not possible to browse attachments per test case. There was a fix https://issues.jenkins-ci.org/browse/JENKINS-7056 which contains the code which seems to be impossible to work.
      1. In the GetTestDataMethodObject.java, method attachFilesForReport the empty test case name is hardcoded while the HashMap is filled:

      tests.put("", includedFiles);

      2. In the AttachmentPublisher.java, method getTestAction:

                  if (testName == null) {
                     ...
                     // this code is working when I open the test class page https://.../testReport/junit/Milltest/MERGEFONTS/ - the attachments are displayed properly
                  } else {
                      attachmentPaths = tests.get(testName);
                     // this code is working when I open the test case page https://.../testReport/junit/Milltest/MERGEFONTS/Test - the attachments are NOT displayed
                  }
      

      So, since the hash map always has "" as a key, the "else" statement will never work properly.
      In the ticket https://issues.jenkins-ci.org/browse/JENKINS-7056 is was said that the attachments per test case should be available if their names match the test case name.
      But looking to the code it is not possible, since the hash expects "" as a test case name.

      I use the version 1.4.2 of the plugin which seems to be the latest one. My JUnit report results/Milltest1.xml is looking this way:

      <?xml version="1.0" encoding="UTF-8" ?>
      <testsuites>
      <testsuite tests="72" skipped="1" errors="0" failures="0" hostname="pyxis" name="Milltest" time="165.388550043" timestamp="2017-11-14T14:20:32">
        <testcase classname="Milltest.MERGEFONTS" name="Test" time="2.86660194397">
        <properties>
          <property name="author" value="USR"/>
          <property name="date" value="20YY-MM-DD"/>
          <property name="short" value="Merge fonts"/>
          <property name="description" value="..."/>
        </properties>
        </testcase>
      </testsuite>
      </testsuites>
      

      and it is specified as results/*.xml in the Jenkins "Test report XMLs" field of the "JUnit Attachment" plugin.

      The directory with the test results (which contains attachments) is results/Milltest.MERGEFONTS.

            huybrechts huybrechts
            alexander_samoylov Alexander Samoylov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: