Tools/Tests/Setup

< Tools‎ | Tests

Automated Tests

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

Setup

Tests require Blender to be built, see the official build instructions. This document assumes the directory layout to be:

~/blender-git/blender  # Blender source directory
~/blender-git/build    # Blender build directory

Running the tests is then done with the make test:

cd ~/blender-git/blender
make test

Downloading Test Files

Additional binary test files are needed for running the Blender tests. These are available though an SVN repository, separate from the Blender source repository.

make test will automatically download these files the first time in runs.

To download the test files manually:

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

Updating Test Files

Test files change along with the Blender source code. make update will update tests to the latest version if you have downloaded them once, together with the Blender source code.

cd ~/blender-git/blender
make update

Running Tests

make test runs all available tests. For fine control, use ctest directly.

ctest must be run from the build directory.

cd ~/blender-git/build

Some example commands are:

# List available tests
ctest -N
# Run all tests with name matching "alembic"
ctest -R alembic
# Show verbose output for a test, to get more information on why it failed
ctest -VV -R alembic
# Run tests in parallel, and show verbose output for failed tests
ctest -j 4 --output-on-failure

When building with Visual Studio, the build configuration needs to be specified for every ctest command, for example:

ctest -C Release -R alembic

Render 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:

cd ~/blender-git/build
# Update reference images for cycles tests
BLENDER_TEST_UPDATE=1 ctest -R cycles

When committing changes to the Blender repository, the updated reference image should be committed to the tests repository as well.