JUnit Attachments Plugin

Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID junit-attachments Changes In Latest Release
Since Latest Release
Latest Release
Latest Release Date
Required Core
Dependencies
1.3 (archives)
Dec 02, 2012
1.424
jquery (version:1.7.2-1)
Source Code
Issue Tracking
Maintainer(s)
GitHub
Open Issues
Tom Huybrechts (id: huybrechts)
Christopher Orr (id: orrc)
Usage Installations 2014-Feb 1531
2014-Mar 1642
2014-Apr 1682
2014-May 1703
2014-Jun 1727
2014-Jul 1853
2014-Aug 1860
2014-Sep 1927
2014-Oct 1960
2014-Nov 2002
2014-Dec 1995
2015-Jan 2035

This plugin can archive certain files (attachments) together with your JUnit results.

 

To activate this plugin, configure your job with "Additional test report features" and select "Publish test attachments".

How to attach files

By putting them into a known location

One way to do this is to produce files from your tests into a known location.

  • Jenkins looks for the JUnit XML report.
  • Then it looks for a directory with the name of the test class, in the same directory as the XML report.
  • Every file in this directory will be archived as an attachment to that test class.
Example:
  • test report in .../target/surefire-reports/TEST-foo.bar.MyTest.xml
  • test class is foo.bar.MyTest
  • test attachment directory: .../target/surefire-reports/foo.bar.MyTest/

By printing out the file name in a format that Jenkins will understand

The above mechanism has a problem that your test needs to know about where your test driver is producing reports to. This 2nd approach eliminates that problem by simply letting you print out arbitrary file names to stdout/stderr in the following format:

[[ATTACHMENT|/absolute/path/to/some/file]]

Each "ATTACHMENT" should be on its own line, without any text before or after.
See Kohsuke's post for more details.

Changelog

Version 1.3 (Dec 2, 2012)

  • Clicking on attachments ending with gif, jpeg, jpg or png (case-insensitive) are now shown inline in a "lightbox"
    • If there are multiple image attachments, you can navigate between them with the left and right arrow keys
  • Attachments are now tracked per individual test method, rather than just per test class (issue #7056)
    • This means all attachments for a class aren't repeated on the page for every test method
  • Improved parsing of files where the <testsuite> tag has stdout/err data (issue #13115)
  • Parsing of "ATTACHMENT" lines is now slightly more lenient

Version 1.2 (Dec 19, 2011)

  • Added a mechanism to specify attachments via stdout/stderr.

Version 1.1 (Jan 3, 2011)

  • Fix issue #5634: Save redirected stdout/stderr output of junit-tests when using maven.test.redirectTestOutputToFile as additional attachments.

Version 1.0 (Nov 27, 2009)

Labels

Edit
plugin-report plugin-report Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Add Comment