...
cpptestcli -data "c:\MyWorkspace" -resource "ProjectToTest" -config builtin://ShouldHaveRules -publish -settings acme_policy.settings
The reports will be sent to Parasoft DTP after each batch run.
cli Usage
The general procedure for testing from the command line is as follows:
...
-nobuild- Prevents C/C++test from rebuilding the project before testing it. Use this option if the project is already built before the test run.-fail- Fails the build by returning a non-zero exit code if violations or setup problems are reported (see Command Line Exit Codes for details about exit codes returned if the process fails).-publish- Publishes the report to DTP. You can enable sending reports to DTP in the GUI or in the command line mode; see Connecting to DTP.-report%REPORT_FILE% -Generates an XML report to the given file%REPORT_FILE%and adds an HTML report (or one or more reports in other formats, if specified using the report.format option) with the same name (and a different extension) in the same directory.
All of the following commands will produce an HTML reportfilename.htmland an XML reportfilename.xml.-report filename.xml-report filename.htm-report filename.html
If the specified path ends with an ".html"/".htm"/".xml" extension, it will be treated as a path to the report file to generate. Otherwise, it will be treated as a path to a directory where reports should be generated.
If the file name is explicitly specified in the command and a file with this name already exists in the specified location, the previous report will be overwritten. If your command doesn’t explicitly specify a file name, the existing report file will not be overwritten—the new file will be named repXXXX.html, where XXXX is a random number.
If the-reportoption is not specified, reports will be generated with the default names "report.xml/html" in the current directory.-dtp.autoconfig%PROJECT_NAME@BASE_URL% -Pulls settings stored on the DTP server (recommended for ease of maintenance — especially if you do not already have a locally stored settings file).
For example:-dtp.autoconfigProject1@https://dtp.company.com:8443-encodepass <plainpassword> -Generates an encrypted version of a given password using AES 256-bit encryption. Prints the message 'Encrypted password: <encpass>' and terminates the cli application.
If your nightly process will send emails, you can use this option to encrypt the required passwords.-showdetails- Prints detailed test progress information.-showsettings- Prints the current settings and customizations along with the information where each of them is configured (e.g. in the settings.properties file). See Configuring Localsettings for the list of settings you can configure.-appconsole stdout|% OUTPUT_FILE%- Redirects C/C++test's console output to standard output or an%OUTPUT_FILE%file.
Examples:-appconsole stdout(console redirected to the standard output)-appconsole console.out(console redirected to console.out file)-list-compilers- Prints a list of valid compiler family values. Should be used along with-datato specify a workspace.-list-configs- Prints a list of valid Test Configuration values. Should be used along with-datato specify a workspace.- Specifies the path to an existing build data file (.bdf) or another project definition file to collect the input scope. See Using cpptestscan or cpptesttrace to Create a Build Data File for information about creating build data files. The option also supports JSON formatted files generated by the CMake build system when running static analysis. Use of the-bdf-bdfoption to specify a JSON file for unit test execution is not currently supported.-include %PATTERN%,-exclude %PATTERN% - Specifies files to be included/excluded during testing.
You must specify a file name or path after this option.
Patterns specify file names, with the wildcards *and ? accepted, and the special wildcard ** used to specify one or more path name segments. Syntax for the patterns is similar to that of Ant filesets.
Examples:-include **/Bank.cpp(test Bank.cpp files)-include **/ATM/Bank/*.cpp(test all .cpp files in folder ATM/Bank)-include c:/ATM/Bank/Bank.cpp(test only the c:/ATM/Bank/Bank.cpp file)-exclude **/internal/**(test everything except classes that have path with folder "internal")-exclude **/*Test.cpp(test everything, but files that end with Test.cpp)Additionally if a pattern is a file with a .lst extension, it is treated as a file with a list of patterns.
For example, if you use -include c:/include.lst and include.lst contains the following (each line is treated as single pattern):
**/Bank.cpp**/ATM/Bank/*.cppc:/ATM/Bank/Bank.cppthen it has same effect as specifying:
-include **/Bank.cpp -include **/ATM/Bank/*.cpp-include c:/ATM/Bank/Bank.cpp"
...
Options for Importing and Creating Projects
| Option | Purpose | Notes |
|---|---|---|
| Imports the specified Eclipse project(s) into the Eclipse workspace. | If If it is a directory, all Eclipse projects found in the selected directory and subdirectories will be imported. Examples:
The |
| Creates C/C++test projects from build definition files (.bdf). To prepare a BDF, perform a build of the project with the This option also supports JSON formatted files generated by the CMake build system when running static analysis. Using this option to specify a JSON file for unit test execution is not currently supported. | Example: - See Creating a Project Using an Existing Build System for details. Options can be specified in the options file. See Settings (Options) Files for details. The |
| Creates C/C++test projects from Green Hills .gpj projects. | Green Hills .gpj project import options can be specified in the options file. See Settings (Options) Files for details. |
-hew %HEW_PROJECT% | Imports Highperformance Embedded Workshop projects. The following can be specified as | The Examples: -hew "MyProject.hwp" -hew "MyWorkspace.hws" -hew "c:\DevelRootDir" |
| Imports Keil uVision projects. If .uvproj project file - the selected project will be imported directory - all .uvproj projects found in selected directory and subdirectories | The Examples: -uv "MyProject.uvproj" -uv "c:\DevelRootDir" |
Options for Testing Projects Available in the C/C++test for Eclipse Workbench
| Option | Purpose | Notes |
|---|---|---|
| Specifies the location of the Eclipse workspace directory to use. | Defaults to the current user’s dependent directory. |
| Specifies the path to the workspace resource | Use multiple times to specify multiple resources. Use quotes when the resource path contains spaces or other non-alphanumeric characters. If Team Project Set File (PSF) files are supported for SVN and other source control systems (depending on the Eclipse plugin capabilities installed). Paths (even absolute ones) are relative to the workspace specified by the -data parameter. Examples:
|
| Note | ||
|---|---|---|
| ||
|
...