Tools/Tests/Setup

< Tools‎ | Tests

Test Setup

Blender uses the CMake testing framework to build Python and GTest tests. Only a small fraction of Blender's code base is covered, developers are highly encouraged to add more tests.

This document assumes you have built blender using the official build instructions.

  • blender source in ~/blender-git/blender
  • blender build in ~/blender-git/build

Dependencies

External binary files are needed for running some Blender tests. They are available through a SVN repository. Run these commands to get them (assumes SVN being available):

cd ~/blender-git
mkdir lib
cd lib
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests

Running the tests

At least once you need to run the complete make command:

cd ~/blender-git/build
make test

This will run all the available tests. If you want to run a specific test, you can cancel make test as soon as it starts running tests. This step is further required to make newly added tests executable.

Running multiple tests with a similar name is possible using the -R option:

ctest -R render_layer

If a specific test fails, you can re-run it with verbose options to get more information:

ctest -R render_layer_evaluation_render_settings_a -VV

Regression Tests

Render and OpenGL drawing tests produce a HTML file to show the result of running regression tests, comparing renders and screenshots against a reference image. These can be found at:

  • ~/blender-git/build/tests/report.html

When there are benign test failures due to intentional changes, or when adding a new test, the reference images can be updated as follows:

# Update reference images for cycles tests
BLENDER_TEST_UPDATE=1 ctest -R cycles