AL_USDMaya (as of 0.30.1) contains a library called "AL_MayaTest", see here. This provides 2 modules:
- testHelpers - Some useful helper methods for writing your own tests
- testHarness - some glue to allow you to easily create a maya plugin which is a "wrapper" around googletest (Note: we're currently using googletest-2.a2.0.1 internally).
This module is used by AL_USDMaya's own tests, but can also be used to test your own AL_USDMaya translators, or indeed any maya code at all. All you need to do is to use write a simple plugin entry point that uses the testHarness, and compile in your test files - google test is able to find them without any additional registration scheme.
Plugins created with this module can be run in a number of ways:
- Interactively from inside Maya
- In batch mode (we have some convenience MEL/Shell scripts to bootstrap this)
The plugin registers a single command which runs the tests:
AL_usdmaya_UnitTestHarness [flags]
Most of the flags are taken directly from googletest (see here. Some have been been renamed slightly or inverted.
(We should/could look at just having a passthrough --googleargs "googleargs here" approach rather than passing each one explicitly as a maya command argument)
Flag | Type | Description |
---|---|---|
-bof-break_on_failure | see googletest | |
-f -filter | String | see googletest e.g AL_usdmaya_UnitTestHarness -filter "translators_CameraTranslator.*" |
-ff -flag_file | String | maps to gtest_flagfile= to allow args to come from a file |
-ktf -keep_temp_files | bool | remove temp files after test run |
-nc -no_colour | see googletest | |
-ne -no_catch_exceptions | see googletest | |
-o -output | String | This flag controls whether Google Test emits a detailed XML report to a file in addition to its normal textual output. See googletest |
-rp -repeat | Int | see googletest |
-rs -random_seed | Int | see googletest |
-std -stack_trace_depth | Int | This flag specifies the maximum number of stack frames to be printed in a failure message. See googletest |
-tof -throw_on_failure | see googletest | |
-l -list | list all tests (stdout) see googletest | |
-nt | print execution time see googletest |
contains general purpose test utility functionality that could be reused by your own plugins or any additional tests
The AL_MayaTest library is used in a couple of places in AL_USDMaya:
see here
This contains most of the unit tests for the core AL_USDMaya library, and uses the AL_MayaTest library to create a test plugin to run them (see plugin)
It also contains a run_mayaplugin_tests.mel script which loads the plugin, and runs the test command with no args. You can use this to run the tests from batch mode, and additionally use the run_mayaplugin_tests.sh to call the same from the command line or a CI system - there are CMake targets for using with ctest which we use to run our automated tests
see here
Similar to the above