Tag: Unit Testing

Unit Testing in Maya (Part 2)

  • Edited: 6/18/2016: Updated RollbackImporter to support relative imports and “from package import module” syntax.

In my last post, I went over writing scripts that can be used to write unit tests for Maya tools and then run those tests from the commandline outside of Maya. In this post, I’ll go over running those tests interactively in Maya. Being able to run tests interactively in Maya will greatly speed up debug times when tracking down issues because you’ll be able to see what is going on in your tests. To make the process more user-friendly, I’ll also add a UI to help execute the tests. Again, all of this code is available on my Github.

...

Unit Testing in Maya

Unit testing is a valuable tool that a lot of studios fail to implement. Unit testing can save a great amount of time and energy (and therefore money) by allowing developers, tool writers, and even content creators to catch broken deliverables before passing them downstream in the pipeline. The lack of unit testing with TD’s is most likely due to one of the following:

  • The person doesn’t know what unit testing is.
  • The person has heard of unit testing but has no idea how to implement it.
  • The person is in production and believes there is no time for creating unit tests.
  • The person knows what unit tests are and just doesn’t want to do them.

In this post, I am going to describe unit testing as it relates to assets and Python tools created for Maya. For those that don’t know, unit testing is pretty much a bunch of Python functions that you write that verify your tool is doing what it is supposed to be doing. For example, if you write an ik/fk switch tool, one unit test could be to load a rig, pose the arm in ik, switch to fk, and then check to see if the arm is in the same place. Another example is if you write a blendShape exporter, you can write tests to make sure the shapes are properly recreated when you import them into a new scene. Unit testing gives developers the confidence to update their code and assets with the certainty that their updates are not breaking any existing functionality.

...