...
cpptestcli -solution "c:\MySolution" -resource "ProjectToTest" -config builtin://ShouldHaveRules -publishteamserver -localsettings acme_policy.settings
The reports will be sent after each batch run, and trend reports will be populated with data. The reports will also be available for viewing via Parasoft> Explore> Team Server Reports.
cli Usage
The general procedure for testing from the command line is as follows:
...
Info | ||
---|---|---|
| ||
If you want to exclude some files from analysis/testing (for instance, to prevent static analysis of automatically-generated files), you can indicate which project resources should not be tested as described in Excluding Project Resources from Testing. Perform this configuration in the GUI, then the settings will be applied for all tests on this project—from the GUI or from the command line. |
cli Options
Anchor | ||||
---|---|---|---|---|
|
...
-config
Specifies that you want to run the Test Configuration available at%CONFIG_URL% -
This parameter is required except when importing projects.%CONFIG_URL%
.
%CONFIG_URL%
is interpreted as a URL, the name of a Test Configuration, or the path to a local file. Examples:- By filename:
-config "mylocalconfig.properties"
- By URL:
-config "http://intranet.acme.com/cpptest/team_config.properties"
- Built-in configurations:
-config "builtin://Demo Configuration"
-config "Demo Configuration"
- User-defined configurations:
-config "user://My First Configuration"
- Team configurations:
-config "team://Team Configuration"
-config "team://teamconfig.properties"
- By filename:
-help
- Displays help information. Does not run testing.Anchor localsettings %LOCALSETTINGS_FILE% localsettings %LOCALSETTINGS_FILE% -localsettings
%LOCALSETTINGS_FILE% -
Reads the options file%LOCALSETTINGS_FILE%
for global preferences. These settings specify details such as Parasoft DTP settings, email settings, and Team Server settings.
The options file is a properties file. These files can control reporting preferences (who should reports be sent to, how should those reports be labelled, what mail server and domain should be used, etc.) Team Server settings, Parasoft DTP settings, email settings, and more. For details on creating options files; see Local Settings (Options) Files.-nobuild
- Prevents 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 any violations are reported.-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 Development Testing Platform.-publishteamserver
- Publishes the report to the Team Server. The Team Server location can be specified in the GUI or in the options file (described in the-localsettings %LOCALSETTINGS_FILE%
entry).-report
%REPORT_FILE% -
Generates an XML report to the given file%REPORT_FILE%
and adds an HTML (or PDF or custom format—if specified using the report.format option) report with the same name (and a different extension) in the same directory.
All of the following commands will produce an HTML reportfilename.html
and 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-report
option is not specified, reports will be generated with the default names "report.xml/html" in the current directory.-dtp.autoconfig
%PROJECT_NAME@SERVER
_NAME:port% -
Pulls settings stored on the DTP server (recommended for ease of maintenance — especially if you do not already have a locallocally stored settings file).
For example:-dtp.autoconfig
[email protected]:8080
-encodepass <plainpassword> -
Generates an encoded version of a given password. Prints the message 'Encrypted password: <encpass>' and terminates the cli application.
If your nightly process will 1) login to Team Server and b) send emails, you can use this option to encrypt the required passwords.-showdetails
- Prints detailed test progress information.
-solutionConfig
%SOLUTION_CONFIG_N
AME% -
Specifies the solution configuration to use for building the solution and for analysis.Debug
andRelease
are common names. If the switch is omitted, then the active configuration is used. Specifying the solution configuration is strongly recommended because the active configuration may change unexpectedly.-targetPlatform %TARGET_PLATFORM_N
AME% -
Specifies the solution target platform to use for building the solution and for analysis. Any CPU and x86 are common names. If omitted, the active configuration is used. Specifying the target platform is strongly recommended because the active configuration may change unexpectedly.
-appconsole stdout|% OUTPUT_FILE%
- Redirects 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. Must be used along with-solution
.-list-configs - Prints a list of valid Test Configuration values. Must be used along with
-solution
.-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/*.cpp
c:/ATM/Bank/Bank.cpp
then it has same effect as specifying:
-include **/Bank.cpp -include **/ATM/Bank/*.cpp
-include c:/ATM/Bank/Bank.cpp"
-useenv
- Causes the IDE to use PATH, INCLUDE, and LIB environment variables for Visual C++ compilation rather than the settings specified in the VC++ Directories section of the Projects options (in the Options dialog box).
Options for Testing Projects Available in the Visual Studio IDE
Option | Purpose | Notes |
---|---|---|
| Specifies the location of the solution file to use.Specifies the location of the solution file to use. | N/AN/ASpecifies the location of the solution file to use. |
| 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 For example, to test the or - Other Examples:
|
Note | ||
---|---|---|
| ||
|
...
- Reporting Settings
- Parasoft DTP Settings
- Project Center Settings
- Team Server Settings
- Licensing Settings
- Technical Support Settings
- Authorship/Scope Settings
- Source Control Settings
- File Encoding Settings
- Miscellaneous Settings
Note | ||
---|---|---|
| ||
|
...
Setting | Purpose |
---|---|
techsupport.auto_creation=true|false | Determines whether archives are automatically prepared when testing problems occur. |
techsupport.send_email=true|false | Determines whether prepared archives are emailed to Parasoft support. If you enable this, be sure to specify email settings from the GUI or with the options in Reporting Settings. |
techsupport.archive_location=[directory] | Specifies where archives are stored. |
techsupport.verbose=true|false | Determines whether verbose logs are included in the archive. Note that this option cannot be enabled if the logging system has custom configurations.
|
techsupport.verbose.scontrol=true|false | Determines whether verbose logs include output from source control commands. Note that the output could include fragments of your source code. |
techsupport.item.general=true|false | Determines whether general application logs are included. |
techsupport.item.environment=true|false | Determines whether environment variables, JVM system properties, platform details, additional properties (memory, other) are included in the archive. |
techsupport.advanced=true|false | Specifies if advanced options will be sent. |
techsupport.advanced.options=[option] | Specifies any advanced options that the support team asked you to enter. |
techsupport.dtp.engine=true|false | Specifies if additional data generated during analysis will be sent. |
Authorship/Scope Settings
...
Property | Description |
---|---|
scontrol.rep.type=serena | Serena Dimensions repository type identifier. |
scontrol.rep.serena.host= | Serena Dimensions server host name. |
scontrol.rep.serena.dbname= | Name of the database for the product you are working with. |
scontrol.rep.serena.dbconn= | Connection string for that database. |
scontrol.rep.serena.login = | Login name. |
scontrol.rep.serena.password | Password. |
scontrol.rep.serena.mapping | Maps workspace resources to Serena Dimension repository paths.
|
Subversion Repository Definition Properties
...
Property | Description |
---|---|
scontrol.rep.type=synergy | Synergy/CM repository type identifier |
scontrol.rep.synergy.host= | Computer on which synergy/cm engine runs. Local host is used when missing. For Web mode, the host must be a valid Synergy Web URL with protocol and port (e.g., |
scontrol.rep.synergy.dbpath= | Absolute synergy database path e.g |
scontrol.rep.synergy.projspec= | Synergy project spec which contains project name and its version e.g name-version. |
scontrol.rep.synergy.login= | Synergy user name. |
scontrol.rep.synergy.password= | Synergy password (not encoded). |
scontrol.rep.synergy.port= | Synergy port. |
scontrol.rep.synergy.remote_client= | (UNIX only) Specifies that you want to start ccm as a remote client. Default value is false. Optional. This is not used for Web mode. |
scontrol.rep.synergy.local_dbpath= | Specifies the path name to which your database information is copied when you are running a remote client session. If null, then the default location will be used. This is not used for Web mode. |
scontrol.synergy.exec= | Path to external client executable (ccm ) |
Microsoft Team Foundation Server Repository Definition Properties
Property | Description |
---|---|
scontrol.rep.type=tfs | TFS repository type identifier. |
scontrol.rep.tfs.host= | Name of the machine running TFS. |
scontrol.rep.tfs.port= | TFS server’s port number (optional; when not specified, 8080 is used). |
scontrol.rep.tfs.protocol= | The protocol used to connect to TFS server. Available values are HTTP and HTTPS. |
scontrol.rep.tfs.login = | TFS user name. |
scontrol.rep.tfs.password= | TFS password. |
Microsoft Visual Source Safe Repository Definition Properties
...
- The repository(n).vss.ssdir property should contain a UNC value even if the repository database resides locally.
- Be aware of VSS Naming Syntax, Conventions and Limitations. Any character can be used for names or labels, except the following:
- Dollar sign ($)
- At sign (@)
- Angle brackets (< >), brackets ([ ]), braces ({ }), and parentheses (( ))
- Colon (:) and semicolon (;)
- Equal sign (=)
- Caret sign (^)
- Exclamation point (!)
- Percent sign (%)
- Question mark (?)
- Comma (,)
- Quotation mark (single or double) (' ")
- VSS 6.0 (build 8163), which is deployed with Visual Studio 6, does not work properly with projects whose names start with a dot (.) symbol. If such a project name is used, subprojects cannot be added.
- Do not use custom working directories for sub-projects (example:
Project $/SomeProject
has the working directoryC:\TEMP\VSS\SomeProject
and its subproject$/SomeProject/SomeSubProject
has the working directoryD:\SomeSubProject
).
File Encoding Settings
Setting | Purpose |
---|---|
fileencoding.mode=default|user|auto | Defines how file encoding is calculated.
|
fileencoding.user-encoding=<name_of_encoding> | If It should be specified in form |
fileencoding.auto-language=<language’s numeric_code> | If
|
Miscellaneous Settings
Setting | Purpose |
---|---|
report.rules=[url_path_to_rules_directory] | Specifies the directory for rules html files (generated by clicking the For example:
The default setting is none. |
tasks.clear=true|false | Clears existing tasks upon startup in cli mode. This prevents excessive time being spent "loading existing results." The default is |
console.verbosity.level=low|normal|high | Specifies the verbosity level for the Console view. Available settings are:
|
cpptest.custom.rules.dir=[directory] | Indicates where user-defined rules are saved. |
cpptest.custom.configs.dir=[directory] | Indicates where user-defined Test Configurations are saved. |
custom.compilers.dir=[directory] | Overrides the custom compiler directory settings (found in Parasoft> Configurations> Custom compilers) and uses the defined directory to search for custom compilers |
parallel.mode=Manual|Auto|Disabled | Determines which of the following modes is active:
For more details on this and other parallel processing options, see Configuring Parallel Processing. |
parallel.max_threads=<number> | Specifies the maximum number of parallel threads that can be executed simultaneously. The actual number of parallel threads is determined by the number of CPUs, available memory, and license settings. |
parallel.free_memory_limit=<percentage> | Specifies the amount of memory that should be kept free in low memory conditions (expressed as a percentage of the total memory available for the application). This is used to ensure that free memory is available for other processes. |
parallel.no_memory_limit=true|false | Indicates that you do not want to place any restrictions (beyond existing system limitations) on the memory available to C++test |
...