Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Using existing projects

offa edited this page Jul 24, 2016 · 1 revision

Enabling Test Support for NetBeans projects created from existing C / C++ projects (eg. Makefile, CMake, …).

1. Project requirements

The project requires two defined make targets:

  • build-tests – builds the tests, executed before running the tests (can be empty)
  • testruns the tests (using verbose output)

Note: test is a reserved target on Cmake – please see A. Workaround for CMake.

2. Enable Test Support

In addition, the Netbeans Project configuration must contain a Test Files Folder. The project can be upgraded using the New File Wizzard for Unit Test / Test Main files.

  1. Go to New Files → Unit Tests → <select any>
  2. Enable "Configure custom Project"

New Unit Test:

Unit Test

New Test Main:

Test Main

A Test Files folder is added to the NetBeans project – not visible at file level.

This step is needed only once per project, though doing this more than once has no effect.


A. Workaround for CMake

To workaround the reserved test-Target:

  1. Don't call enable_testing()
  2. Set Policy for CMP0037 to OLD: cmake_policy(SET CMP0037 OLD) (related: CMake #12960)