Test Framework¶
The test framework is a series of tools to automate the verification process of the Blender Niftools Addon that aims to unify the various levels of testing that should be performed to release the addon:
Unit
Functional
Integration
Regression
Performance
For an overview of each level see the design section
Prerequisites¶
The following environmental variables must be set.
We decided not to auto-detect file paths as devs may have many versions installed. This also allows switching between versions of Blender to run tests against.
BLENDER_HOME¶
Set to the folder the blender.exe installation is contained in, e.g.,
BLENDER_HOME=C:/Program Files/Blender Foundation/
or from a terminal (Linux):
BLENDER_HOME=~/.blender/
BLENDER_ADDONS_DIR¶
Installs the Blender Nif addon and its dependencies.
Set the location of corresponding Blender addons folder:
BLENDER_ADDONS_DIR=%APPDATA%\Blender Foundation\Blender\<version>\scripts\addons
or from a terminal (Linux):
BLENDER_ADDONS_DIR=~/.blender/<version>/scripts/addons
Install¶
To install the addon from a git checkout, run the following:
cd blender_niftools_addon/install
install.bat
or from a terminal (Linux):
./blender_niftools_addon/install
sh ./install.sh
Running Tests¶
To run all tests, run the following in a buildenv (Windows):
blender-nosetests.bat
or from a terminal (Linux):
sh ./blender-nosetests.sh
from within the blender_niftools_addon/testframework/
folder.
Each test resides as a python file in the blender_niftools_addon/testframework/test/
folder. To run a particular
test only, specify the file as an argument; for instance
blender-nosetests.[bat|sh] test/geometry/trishape/test_geometry.py
Actually, all command line arguments of nosetests
apply. For example, to abort on first failure
blender-nosetests.bat -x
For more details, run
blender-nosetests.[bat|sh] --help
The tests will run on the currently installed addon (not your checked out version!) so usually ensure you re-install after making edits to add-on files.
Beware that the output can be rather verbose, so you may have to scroll quite a bit to see the relevant backtrace. Also, see the nose manual.