This topic defines the variables that can be used in C/C++test.

General Variables

The following variables can be used for general purposes, for example,  to configure report, e-mail, Parasoft DTP, or license settings.(warning) The session tag value must not  contain any ':' characters.

analysis_type

$ example: ${analysis_type}

Outputs a comma separated list of enabled analysis types (for example: Static, Generation, Execution). This variable can only be used in report and email settings.

config_name

$ example: ${config_name}

Outputs the name of executed test configuration. This variable can only be used in report and email settings. For example:

dtp_project

example: $dtp_project}

Outputs the name of the project DTP that corresponds with the tested project.

env_var

example: ${env_var:HOME}

Outputs the value of the environmental variable specified after the colon.

general_project

example: ${general_project}

Outputs the name of the DTP general project that results are linked to.

project_name

example: ${project_name}

Outputs the name of the tested project. If more than one project is provided as an input, it first outputs the tested project name, then "...".

project_loc

example: ${project_loc}

Outputs the location of the tested project.

solution_name

example: ${solution_name}

Outputs the name of the tested Visual Studio solution. If more than one solution is provided as an input, it first outputs the tested solution name, then "...".

solution_loc

example: ${solution_loc}

Outputs the location of the tested Visual Studio solution.

time

example: ${time:yyyy-MM-dd-HH.mm}

Outputs the current time. The default is yyyy-MM-dd. You can customize the format (as in the example above).

tool_name

$ example: ${tool_name}

Outputs the name of the Parasoft product (for example: C/C++test).

workspace_name

example: ${workspace_name}Outputs the Visual Studio solution name. For example, report.mail.subject=Scanner Results for ${workspace_name}may evaluate to "Scanner Results for solutionAccoun1.sln".

resource_loc

example: ${resource_loc:<RESOURCE_PATH>} 

Outputs the location of the specified project resource. This variable can be used to reference a project resource in any applicable settings, such as the make run directory for projects with linked directories, or the path to a .dsp file for VC6 projects, or similar. Specify logical paths relative the project as it is registered in the workspace.

Build-related Variables

${CPPTEST_SCAN}

This variable is automatically initialized to the C/C++test options extractor utility with options; set in the environment when C/C++test runs the Build command. Used in the Build command line when configuring a Makefile-based project (Project> Properties> Parasoft>C++test> Build options). The variable can be used directly in Makefiles and build scripts to replace the compiler/linker (when make or build scripts are run by C/C++test).

${cpptest:original_options}

Options from original (tested) project collected from monitoring the build or reading project files (Visual Studio or MULTI). Used in compiler / linker options in project / file properties.

${cpptest:project_lib_files}

Dependent libraries collected from the Visual Studio project/solution definition. Used in compiler / linker options in project / file properties.

Variables for Test Suite Files

  • file = The source/header file where the tested function is defined.
  • source file = The source file that defines a compilation unit where the tested function is defined.

You can use the following variables to configure the Test suite output file and layout option in the Test Configuration’s Generation> Test suite tab:

Other Variables

For Temporary Files

${cpptest:testware_loc} - C/C++test temporary files location. Used in:

For Configuration Files

${cpptest:cfg_dir} - C/C++test configuration files location. Used in:

For Automatically-Generated Stubs

${cpptest:auto-stubs} - Auto-generated stub files location. This variable points to the value set in the Test Configuration’s  Auto-generated stubs> Output location, as shown in the screen shot below. This is basically a shortcut that synchronizes the directory where the stubs are generated and where they are picked up from.

Used in:

For Context-Specific Stubs

Used in: