Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
maxLevel1

Text ConfigurationsText Configurations

To import Test Configuration from C++test 6.x:

  1. (Recommended) Ensure that any user-defined/custom rules from the C++test 6.x Test Configuration are accessible in C++test 10.x (i.e., by sharing them via Team Server).
  2. Open the Test Configurations dialog by choosing choosing Parasoft> Test Configurations.
  3. Right-click the the User-defined category category, choose Import  Import C++test 6.x Test Configuration from  from the shortcut menu, then use the file chooser to select the appropriate C++test 6.x Test Configuration (.tcfg) file.

...

  • Coding standards state (enabled or disabled)
  • Enabled coding standard rules. C++test 6.x built-in rules will be mapped to the current version’s set of built-in rules, which use different identifiers, messages, and severity levels. We recommend that any custom rules use "-" as a separator; for example: <rule_category>-<rule_unique_id> (myrule-123, user-456, etc etc.) This way, C++test 10.x will be able to automatically create a rule tree structure based on the rule categories.
  • Unit testing generation state (enabled or disabled)
  • Max. count of generated test cases
  • Display test case results as post as post conditions
  • Automatically insert assertion templates
  • Memory allocation for test object (stack or heap)
  • Use heuristics for input values
  • Use objects of derived classes
  • Initialize global variables
  • Unit testing execution state (enabled or disabled)
  • Timeout for a single test case
  • Test only files created or modified since the cut-off date

...

If any rules are added to the UNKNOWN category, you can use rule mapping to change the category. See Modifying Rule Categories, IDs, Names, and Severity Levels for details.

Test Configurations stored on Team Server need to be imported into the User folder and then reuploaded to Team Server in C++test 10.x format.

...

There are two ways to import "source test" test suites from C++test 6.x: import all test suites into a single directory, or import the test suites for each C++test 6.x Test Unit into a separate subdirectory.

Before you import Before you import test suites, note that:

  • Symbols data must be available for the "source" 6.x project ("Read symbols" action).
  • The C++test 10.x project must contain the same (physical) source files as the 6.x project. The "logical" project layout can be different (i.e. you can use linked directories, etc.).
  • "Included" type test suites created for multi-file units at the test unit or global symbols level will not be imported

To import test suites from a C++test 6.x project:

       1.

...

  1. Choose Parasoft> Wizards> Import C++test 6.x test suites.

...

  1.  A wizard will open

...

  1. .

...

  1. In

...

  1. the C++test 6.x project file

...

  1.  field, enter the location of the C++test 6.x project file. This file should have a .cpf extension

...

  1. .
  2.  In

...

  1. the Imported test suites location

...

  1.  field, choose the drop-down menu item for the import strategy you want to use (import all test suites into a single directory, or import the test suites for each C++test 6.x Test Unit into a separate subdirectory), then customize the entered text to specify the location where you want the test suites stored. When specifying the location, you can use the following variables:

      • ${src_file_name} - Name of the context file (a "context file" is a source file that describes the compilation unit in which the given tested function is defined).
      • ${src_file_base_name} - Name of context file without extension.
      • ${src_file_ext} - Extension of context file.
      • ${src_file_loc_rel} - Context file project relative location.
      • ${src_file_uid} - Context file unique identifier.
      • ${unit_name} - Imported test suite C++test 6.x test unit name.

...

  1. Modify the following options if desired:

      • Automatically rename duplicated test suite names:

...

      •  When enabled, C++test will automatically rename an imported test suite if its name conflicts with the name of another test suite in the target project.
      • Automatically rename duplicated test suite files:

...

      •  When enabled, C++test will automatically rename an imported test suite file if it conflicts with another test suite file in the target project.
    Note
    titleNote - Automated Renaming

    If C++test renames a test suite or a test suite file, the appropriate information is added to the imported test suite file; for example:  

    // Test suite was renamed by C++test - original name: TestSuite_XX
    // File was renamed by C++test - original file: TestSuite_XX.cpp

    Information about renaming is also available in the C++test console; for example:

    Importing test suite "TestSuite_XX" ...
    ...warning, test suite "TestSuite_XX" already exists in the project. Test suite renamed to "TestSuite_XX_1".

...

  1. Click Finish.

As test cases are imported, progress information will be displayed in the Console view. Progress information includes information about the imported test suites and problems encountered during the import, as well as an import summary.

