Game Developers Receive Updated Unity Test Tools V1.2
|Stuart Parkerson in Programming Tuesday, March 18, 2014|
Unity recently released version 1.2 of Unity Test Tools. Here are some overviews of the new release.
Unity had been hearing that the main issue that prevents developers from using the assertion component is the lack of the option to strip the code out of the release builds. To solve the issue Unity has implemented scene post-process mechanism that removes all components from the builded scenes. Nevertheless, the code of the assertion is still being included in the builds. This is due to Unity’s nature and the potency of managed languages to keep the ability to use reflection on non-referenced code, for example.
As an assertion, the component should have as little performance impact on runtime as possible. Unity took a closer look and redesigned Assertion Component’s background code to make it run almost 5 times faster.
This is a handy feature for developers who like nesting and grouping tests. Unity made it possible to put integration tests under another one to clear out the structure of tests. Once a test becomes a parent for other tests, it is treated as a test group.
Once integration tests have been written, a natural thing to do is to run them on the platform being developed for. The Platform Runner was created to help in automating this process. It will build selected scenes for the platform and run it. Additionally, it allows the ability to specify a path to save the results.
Until now, the only way to get the results of a test run was to read the result file that was generated (if it was generated). Not every platform Unity can build for supports file system, and if they do, sometimes it can get tricky to get the use of due to system permissions or accessing the file on the device. To address that issue, Unity added a result report showed right on the screen of a device the tests are running on.
For convenience Unity has rewritten the background runner mechanism to run unit tests even though the Unit Test Runner window is not focused. It will run seamlessly and provide notification only if any unit tests failed.
Instantiating GameObjects in a unit test is not a good idea in general, however, sometimes there may be no other choice (or no will to refactor code). The Unit Test Runner gives an option to run unit tests on a separate scene, which is a fast and easy way to clean the ‘pollution’ from the scene. However this gives some overhead of reopening a current scene after every run. To make unit tests execution fast and seamless developers should avoid running them on a separate scene and use Unity’s undo system to backout any changes to the scene made in unit tests. Simply register them with Undo class or utilize the UnityUnitTest base class that comes with the tools.
Continuous Integration Systems Accommodation
To accommodate requests Unity has redesigned the batch runner for both unit tests and integration tests runners. They added possibility to specify result file path from a command line argument and enabled integration tests to be run and build in a player from batch.
Read more: http://blogs.unity3d.com/2014/03/12/unity-test-too...
Become a subscriber of App Developer Magazine for just $5.99 a month and take advantage of all these perks.
MEMBERS GET ACCESS TO
- - Exclusive content from leaders in the industry
- - Q&A articles from industry leaders
- - Tips and tricks from the most successful developers weekly
- - Monthly issues, including all 90+ back-issues since 2012
- - Event discounts and early-bird signups
- - Gain insight from top achievers in the app store
- - Learn what tools to use, what SDK's to use, and more