Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space CPPTDESKDEV and version 10.3.3

...

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

       1.

...

A wizard will open.

  

...




...

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


...

 In the Imported test suites location 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.

...


...

 Modify the following options if desired:

...

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".

...

 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 Creating a Project for details.
  2. Configure the project appropriately. See Setting Project and File Options for details.
  3. Import native test cases as follows:
    1. Open the Test Case Explorer (Choose 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 New> Native Tests 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 Open.

...

[NewProject]
[Native Tests (OldProject.cpf)]
  [File1.cpp]
    [Class1]
      [Function1]
        [TestCase1]
        [TestCase2] 


Updating Tests

New test cases should be added using C++test 10.x functionality. If you need to modify a native test case, you can do so in C++test 6.x, then refresh the Test Case Explorer to synchronize.

...

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

       1.  Choose  

...

 A wizard will open.

  

...




...

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


...

 In the Imported stubs location 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}

This way, only stubs imported into the 'foo.cpp' subdirectory will be used  when C++test is testing foo.cpp file in a File Scope mode.

...

 In the Duplicated Stubs Import 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.

...

 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, enable Insert code to connect stub definition with C++test 10.x Test Context. For instance:

...

This option is especially useful with the Merge duplicated stubs setting. Here, C++test will create a single stub definition that will behave differently for each 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();
	}
}

 

...



...

 If you want C++test to  add the specified text at the beginning of each imported stub file, enable 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.     


...

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


...

 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