The following table describes common unit testing tasks for C/C++ projects.
To perform this task
|
Follow these steps
|
Create tests for individual C/C++ functions.
|
-
Right-click a source file in the Projects window or in the editor window and choose
Create Test > New test type
-
Select the functions you want to test in the Select Elements dialog box and click
Next.
-
Specify the test name and the filename for the test and click Finish.
-
Edit the generated test files to test the project's functions.
|
Create an empty test.
|
-
Right-click the project's Test Files folder and select New test type.
-
Specify the test name and the filename for the test and click Finish.
|
Run a single test suite.
|
-
Right-click the Test Files subfolder of the test suite you want to run.
-
Choose Test.
|
Run all tests for a project.
|
-
Select any node in the project for which you wish to run tests.
-
Choose Run > Test Project project
name (Alt-F6) from the main menu.
|
Debug a test suite.
|
-
Right-click the folder of a test suite you want to debug.
-
Choose Debug Test.
|
Debug a single test.
|
-
Run tests and view the results in the Test Results window.
-
Right-click an individual test in the Test Results window and choose Debug.
|