You can enable traceability from Selenium tests to work items in your application lifecycle management (ALM) system and report the data to Parasoft DTP. This provides visibility into how well software requirements are covered by tests. In this section:

Initial Set Up

  1. Verify that Selenic can send results to DTP. See Reporting Results to DTP.
  2. Verify that DTP is integrated with a supported ALM. Refer to the Parasoft DTP documentation for details. 
  3. Create work items (e.g., user stories, tasks, tests, etc.) in your ALM. Refer to your ALM documentation or ALM administrator for details.
  4. Test traceability is enabled by annotating your Selenium tests with tags that correlate them with a work item in your ALM. To use annotations, the Parasoft Annotations Maven dependency must be added to your project. The dependency is included when creating projects with Selenic (see Creating Selenium Test Projects from Recorded Actions). For existing projects, add the dependency to your project pom.xml file:
<dependency>
 <groupId>com.parasoft</groupId>
  <artifactId>parasoft-annotations</artifactId>
  <scope>test</scope>
  <version>1.0</version>
 </dependency>

You can also refer to the Parasoft Annotations project on GitHub, which includes the JavaDoc API documentation.

Adding Annotations

Use the @WorkItem annotation in your test methods and classes to correlate the test with work items in your ALM. Annotations include the ID of the work item, type of work item, and a URL to the work item in the ALM (optional). The following table describes WorkItem properties:

PropertyDescriptionRequired
type 

Specifies the type of work item in the ALM to associate with the test. Valid values:

  • PR - Use this type for bugs or defects
  • FR  - Use this type for feature requests
  • REQ - Use this type for requirements or user stories
  • TASK - Use this type for tasks 
  • TEST - Use this type for tests

Example:

@WorkItem(type=REQ, id="123")

Required
id 

Specifies the ID of the work item in the ALM. The type and number of characters vary acrosss ALMs.

Example:

@WorkItem(type=TEST, id="TESTCASE-4426") 

Required
url 

Specifies the URL of the work item in the ALM. The purpose of the URL parameter is to provide additional information for test reviewers. It is not used for any Selenic functionality.

Example:

@WorkItem(type=TEST, id="TESTCASE-4426", url="https://server.myALM.com/") 

Optional

Example Annotation

import com.parasoft.annotations.WorkItem;
import static com.parasoft.annotations.WorkItem.Type.*;

@WorkItem(type=REQ, id="REQ-123", url="https://server.myALM.com/")
@WorkItem(type=REQ, id="REQ-124", url="https://server.myALM.com/")
public void myFunction() {
    . . .
}

Running Tests

Execute your tests with Selenic after adding WorkItem annotations:

The annotations will be included in the test results sent to DTP where they can be processed and included in DTP's reporting mechanisms. 

Viewing Results

Refer to the Parasoft DTP documentation for information about viewing test data in DTP dashboards and widgets.

  • No labels