Help Test

Testing can be done locally with your open Blender and Unreal Editor instances or with Dockeropen in new window containers. First install the requirements.

pip install -r requirements.txt

Testing Against Open App Instances

  1. Open Blender
  2. Open your Unreal Project and make sure remote execution is enabled.
  3. Install the addons.
  4. Start the RPC server Pipeline > Utilities > Start RPC Servers.
cd ./tests
python run_tests.py

Testing should begin.

Testing Against Docker Containers

The CI/CD system tests against the docker images. The containers are Linux.

  1. Install Dockeropen in new window.
  2. Make sure docker is working by running docker images.
  3. Set the environment variable TEST_ENVIRONMENT=1.
  4. Set the environment variable GITHUB_TOKEN=your-personal access-token. This is needed to pull the unreal container imageopen in new window if you don't already have it.
set GITHUB_TOKEN=your-personal access-token
set TEST_ENVIRONMENT=1
cd ./tests
python run_tests.py

Testing should begin.

Note

If the you don't have the docker images already pulled this can take a while to pull the images.

View Test Results

The tests will run for a while and when they finish you should receive output like this indicating there were no failures.

----------------------------------------------------------------------
Ran 74 tests in 917.496s

OK (skipped=30)

Generating XML reports...

XUnit Files

The test runner will also output the results as xunit files to the ./tests/results folder.

A handy cli tool for viewing xml unittest results is xunit-vieweropen in new window. If you wish you can install it and run:

xunit-viewer -r ./results

A index.html should now be available to view in the tests folder.

Environment Variables

The run_tests.py script can be customized with environment variables. You probably won't ever need to modify these from their defaults, however, since there are so many unit tests, targeting specific files with the EXCLUSIVE_TEST_FILES or specific cases with EXCLUSIVE_TESTS can be beneficial.

VariablesDescriptionDefault
TEST_ENVIRONMENTWhether to run the in the container test environmentIf no value is set, testing will run on the host
EXCLUSIVE_TEST_FILESWhether to run tests exclusively on this list of test files. Comma seperated list.Runs all tests files by default
EXCLUSIVE_TESTSWhether to run tests exclusively on this list of test names. Comma seperated list.Runs all tests cases by default
REMOVE_CONTAINERSWhether to shutdown and remove the containers after testing. Testing will be faster if the containers don't have to restartTrue by default. Leave blank if you want the containers to keep running
BLENDER_ADDONSA comma seperated list of the addons to testsend2ue,ue2rigify
BLENDER_PORTThe port blender communicates on9997 on host 8997 for container
UNREAL_PORTThe port unreal communicates on9998 on host 8998 for container
HOST_REPO_FOLDERThe path on disk to the repoThe repo folder relative to the current working directory
CONTAINER_REPO_FOLDERThe path in the container where the repo is mounted/tmp/blender_tools/
HOST_TEST_FOLDERThe path on disk to the repo tests folderThe current working directory
CONTAINER_TEST_FOLDERThe path in the container where the repo tests folder is mounted/tmp/blender_tools/tests
RPC_TIME_OUTWhen running a Non-Blocking server, the is a timeout value for command execution. If a command has been sent from the client, the server will try to give the client the response up until 20 seconds has passed. Once the response or timeout has been reached, the server will let the event loop of the DCC continue again.20
RPC_EXECUTION_HISTORY_FILELets you specify a file path to write out the python execution history by the rpc module. This is useful for debugging.None