Creating a C/C++ Unit Test

See Also

The C/C++ Unit test feature enables you to create test programs for use as templates for your unit tests. You can create unit tests for single functions and entire source files, as well as empty test files to be used with sources you create later.

The IDE creates a Test Files logical folder when you create a project. For managed projects that were created with a previous version of the IDE, a Test Files folder is created when you add tests through the IDE. In both cases, the test files are physically stored in a tests directory, separate from the project's source files.

For projects from existing sources:

To create a test for a single source file:

To create an empty test:

  1. Choose File > New File from the main menu.
  2. In the New File wizard, select C/C++ Tests in the Categories pane and the type of unit test you want in the File Types pane. Click Next.
  3. Specify the test name, folder, and test source filename and extension.
  4. Click Finish.
See also
  Running a C/C++ Unit Test
About C/C++ Unit Tests

Copyright © 2014, Oracle and/or its affiliates. All rights reserved.