This topic explains how to import data from a requirements management system into your IDE and utilize C/C++test's capabilities to ensure that all the imported requirements are verified by unit tests.
Sections include:
Overview
C/C++test allows you to import information about requirements specified in a requirements management system (RMS) to your IDE and visualize correlations between the imported requirements and test cases available in your project. By reviewing the correlations in the Requirements view, you can easily identify requirements that are not covered by any test case and address these gaps by adding appropriate test cases to your project.
The process consists of three main steps:
- Importing the data from DTP or a ReqIF file into your IDE.
- Scanning the projects in you workspace for existing test cases that correlate with the imported requirements.
- Creating new test cases to correlate with the imported requirements.
Supported ALM/RMS
ALM/RMS | Notes |
---|---|
Azure DevOps | Importing from DTP requires DTP 2021.2 or higher. |
CodeBeamer | Importing from DTP requires DTP 2020.2 or higher. |
DOORS Next | Importing from DTP requires DTP 2024.2 or higher. Importing from a ReqIF file is not supported. |
Jama Connect | Importing from DTP requires DTP 2021.2 or higher. |
Jira | Importing from DTP requires DTP 2020.2 or higher. Importing from a ReqIF file is not supported. |
Polarion | Importing from DTP requires DTP 2021.2 or higher. |
Requirements
If you import requirements from a ReqIF:
- Export the requirements from your requirements management system in the ReqIF format. Refer to the documentation for your ALM/RMS for instructions on how to create ReqIFs.
- ReqIFs must contain all necessary information for identifying and making correlations between requirements and test definitions. This includes identifiers, names, and descriptions of requirements and test definitions, as well as information about which test definitions verify a given requirement.
If you import requirements from DTP:
- Configure your C/C++test connection to DTP (see Connecting to DTP.).
- Specify the DTP project associated with the external ALM/RMS. DTP must be configured to connect to the external ALM/RMS and a project association must be configured. Refer to the DTP documentation for details.
Importing and Reviewing Requirements
You can import requirements form DTP or from a ReqIF file exported from your RMS.
- Go to Parasoft> Show View> Requirements in the IDE menu to open the Requirements view.
- Go to Import in the view's menu and choose DTP... or Local File... to open an import dialog.
- Provide the following information:
- If you import from a file, specify the path to the ReqIF file exported from your RMS and select the specification you want to import from that file.
- If you import from DTP, select the specification you want to import from your project on DTP. - Click OK. C/C++test will will display the imported data in the Requirements view.
Reviewing Imported Requirements
C/C++test displays imported requirements in the Requirements view. Depending on your RMS, a requirement may include one or more sub-modules called "test definitions". All work items (requirements and their test definitions, if available) are arranged as nodes in a tree, which can be collapsed or expanded.
You can double-click a work item to open its summary1. The summary contains the ID, name, and description of the requirement or test definition. Alternatively, you can right-click a node in the Requirements tree and choose Show details from the menu to open the summary.
1 You may be prompted to open the summary in an external browser.
You can right-click a work item and choose Copy ID to copy its ID to clipboard. This helps you correlate a requirement or test definition with a test cases by pasting the ID in your code to create an annotation (see Correlating Requirements with Test Cases).
Detecting Existing Correlations
To detect correlations between the work items you imported to your IDE and test cases in your project(s), click Scan for test cases on the Requirements view toolbar:
- after you import the requirements into the IDE to detect initial correlations.
- as you are working on your project to detect new correlations.
Alternatively, choose Auto detect test cases form the Requirement views menu to enable the automatic detection mode. As a result, C/C++test will automatically search for correlations after you import the requirements and as you are making updates.
When the scanning process completes, the detected test cases are matched with the corresponding work item in the Requirements view. You can right-click a test case and choose one of the following:
- Open - Opens the test case in Test Case Editor, which allows you to review and customize its content. Alternatively, you can double-click a test case to open it in Test Case Editor.
- Show in Test Case Explorer - Shows the test case in Test Case Explorer.
Requirements and test definitions that are not correlated with a test case are flagged with a caution icon:
You can also filter the view so that only requirements that are not covered by test cases appear in the panel.
Correlating Requirements with Test Cases
You can easily filter requirements and test definitions that are not correlated with any test cases by enabling the Filter work items with missing test cases option. If enabled, work items that are already matched with test cases are hidden, helping you focus on the gaps you need to address.
To make a correlation between a test case and a work item, annotate the test case with the following annotations:
@req
- Correlates a test case with a requirement.@test
- Correlates a test case with a test definition.
You can also drag and drop one or more requirements or tests from the Requirements view onto a test case or test suite in the Test Case Explorer view, and vice versa to make the correlation. The annotation in the test case code will be added automatically.
The correlation is visible in the Test Case Explorer view when test case details are enabled (via the Show>Details option).
Examples
Example 1
In the following example, requirement 1252 includes three test definitions: 1258, 1259, 1260. The only definition that has a corresponding test case is 1260.
To correlate test definitions 1258 and 1259 with test case "test_main_4", annotate the test case with @test 1258 1259
.
If the automatic detection mode is enabled, the Requirements view will be refreshed when you save the file. Otherwise, click Scan for test cases (see Detecting Existing Correlations). The Requirements view will now display the correlations between test definitions 1258 and 1259 and test case "test_main_4". In addition, requirement 1252 is now marked as completed by removing the icon, because all the test definitions it consists of are now matched with test cases.
Example 2
In the following example, requirements 102138, 10 2189, and 102190 are imported to the IDE. The requirements do not include any test definitions.
There is test case "test_main_7" in the project that can be correlated directly with requirement 102189. To make the correlation, annotate the test case with @req 102189.
If the automatic detection mode is enabled, the Requirements view will be refreshed when you save the file. Otherwise, click Scan for test cases (see Matching Requirements with Existing Test Cases). The Requirements view will now display the correlation between requirement 102189 and test case "test_main_7". In addition, requirement 102189 is now marked as completed by removing the icon.
Example 3
In the following example, requirement test 100378 is correlated with test case "test_debit_1" using drag and drop function. The annotation is added in the code.
Viewing Correlations in DTP
The Parasoft Traceability Pack extension for DTP enables you to view traceability information in DTP widgets, reports, and other visualizations. After associating tests to requirements, you can execute the test suites. Refer to the DTP documentation for details on configuring DTP to display traceability information for your C/C++test test cases.