...

  1. Create a new project that contains all of the source files that were originally tested by C++test 6.x. See See Creating a Project for details.
  2. Configure the project appropriately. See See Setting Project and File Options for details.
  3. Import native test cases as follows:
    1. Open the Test Case Explorer (Choose Parasoft>  Parasoft> Show View> Test Case Explorer).
    2. Right-click the node for the project to which you want to add the tests, then choose Add  Add New> Native Tests from  from the shortcut menu.
    3. In the file chooser that opens, specify the location of the C++test 6.x project file (.cpf file) that contains your native tests, then click click Open.

C++test will automatically add the existing Native Tests to the Test Case Explorer view. They will be displayed according to the following hierarchy:

...

  1. If you have not already done so, create the appropriate Test Configuration as follows:
    1. Open the Test Configurations panel by choosing choosing Parasoft> Test Configurations.
    2. Right-click the User-defined node and choose choose Import.
    3. Specify that you want to import the Test Configuration in Configuration in <INSTALL_DIR>/configs/NativeTests.
    4. Set the Set the 'CPPTEST_INSTALL_DIR' environment variable  environment variable to the C++test  2.3/6.x installation directory.
      • For example, use the export the export CPPTEST_INSTALL_DIR=.... command in  command in the bash shell or (on Windows) set up the system environment variable in in Control Panel> System> Advanced> Environment Variables.
    5. In the Test Configuration’s Configuration’s Execution> General tab tab, verify the command line parameters in in Command to run and  and modify them if needed.
Info
titleModifying New or Existing Test Configurations to Run Native Tests

To configure a Test Configuration to run Native testrunNativetest:

  • Check Enable test execution in the Execution tab.
  • Check Execute legacy native test cases in the Execution> General tab.
  • In the command to run field (immediately below Execute legacy native test cases), provide proper path to  provideproper pathto  the C++test 2.3/6.x executable.

...

  • Native tests will be executed in their original environment (with stubs, data sources, testobjects etc testobjects etc.)
  • C++test 10.x will automatically launch C++test 6.x in the command line mode.
  • C++test 10.x will automatically load test and line coverage results.
  • The original C++test 6.x project, as well as the C++test 6.x installation, are required in order to execute native tests in their original environment.
  • Command line execution is also supported (all native tests connected to a given C++test 10.x project will be executed).

...

  • Open the code editor to analyze covered/not covered lines
  • Create reports
  • Publish results to Team Server for team sharing
  • Publish results to Development Testing Platform (see Connecting to Development Testing Platform)

Limitations

  • Native tests can be executed based on a file, test suite, or project selection. Individual selection of native test for execution is not available.
  • C++test provides line coverage data for test execution. Other coverage metrics are not available.

...

There are two ways to import "user" stubs from C++test 6.x: import all user stubs into a single file, or import the user stubs for each C++test 6.x Test Unit into a separate file. If  you import  If  you import into a single file, the stub methods are sorted so that duplicated stubs can be easily found. If you import into separate files, the file names correspond to the C++test 6.x Test Unit names.

To import user stubs from a C++test 6.x project:

       1. 

...

  1. Choose Parasoft> Wizards> Import C++test 6.x user stubs.

...

  1.  A wizard will open.

...

  1.  A wizard will open.

...

  1. In the C++test 6.x project file

...

  1.  field, enter the location of the C++test 6.x project file. This file should have a .cpf extension.

...

  1.  In the

...

  1.  Imported stubs location

...

  1.  field, enter the location where you want the stubs stored. You can use the drop-down menu to configure this value to import all stubs into a single directory, import all stubs for the given C++test 10.x Text Context into separate subdirectories, or import all stubs for the given C++test 6.x Text Unit into separate subdirectories.

    Note
    titleNote - Reproducing C++test 6.x behavior in C++test 10.3 using File Scope testing mode

    The Import all stubs for the given C++test 10.x Text Context into separate subdirectories option might be especially useful when trying to reproduce C++test 6.x behavior in C++test 10.x using File Scope testing mode. When importing stubs using the predefined layout, all stubs for a particular C++test 10.x Test Context will be placed in a single directory.

    To ensure that the executed tests use the appropriate set of stubs in the File Scope testing mode:

    1. Create a custom Test Configuration based on Run Unit Tests (File Scope).
    2. Modify the Execution> Symbols> Use extra symbols from files found in setting to use only context-specific stubs, e.g.: ${project_loc}/stubs/imported/${ctx_name}

...

  1. Thisway,onlystubsimported into the 'foo.cpp'

...

  1. subdirectorywillbeused  whenC++test is testing foo.cpp file in a File Scope mode.

...

  1.  In

...

  1. the Duplicated Stubs Import

