Adding New Test Suites

To add user-defined test cases:

  1. If you have not already done so, create a new directory for your tests.

       2. Open the Test Suite Wizard as follows:

    1. Select your tests directory in the project tree.
    2. Choose Parasoft> Wizards> Create New Test Suite.A wizard will open.

     3. Enter the test suite parameters in the Test Suite Wizard dialog. Available parameters are:

     4. (Optional) If you want to specify test cases at this point (i.e., so C++test registers them in the test suite and adds a skeletal framework for the tests), click Next, then use the controls to add test case names and specify the order in which you want them added.
     5. Click Finish.

Adding Test Cases to an Existing Test Suite

To add a new test case to an existing test suite:

  1. Select the test suite file in the project tree, or open it in the editor, thenchoose Parasoft> C++test> Test Suite> Add Test Case Template. Or, right-click a the test suite in the Test Case Explorer and choose Add New> Test Case Template.

  2. Enter a name for the test case.  The new test case will be added, and the test suite will be modified accordingly.
  3. Open the test suite source file in the editor, enter test case definitions, and make additional modifications as needed. You can...

     4. Save the modified file.

Test Driven Development (TDD) Tip

The test cases in the generated template are set to fail. For TDD, you can write the source for the implementation, then remove the failure macros when you are satisfied with the test.

cout Statements that Spawn New Processes

If you have unit tests with cout statements that spawn other processes, use endl instead of the newline character to end the cout statements. This way, the output gets flushed immediately to the console.

For example, use this:

  • cout << "xyz" << endl;

not this:

  • cout << "xyz\n";