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
- Verify that Selenic can send results to DTP. See Reporting Results to DTP.
- Verify that DTP is integrated with a supported ALM. Refer to the Parasoft DTP documentation for details.
- Create work items (e.g., user stories, tasks, tests, etc.) in your ALM. Refer to your ALM documentation or ALM administrator for details.
- 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:
Property | Description | Required |
---|---|---|
type | Specifies the type of work item in the ALM to associate with the test. Valid values:
Example:
| Required |
id | Specifies the ID of the work item in the ALM. The type and number of characters vary acrosss ALMs. Example:
| 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:
| 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:
- See the Analyzing Test Executions and Generating Recommendations section for instructions on executing tests in the IDE.
- See the Command Line section for instructions on executing tests on the command line.
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.