paint-brush
How to Automate Unity Games using Altunity Testerby@wetest
747 reads
747 reads

How to Automate Unity Games using Altunity Tester

by WeTest QualityJuly 7th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Mobile app development teams need to speed up the pace of releases to meet customer expectations. QA teams run automated tests on real devices with different systems and models to get instant feedback after a new module or feature is completed. Appium seemed to be the most popular solution for mobile testing framework since it offers great interaction with the devices on multiple operating systems and supports many programming languages. WeTest provides 1000+ real mobile devices of different system versions and models. For Android, you can remotely connect with 1000+ WeTest cloud devices and execute AltUnity Tester tests on them in your Unity Editor.

Company Mentioned

Mention Thumbnail
featured image - How to Automate Unity Games using Altunity Tester
WeTest Quality HackerNoon profile picture


Mobile technology has been improving at a far greater rate than any other technology during the past years.


In today’s competitive mobile market, mobile app development teams have realized that they need to speed up the pace of releases to meet their customer expectations. In order to ensure quality and better user experience, QA teams run automated tests on real devices with different systems and models to get instant feedback after a new module or feature is completed. Appium seemed to be the most popular solution for mobile testing framework since it offers great interaction with the devices on multiple operating systems and supports many programming languages.

However, for mobile game developers, using Unity and Unreal but not using the native UI framework, Appium cannot identify the UI objects in the game directly. The difference in positioning elements by coordinates and pixels varies greatly on mobile devices makes it hard to provide good stability. Although some developers try to use image recognition for game UI component positioning, the accuracy and speed of this approach can seriously affect the efficiency of game developers.

If you’re looking to minimize manual QA involvement and fully embrace automation in your Unity project, just take a look at AltUnity Tester and see how it provides a simpler test creation process and better UI element identification.


Getting started with AltUnityTester in your Unity Editor


To get started with AltUnity Tester, see the following steps, you can also visit the official website or view the tutorial video on Youtube for more details.


Click forDocumentation
Click forYoutube Video


Steps(Unity Editor)


  1. Download and Import AltUnity Tester Package from Unity Asset Store

  2. Open AltUnity Tester Editor window from Unity Editor -> AltUnity Tools -> AltUnityTester

  3. Run the game in Unity or onEditor platform, the instrumented Unity app will launch and display a popup with the message: “Waiting for connections on port: {Port}”.

  4. Create a folder named Editor in your Unity Project, write and execute the first test for your game using AltUnity Driver Commands .

  5. In the Run Tests section, press “Run All Tests”, see the output of the tests in the Unity Editor Console.


Running AltUnityTester using WeTest Android real devices

There's no doubt that the multitude of mobile devices, their OSs, and versions is a big challenge for mobile game testing. Screen resolution, memory capacities, OS fragmentation CPU – they all differ from one device to another. However, acquiring and maintaining devices is expensive and time-consuming, not to mention having to charge and update devices constantly. So, a cloud-based mobile app testing solution is a feasible way to not only have instant access to the latest devices and operating systems, but also any other popular devices on which your end users have your apps installed. WeTest provides 1000+ real mobile devices of different system versions and models.

For Android, you can remotely connect with 1000+ WeTest cloud devices and execute AltUnity Tester tests on them in your Unity Editor via Android Debug Bridge (adb). See more details about how to enable ADB on WeTest devices.


Running AltUnityTester Test in parallel on WeTest Cloud

It’s a common practice to test your mobile games on dozens or even hundreds of real devices, to ensure the compatibility of your Mobile Game on different devices. Besides, some teams may try to run multiple automated tests simultaneously in order to save time for large mobile games. WeTest allows running one test script against a wide range of real devices easily and repeating it at no cost which could reduce your test time from hours to minutes. Let's see how it works.


  1. Preparing your Test Before running your Altunity Tester test on WeTest Cloud, you have to create two files first
  • Unity Package, .apk(For Android), open AltUnity Tester Editor window, in the Platform section select Android platform, press "Build Only” to generate the .apk file. See more details here . By the way, we use Endless Runner - Sample Unity Game as our sample Unity project.

  • Test Suite, .zip file, describes how your tests will be run. Just follow the steps to create a python test suite


(1) Installing the AltUnity Python Driver pip package for python


pip install --pre altunityrunner


(2) Download our sample on Github Repository and write your tests using AltUnity Driver Commands . WeTest supports any native mobile test automation framework and all programming languages. Here we use python as a sample. If you are using other program languages, please let us know.


(3) Add your cases between the lines in demo_cases.py


 # your test cases start here

  # your test cases end here


(4) Generate your script file(.zip)

WeTest accepts a zip file as the Appium script package. Please zip all test script files(.py files) and relevant files into one .zip file.

You can run sh create-zip.sh to zip your file. Your test suite(.zip) contains the following files(Python):


  script.zip
  ├── demo_cases.py - your test cases
  ├── runTest.sh  - used to start the automation test in cloud container 
  1. Running Altunity Tester Test on WeTest against a wide range of devices Steps:

  2. Make sure you have followed the steps above and run test cases using Altunity Tester successfully in Unity Editor.

  3. Go to WeTest Console and choose Automation.

  4. Create a new test run in the project.

  5. Upload the tested App (apk/aab/ipa) at the first step via UI or REST API.

  6. Choose Appium framework and upload the above-created zip


  7. Choose the devices manually or randomly.

  8. Select optional advanced options and submit your test run.

  9. Test results will be available in the cloud in Test Analysis.

For any inquiries, please visit WeTest Official Website.