Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space ENGINES1031 and version 2020.1

In this section:

Table of Contents
maxLevel1

Overview

You can configure dotTEST 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 their URL associations.
  4. Use the tags in the framework-specific attributes (see Using Attributes for details).

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.

Code Block
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
  • test

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

Code Block
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:

Code Block
report.assoc.url.tag1=[URL]

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

Code Block
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:

Code Block
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.

Anchor
Using Attributes
Using Attributes
Using Attributes

In order to associate tests with artifacts, use the appropriate framework-specific attribute:

To associate a tag with your tests, place the tag in the attribute specific to the framework:

  • NUnit

    Code Block
    [Property("bug", "1234")]
    
    [Test]
    
    public void Test()
    
    {
         ...
    }
  • MSTest

    Code Block
    [TestProperty("bug", "1234")]
    
    [Test]
    
    public void Test()
    
    {
         ...
    }
  • xUnit

    Code Block
    [Trait("bug", "1234")]
    
    [Fact]
    
    public void Test()
    
    
    {
         ...
    }

Associating Tags with Classes

All the supported frameworks allow you to associate a tag with a class. As a result, it will be associated with all the tests within this class. In the following example for NUnit, bug 9876 is associated with both tests within the Test class, whereas bug 111 is associated only with the Test2 test:

Code Block
[Property("bug", "9876")]
public class Tests
{
   [Test]
   public void Test1()
   {
     ...
   }

   [Property("bug", "111")]
   [Test]
   public void Test2()
   {
     ...
   }
}

Multiple Associations

All the supported frameworks allow you to associate one tag with more than one artifact. The following example shows multiple associations for the NUnit framework.

Code Block
[Property("bug", "1234, 1199")]
[Test]
public void Test()
{
     ...
}

You can separate the tasks with a comma, a semicolon or a space character. In the example below, the test is associated with all the listed tasks:

Code Block
[Property("bug", "1234, 1199; 2345 1928")]
[Test]
public void Test()
{
     ...
}
Scroll Pagebreak