...
Suppressions are special markers that enable you to run a test or follow a code static analysis rule while ignoring specific occurrences of the reported tasks. Suppressing tasks related to functional testing can reduce the amount of noise tests generate during early-stage testing or for cases when then certain steps are expected to fail. Suppressing tasks removes failures from the Quality Tasks view, but will not result in passing tests, nor will failures be removed from reports.
Suppressions for static analysis enables you to comply with programming guidelines by defining exceptions that do not impact the critical parts of the application. Multiple tasks may be reported for a single code static analysis rule, but you can apply a suppression if the rule is not applicable for a particular case.
When you apply a suppression, a parasoft.suppress file is created in the same location as the test file. The suppression file includes information, such as which file has a suppression, the suppression author, and the reason for the suppression (see Manually Defining Suppression Files). Suppressed tasks are also removed from the Quality Tasks view.
Suppression settings are independent of Test Configurations. The The Test Configuration defines the scope of the test execution, coverage settings, and other features, as well as the set of rules that are checked during static analysis. Suppressions Suppressions define which tasks associated with a failing test or reported by static analysis results should be visible in Quality Tasks view and reports.
Anchor | ||||
---|---|---|---|---|
|
- Right-click on a reported task in the Quality Tasks view and choose Suppress Task.
You can also right-click on a node containing task (rule category, specific rule, file, etc.) to suppress all children tasks.
- Choose where you want to store your suppression(s) when prompted. Storing suppressions on Team Server is deprecated and disabled by default and will be removed in future versions. See Enabling Team Server Suppressions (Deprecated) for instructions.
- Enter your reason to for suppressing the task when prompted and click OK.
...
Field | Description | Required |
---|---|---|
suppression-begin | Indicates the beginning of an individual suppression. All subsequent fields up to and including the suppression-end field are part of the same suppression. | Required |
file | Specifies the name of the test file. | Required |
line | Specifies the line number in the code where the violation occurred. This field applies to static analysis only. Note that if the line number changes, i.e., updates to the code changes where the violation occurs, the suppression will become invalid. | Optional |
rule-id | Specifies the code analysis static analysis rule ID that reported the violation. This field applies to static analysis only. | Optional |
test-id | Specifies the test ID. This enables you to target specific tests within the test file to suppress. The test ID appears in the This field applies to functional test execution. | Optional |
message | Specifies the message printed to the Quality Tasks view for the violation or test failure. The value must match the printed message exactly for the suppression to be valid. If the message is specified but no matching message is reported, the suppression will be invalid. | Optional |
reason | Specifies the justification for suppressing the violation or test failure. If it is determined that the task is reported as a false positive, begin the statement with | Optional |
author | Specifies the code or test author. | Optional |
date | Specifies the date the suppression was applied. | Optional |
suppression-end | Indicates the end of the suppression. | Required |
The following properties All properties specified in the suppression must match task properties for the suppression to be valid:
file
message
test-id
(functional testing) orrule-id
(static analysis)
Suppressions that only match one or two of the fields will not be applied.
Example Suppression File
The following example shows a suppression file containing two functional test step suppressions:
...
Storing suppressions in the XML-style format locally or on Team Server is deprecated. Instead, suppressions are stored in the parasoft.suppress file. You can create suppressions using SOAtest's IDE functionality (see Suppressing Tasks) or by manually adding them to the parasoft.suppress file (see Manually Defining Suppression Files). Suppressions stored in deprecated format are still applied to your code and can be reviewed in the deprecated Suppressions view, but you can use the suppression migration functionality to transfer them to the parasoft.suppress file format.
Migrating Suppressions from Deprecated Format
- Choose Parasoft > Show View > Suppressions (deprecated) from the main menu to open the deprecated Suppressions view.
- Choose Migrate suppressions... from the menu.
- Confirm the migration when prompted.
One of the following scenarios will be applied.
Connected to Team Server
If connected to Team Server, SOAtest checks for team suppressions stored on Team Server and not the local workspace.
- Deprecated team suppressions detected by SOAtest will be converted to plain text and saved in the parasoft.suppress file(s) located in the same location as the corresponding source file(s).
- Deprecated team suppressions will continue to be available on Team Server.
- Deprecated team suppression will remain in the Suppressions (deprecated) view until removed manually (see Removing Suppressions).
Suppressions stored on Team Server that point to remote URLs (such as http://mycompany.com/dir/file.html) will not be migrated. Suppressions containing URLs will only be created for static analysis results obtained by running a Scanning Tool or a browser test scenario (see Web Tools). You will need to migrate the suppressions manually by adding them to the parasoft.suppress file.
Local Workspace
If not connected to Team Server, SOAtest checks for suppressions stored in the local workspace and not Team Server.
- Deprecated local suppressions detected by SOAtest will be converted to plain text and saved in the parasoft.suppress file(s) located in the same location as the corresponding source file(s).
- A backup file that contains local suppressions in the deprecated format is created. The location of the file is printed to the console.
- Deprecated local suppressions are removed from the workspace and from the deprecated Suppressions view.
Restoring Deprecated Local Suppressions from Backup File
- Close your IDE.
Go to the location where the backup file is stored (the location is printed to the console). It contains a local_suppressions_backup.zip file.
Extract the contents of local_suppressions_backup.zip to the same location.
You can re-migrate restored local suppressions on next IDE startup.
Enabling Team Server Suppressions (Deprecated)
The Suppressions view associated with viewing XML-style suppressions is deprecated, but you can enable Team Server suppressions and view suppressions that were created with an older version of SOAtest from the Suppressions (deprecated) view:
- Choose Parasoft > Show View > Suppressions (deprecated) from the main menu.
- Choose Enable deprecated suppressions from the ellipses menu.
If there are suppressions in the deprecated format available for your project that you want to migrate to the new format, please contact Parasoft Support.
Anchor | ||||
---|---|---|---|---|
|
You can delete suppressions from the parasoft.suppress file to un-suppress a task. Re-run the test or analysis and the task will reappear in the Quality Tasks view.If suppressions are stored on Team Server, choose a suppression and click the delete (X) button in the Suppressions (Deprecated) view.