End-to-End Testing of Unity Games and Apps
Develop apps in Unity to be able to get fast prototyping, with incredible graphics on every platform
Run automated checks on our environment, using Appium and image recognition, but realize a more efficient solution is needed
Start working on a testing tool that allows you to get access to elements in our Unity game or app from tests written in Python using Appium
Improve the testing tool to work in Java and from the Unity Editor in C# and make sure it’s usable without Appium as well
Be super cool about it and make it an open source tool for everyone to use
a solution that allows you to test applications and games developed with Unity 3D
Types of testing
UI Driven Testing
Mobile Application Testing
Tools & technologies
A couple of years ago we started working with a company in their New Concepts team as testers and app developers. Our client was creating simple clean apps, testing a lot of new ideas that had to be delivered fast.
The needs and challenges
As part of their team, we were trying out a lot of new ideas, developing small apps and prototyping a lot of solutions in a very fast paced environment. Along with new ideas, we also needed to try new graphical designs and we needed to create apps that were fast to develop and could be deployed to a multitude of platforms if needed. We focused mostly on iOS and Android, but we needed to know that the apps could run on Windows, Mac, etc.
After trying out a few options, including some web frameworks, we decided to develop all our apps in Unity. It has support for any platform that we could ever need and it’s excellent for fast prototyping, with incredible graphics on every platform and with an abundance of ready-made artworks, scripts, plugins and solution available on their Asset Store.
While Unity allowed us to be very productive on the development side, we were again struggling on the testing side. I had to deal with a lot of apps that still required a lot of testing. Most of these apps also had to work together as part of a system, and we often found ourselves trying to figure out ways to deploy and run some automated checks on our environment automatically. While the apps were relatively simple and would have been the perfect candidate for simple automated checks with Appium (which works on Android, iOS and even Windows nowadays), Unity didn’t have a solution for running these types of system level / UI driven tests on real devices.
While searching for a solution for these two problems, Rasmus Selsmark, a fellow tester who works at Unity in Helsinki, told us about this hack-day project that provides one possible option for running Appium tests against Unity games and getting feedback from Unity about the objects on the screen via the Debug.Log() functionality – so essentially by injecting information about specific objects in the device logs (logcat on Android or syslog on iOS), from where they can then be parsed and used inside the Appium tests.
We tried it out and then decided to try to implement something similar using a TCP socket running from the Unity game that can listen to commands sent from the tests. And so AltUnityTester came to be.
AltUnityTester – now also available on the Unity Asset Store – will let you find objects in your game and get their coordinates on the screen so you can interact with them from Appium.
You can use the elements from Appium or independently, you can query their properties, call any of their public methods, etc. You can also interact with the game by modifying its time scale or changing levels programmatically.
Currently, AltUnityTester has bindings implemented for Python, Java and C#, allowing you to:
- create an AltUnityDriver,
- connect to the AltUnityTester component running on the device,
- ask for information on objects from the Unity Game
- find elements and get their coordinate
Are you developing games with Unity 3D ?
Talk to us, we will find the solution for you!
or call +40 371 426 297