Create CTest Based Tests | Qt Creator Documentation

- Qt Creator Documentation
- Create CTest Based Tests
- Qt Creator 17.0.1

How To

# Create CTest Based Tests

CTest can execute tests for CMake based projects regardless of the test framework. You configure tests in the project file, usually, CMakeLists.txt. Basically, you enable testing for the project and register the test applications or even special commands.

     enable_testing()
     add_test(NAME test_example COMMAND test_example)

Add `test_example` as an executable before trying to register it as test. It may be any executable command including arguments.

For more information about how to use CTest, see Testing with CTest.

See also How To: Test, Select the build system, Testing, and Test Results.

How To