Creating stubs from the project explorer

You can create a stub from the project by simply selecting a source file or a function. Each stub simulates and replaces a particular function.


To create a stub from the project explorer:

  1. In the project explorer, right-click the project, source file, or a function, and click New > Stub Behavior. If you select a function, skip to step 3. The Create Test Case wizard opens.
  2. On the Stubbed function page, enter the function name that you want to test in the Filter field. You can choose the functions displayed into the list.
  3. On the Stub Behavior page, type a name for the stub behavior, an optional Description, and click Next. The description contains information that can be viewed and edited in the test editor.
  4. On the Stub Location page, select a folder and a type a file name for the stub and click Finish.


The stub is generated in the project explorer and the stub editor opens. See Editing stubs for information about the stub editor. To use the stub in a test, you must add it to a test case, and add the function in the stubbed function list of the test harness.