...

  1. strategy area, use the available controls to define a strategy for importing several stubs for a single function (for example, if a stub for a given function is defined in the context of several C++test 6.x Test Units). Available options are:

      • Import all duplicated stubs:

...

      •  Tells C++test to import each stub for a given function without performing any special actions.
      • Comment out duplicated stubs:

...

      •  Tells C++test to import only one of the stubs for a given function. All other stubs for this function will be commented out during the import process.
      • Merge duplicated stubs (when importing to the same location):

...

      •  If this is enabled and C++test (

...

      • using Imported stubs location) determines that several stubs for the same function are to be added to a single file, C++test will try to merge all stubs into a single stub definition.

...

  1.  If you want C++test to modify the imported stub definition to ensure that the given stub will be used in the appropriate Test Context,

...

  1. enable Insert code to connect stub definition with C++test 10.x Test Context. For instance:

...

  1.            // [...]

...

  1.   
         if (CppTest_IsCurrentContext("Examples/ATM/Source Files/Account.cxx")) {
         // [...]

    This option is especially useful with the

...

  1.  Merge duplicated stubs

...

  1.  setting. Here, C++test will create a single stub definition that will behave differently for each

...

  1. Test Context  corresponding to the behavior of the C++test 6.x stubs. The default path of a stub will call the original definition of the stubbed function. For example:

    Code Block
    double (::Account::CppTest_Stub_getBalance) ()
    {
    	if (CppTest_IsCurrentContext("/ATM/ATM/Account.cxx"))
    	{
    	//account
    	}
    	else if (CppTest_IsCurrentContext("/ATM/ATM/ATM.cxx"))
    	{
    	//atm
    	}
    	else
    	{
    		return getBalance();
    	}
    }

...

  1.  If you want C++

...

  1. test to add the specified text at the beginning of each imported stub file, enable

...

  1.  Insert custom code at beginning of each stub file. For example, this can be used to add a common set of #include directives for required header files to all imported stub files.

...

  1. If you want C++test to comment out duplicated stubs,

...

  1. enable Comment out duplicated stubs.

...

  1. Click Finish.

As stubs are being imported, progress information will be displayed in the Console view. Progress information includes details about the stub files created, duplicate stubs identified, and conversion problems encountered, as well as an import summary.

...

The following table shows the differences in command line usage between C++test 6.x and C++test 10.x. An x is used to indicate that no equivalent command is available.


C++test 6.xC++test 10.x
-Zicpf (file), --Zinput_cpf_project (file)-data (WORKSPACE_DIR)
-Zocpf (file), --Zoutput_cpf_project (file)x
-Zdsp (file), --Zdsp_project (file) x
-Zvcproj (file), --Zvcproj_project (file) x
-Zdc (name), --Zdsp_config (name)x
-Zdc (name), --Zdsp_config (name)x
-Zmcl (param), --Zmake_command_line (param)x
-Ztf (name), --Ztest_file (name)-resource (RESOURCE)
-Zeh (name), --Zexport_harness (name)x
-Zrl (name), --Zread_logs (name)x
-Ztc (name), --Ztest_config (name)-config (CONFIG_URL)
-Zpc (name), --Zproject_config (name) x
-Zso (file), --Zsave_options (file)x
-Zitc (file), --Zimport_test_cases (file)x
-Zito (file), --Zimport_test_objects (file)x
-Zis (file), --Zimport_suppressions (file)x
-Zrf (file), --Zreport_file (file)-report (REPORT_FILE)
-Zgh (name), --Zgenerate_html (name)-report (REPORT_FILE)
-Zhrd (dir), --Zhtml_report_directory (dir)-report (REPORT_FILE)
-Zgx, --Zgenerate_xml-report (REPORT_FILE)
-Zxrd (dir), --Zxml_report_directory (dir)-report (REPORT_FILE)
-Zpr, --Zpublish_results-publish, -publishteamserver
-Zf, --Zforcex
-Zow {on\off}, --Zoverwrite {on\off}x
-Zoe [quiet], --Zonly_errors [quiet]x
-Zq, --Zquietx
-Zvm(level), --Zverbosity_mode(level)x
-Zgrs {on\off}, --Zgrs {on\off}-localsettings (LOCALSETTINGS_FILE)
-Zga (name), --Zgrs_attribute (name)-localsettings  (LOCALSETTINGS_FILE)
-Zcs, --Zcompile_sourcex
-Zrs, --Zreread_symbolsx
-Zlc (param), --Zlist_config (param)x
-Zecf, --Zexpand_command_filesx
-Znt --Zno_testsx
-h, --help-help
-V, --version-version
x-nobuild
x-showdetails
x-appconsole stdout