Pricing

How to automate Unity Games using Altunity Tester

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.

The mobile application 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 operation 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.

 

AltUnityTester

 

AltUnityTester – will help you find game objects in your Unity project and get their coordinates and other attributes on the screen so that you can interact with them from Appium script.

Currently, AltUnity Tester is an open-source UI driven test automation tool that is available in Unity Asset Store. You can interact with game objects using tests written in C#, Python, or Java. You can also run your tests on real devices (mobile, PCs, etc.) or inside the Unity Editor

 

How it works:

 

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.

Documentation: https://altom.gitlab.io/altunity/altunitytester/pages/get-started.html

Youtube Video: https://www.youtube.com/watch?v=L4yAgv8Jc8s&t=22s

 

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 on Editor 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 on 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

 

2. Running Altunity Tester Test on WeTest against a wide range of devices

 

Steps:

 

  1. Make sure you have followed the steps above and run test cases using Altunity Tester successfully in Unity Editor.
  2. Go to WeTest Console and choose Automation.
  3. Create a new test run in the project.
  4. Upload the tested App (apk/aab/ipa) at the first step via UI or REST API.

       5. Choose Appium framework and upload the above-created zip file.

      6. Choose the devices manually or randomly.

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

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

订阅新功能推广裂变活动
Latest Posts
1Enhancing Game Quality with Tencent's automated testing platform UDT, a case study of mobile RPG game project We are thrilled to present a real-world case study that illustrates how our UDT platform and private cloud for remote devices empowered an RPG action game with efficient and high-standard automated testing. This endeavor led to a substantial uplift in both testing quality and productivity.
2How can Mini Program Reinforcement in 5 levels improve the security of a Chinese bank mini program? Let's see how Level-5 expert mini-reinforcement service significantly improves the bank mini program's code security and protect sensitive personal information from attackers.
3How UDT Helps Tencent Achieve Remote Device Management and Automated Testing Efficiency Let's see how UDT helps multiple teams within Tencent achieve agile and efficient collaboration and realize efficient sharing of local devices.
4WeTest showed PC & Console Game QA services and PerfDog at Gamescom 2024 Exhibited at Gamescom 2024 with Industry-leading PC & Console Game QA Solution and PerfDog
5Purchase option change notification Effective from September 1, 2024, the following list represents purchase options will be removed.