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
- 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.
- In the call graph toolbar, click Create Test
Harness .
This opens the Test Creation Activity view, which details the steps to create the test harness.
- 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.
- 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.
- Under Test Case Creation, select a folder or create a new one, type a file name for the test case, and click Next.
- 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.