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 minimise 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
** 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
- Download and Import AltUnity Tester Package from Unity Asset Store
- Open AltUnity Tester Editor window from Unity Editor -> AltUnity Tools -> AltUnityTester
- 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}”.
- Create a folder named Editor in your Unity Project, write and execute the first test for your game using AltUnity Driver Commands .
- 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.
- 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
- Running Altunity Tester Test on WeTest against a wide range of devices
Steps: - Make sure you have followed the steps above and run test cases using Altunity Tester successfully in Unity Editor.
- Go to WeTest Console and choose Automation.
- Create a new test run in the project.
- Upload the tested App (apk/aab/ipa) at the first step via UI or REST API.
- Choose Appium framework and upload the above-created zip
- Choose the devices manually or randomly.
- Select optional advanced options and submit your test run.
- Test results will be available in the cloud in Test Analysis .
Check out all the software testing webinars and eBooks here on EuroSTARHuddle.com