About RMC & Unity3D
Rivello Multimedia Consulting (RMC) provides consulting services for applications and games. RMC specializes in Unity3D development (see our work here). Please contact us today with any questions, comments, and project quotes.
As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.
Intro To Unit Testing
To get the full background on what exactly are unit tests and more, checkout my “Unity3D Unit Testing 1” article first. It covers the basics as well as the historical challenges of testing within Unity. There I also cover the theory of TDD.
Unity Test Tools
In December, 2013 Unity Technologies released Unity Test Tools (UTT). While there had been several 3rd party options to attempting testing, now we have the official solution.
As Unity Technologies previously announced, they have been using testing internally on the core Unity3D codebase for a couple years. Lessons learned there helped to shape the free, newly released Asset Store Item Unity Test Tools.
The UTT package comes with 2 major areas of functionality. We cover them here.
1. Assertion Component
The assertion component is able to monitor the state of gameobjects while in playmode and pause the game if the condition is met. The primary use is debugging, where you can make the game stop in the exact frame the condition is met, thus enabling you to see the entire picture of when it occurs.
2. Integration Test
In order for you to test the integration between components, objects and assets, you need a higher level of tests and for this Unity has made the Integration Test Framework. Integration tests are also the easiest way of starting to write automation tests on a game in development, since they don’t have requirements on the architecture of the code.
This is obviously very powerful. Its early, but it is not yet clear to me how to utilize this in my project workflow. But I’ll figure it out soon. However, the following feature is perfect for me.
3. Unit Test
The lowest and most efficient level to do automation is at the unit level. Unity decided to use nUnit (nUnit.org) as the basis for the unit test framework, which is a well known framework for those already writing unit tests. In development, a ‘unit of work’ is a single logical functional use case in the system that can be invoked by some public interface (in most cases). A unit of work can span a single method, a whole class or multiple classes working together to achieve one single logical purpose that can be verified.
A unit test is an automated piece of code that invokes a unit of work in the system and then checks a single assumption about the behavior of that unit of work. Good unit testing is an art and a science and there is TONS of material online about it.
A good unit test is:
- Fully automated
- Consistently returns the same result
- Tests a single logical concept in the system
The Unity Test Tools
The free, newly released Asset Store Item Unity Test Tools, include the core testing libraries, examples of all 3 of the above types of tests, and documentation. If you find the documentation to be dry and obtuse (*hint*), then you are in luck. Checkout my video here. It cover only Unit Testing. The full source-code shown in the video is available for you too (See ‘Member Resources’ Below).Vimeo responded to TubePress with an error: Not Found
[private_Free member]Enjoy this members-only content!
- Download My Unity Testing Tools Demo Project