Creating test harnesses from the call graph

The call graph provides a visual diagram that helps you select the functions that require testing in your project. You can use this diagram to create a test harness that contains a test case, stubs, and other test assets required to run the test.

Procedure

  1. In the project explorer, right-click the project, source file, or a function, and click Open Call Graph. The call graph displays a diagram representing the function calls in the selected component.
  2. In the call graph toolbar, click Create Test Harness Create Test Harness button. This opens the Test Creation Activity view, which details the steps to create the test harness.
  3. Under Test Asset Selection, select a function to test and click Next. You can take advantage of the call graph display to locate the functions that are critical to your application.
  4. If some functions require stubbing, under Stub Selection, select a function to simulate, and click Next. If the test does not require stubs, click Next. See Stubbing overview for more information about stubs.
  5. Under Test Case Creation, select a folder or create a new one, type a file name for the test case, and click Next.
  6. Under Test Harness Creation, select a folder or create a new one, type a file name for the test harness, and click Finish. The test harness contains one or several test cases and is necessary to run the test.

Results

The test cases, stubs, and test harness are generated in the project explorer and the test harness editor opens. Editing test harnesses for information about the test harness editor.
Feedback