In this section:

Overview

You can configure Jtest to associate tests with a broad range of development artifacts, such as requirements, defects, tasks, and feature requests.

To successfully associate unit tests with artifacts, you need to:

  1. Enable the artifact association property.
  2. Specify issue tracking tags.
  3. (Optional) Configure URL associations.
  4. Use the tags in the Javadoc

Enabling Artifact Associations

Ensure the report.associations property is set to true to enable associations with artifacts. This also enables/disables test associations in the HTML report.

report.associations=true

Specifying Issue Tracking Tags

The following tags for artifact types are associated by default when report associations is enabled:

  • asset
  • fr (enhancements)
  • pr (defects)
  • req (user stories)
  • task

You can use the issue.tracking.tags property to define any number of additional tracking tags. Separate tags names with a comma:

issue.tracking.tags=tag1,tag2,tag3

Configuring Issue Tracking Tags and URL Associations

You enable generating a link to the association in the HTML report by configuring the report.assoc.url.tag{n} option:

report.assoc.url.tag1=[URL]

URLs can contain [%ID%] or ${id} variables, which will be replaced by issue identifiers. For example:

report.assoc.url.tag1=http://bugzilla.company.com/show_bug.cgi?id=[%ID%]

Enabling Test Details

You can enable or disable showing test details in the HTML report:

report.contexts_details=[true | false]

The report.contexts_details property must be set to true to enable showing associations.The product’s property file is preconfigured to enable showing test details.

See Report Settings for additional information.

Using Javadoc Tags

Use Javadoc tags to associate unit tests with artifacts.

Place the tag in the Javadoc to associate it with your tests. The tags used in the Javadoc should be preceded by a @ character.

/**
 * @bug 12345
 * @pr 223344
 * @tag1 5533
 */
@Test
public void testSomething()
{
   ...
}


You can also associate a tag with a class. As a result, it will be associated with all the tests within this class. In the following example, tag 9876 is associated with both tests within the Test class, whereas tag 111 is associated only with the testSomething2 test:

/**
 * @tag 9876
 */
public class Test {

    testSomething1()
    {
     ...
    }

    /**
     * @tag 111
     */
    testSomething2()
    {
      ...
    }
}

Multiple Associations

You can associate one tag with more than one artifact. Separate multiple associations with a comma that is not followed by a space character.

/**
 * @task 1234,2345
 */
@Test
public void testSomething()
{
   ...
}

If you separate the tasks with a comma and a white space, the test will be associated only with the first listed artifact. In the following example, the test is associated only with task 1234:

/**
 * @task 1234, 2345
 */
@Test
public void testSomething()
{
   ...
}


  • No labels