The Test Case Wizard allows you to select a function to test, then graphically specify test case preconditions and postconditions. These test cases can be parameterized with data source values (or automatically-generated values) to rapidly create test case scenarios that ensure broad, thorough test coverage, and that test the code’s response to a wide range of inputs.

Test cases created in the  Test Case Wizard are saved in source code, using the standard C++test test format (similar to CppUnit).

Adding Test Suites

All test cases must exist within a test suite. Before you can add test cases with the graphical Test Case Wizard, you must first have a test suite that can contain them.

Generating a Test Suite

To prompt C++test to generate a set of empty test suites for each testable context (file or function):

  1. Select the resource(s) for which want to generate a test suite.
  2. Run the "Unit Testing> Generate Test Suites" Test Configuration or a custom team Test Configuration that is based on it.

Specifying a New Test Suite

If you want more control over the nature of the test suite than the automated generation (described above) allows, add a new test suite as follows:

  1. In the Test Case Explorer, right-click the node for the project that the test suite will test, then choose Add New> Test Suite from the shortcut menu
  2. Enter the test suite parameters in the Test Suite Wizard dialog. Available parameters are:

Adding Test Cases Using the Graphical Wizard

You can use the Test Case Wizard to specify new test cases graphically, using GUI controls. C++test generates test case code representing the specified tests, and adds this code to the corresponding test suite. These test cases can be executed along with the other test cases, and they can be modified/extended as needed.

  1. To add a new test case using the Test Case Wizard:
  2. Right-click the selection, then choose Add New> Test Case using Wizard from the shortcut menu.

  3. On the first page, specify the source file (compilation unit) and the function for which you want to add a test case, then enter a name for the test case.
  4. Click Next to open the next wizard page.
  5. Configure the test case by specifying its input and expected output values using GUI controls.
  6. Click Finish to generate the test case. The new test case will be added to the test suite and the generated source code will be opened in the editor.

Test Case Configuration Tips