Running tests

At least Clang 7.0 and Clant-tidy 7.0 is required to run the tests.

Before running the tests the CodeChecker package needs to be built!

# Build the package
make package
make test run all tests (unit and functional)
make test_unit unittests
make test_functional functional tests (SQLite and PostgreSQL)
make test_sqlite functional test (SQLite)
make test_psql functional tests (PostgreSQL)
make TEST="tests/functional/cmdline" run_test run only a specific test (SQLite)

Clean test workspace

make test_clean

Run tests with PostgreSQL

At least one of the database drivers needs to be available to use the PostgreSQL database backend.
psycopg2 is used by default if not found pg8000 is used.

Nosetest configuration

.noserc configuration file in the repository root is used to configure running the tests: Further configuration options can be found here Nosetest usage.

Virtual environment to run tests

Test running virtual environment is automatically created and sourced by the make test* commands. Create a python virtualenv for development:

make venv_dev

Create new unit test

Use the script to generate new test files. module_name

Add new tests for the created tests/unit/ filee and run the unit tests:

make test_unit

Create new functional test

Use the script to generate new test files. newfeature

From the repository root run the new test template (should pass):

make TEST="tests/functional/mynewfeature" run_test


In each functional test mynewfeature/ is doing the functional test setup:
- exporting test related data to the test directories - analyzing a test project (multiple times if needed) - start a server connected to a specific database (should be stopped in teardown) - prepare and cleanup the test workspace - ...

Add new functional testcase

The actual test cases go to mynewfeature/ file. The setup part of these test read up the generated test configuration file by Test cases should only use test related configuration values ONLY from the configuration file generated by the The tests should ONLY modify the files in the workspace provided for them.
Test cases can: - rerun the analysis - connect to the server started by the - run command line commands - modify configuration files - ...