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.
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 Requirements Management Systems
- Jira (import from DTP only)
If you import requirements form a file:
- Export the requirements form your requirements management system in the ReqIF format.
- Ensure that the ReqIF file contains all the information critical to identifying and making correlations between requirements and test definitions, including identifiers, names, and descriptions of requirements and test definitions, as well as information on how they are related (which test definitions verify a given requirement).
If you import requirements from DTP:
- Configure connection to DTP.
- Select the project from which you want to import requirements.
See Connecting to DTP.
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 any test case are marked with.
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.
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.
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
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 102189and test case "test_main_7". In addition, requirement 102189 is now marked as completed by removing the icon.
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.