Example:

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)

i'm not sure i understand. if i have a test class with three tests in it, ...

i'm not sure i understand. if i have a test class with three tests in it, how do i associate an attachment to a specific test case? it seems to me that when viewing the test case in the published reports, it would pick up the attachments for all test cases in the test class. i'm working on a geb project and am attempting to attach a screenshot to each test case.