Learn Mobile Automation Tests Using AltUnity Tester and Appium


When it moves toward mobile automation testing, there are multiple different choices for a tool. One prominent option is Appium, an open-source framework that facilitates running automated tests on both iOS and Android devices. In this blog, we will look at mobile automated tests using altunity tester, mobile automation, mobile automation testing using Appium, and Appium test automation.

Although a strong tool, Appium has some constraints associated with interacting with some non-native application kinds, one instance being Unity games. For this reason, we utilize AltUnity Tester. It is an open-source UI-driven test automation tool that enables you to find things in your game and interacts with them utilizing tests written in Python, C#, or Java. Now let’s look at mobile automated tests using altunity testers.

Mobile Automated Tests using AltUnity Tester

There are some reasons or scenarios for which you would like to utilize both of these frameworks at the exact time:

  1. By itself, AltUnity Tester cannot liftoff an app on a device. If you seek to run tests in a pipeline, or by utilizing cloud services, you can either build a script which will begin your app, or you can try Appium before the test execution;
  2. AltUnity Tester cannot fulfill some kinds of actions, such as interacting with any aboriginal popups your app probably possesses, or putting the app in the background and beginning it again. In any of these cases, you can utilize Appium to do the aspects that AltUnity Tester can not.

AltUnity Tester with the example of Appium 

To benefit you get commenced on Unity test automation, we’ve built an instance python project which can be formed here. After you cloned it, there are a pair of things you desire to test before operating the tests:

  1. For Android, you require to have Android SDK edition 16 or greater installed on your machine
  2. For iOS, you desire XCode with Command Line Tools installed. It will barely work on Mac OSX
  3. Your mobile device requires developer mode to be facilitated and be attached via USB to the machine running the tests.

Running the tests

For Android, you can only run the script run-tests_android.sh

For iOS, you initial wish to export IOS_UDID=<your-device-udid> then run the script run-tests_ios.sh

To discover an iOS device UDID you can move to Finder, click the device in the sidebar, and click the info under the device name to disclose the UDID

The script will install any prerequisites that are losing from your machine except XCode CLT and Android SDK, then run a fundamental test scenario:

The app will be launched by Appium;

AltUnity Tester will assure it’s originally loaded;

Appium will set the app in the background for a pair of seconds, then proceed with it;

AltUnity Tester will test if the app was continued successfully.

Please examine the following about the setup procedure in base_test.py:

The smallest quantity of requested capabilities has to be put for Appium to operate. Further details about desired capabilities can be established in the official Appium documentation

The Appium driver requires to be developed before the port forwarding desired by AltUnity Test is accomplished. This is because Appium clears any other port forwarding when it begins.

As we have learned mobile automated tests using altunity tester so let us know if you tried our instance and if you found it beneficial. If you have any questions or responses, please leave us a comment below or contact us as soon as you can. Moreover, AltUnityTester is now also available on the Unity Asset Store.

Nowadays, AltUnityTester has bindings executed for Python, allowing you to 

  1. build an AltUnityDriver,
  2. connect to the AltUnityTester element running on the device,
  3. ask for data on objects from the Unity Game,
  4. find components and get their coordinate

Once you receive the coordinates for an element, let’s say “Bed” in the instance you can utilize Appium to click on-screen at those coordinates. Now let’s have a glimpse of running an altunity tester in the cloud.

Running AltUnityTester in the Cloud

This tutorial begins by using Unity’s Adventure instance to indicate how a game like that could be tested utilizing AltUnityTester. We wanted to give it a try as you can effortlessly drive Cloud-Side Appium tests in their cloud. We further utilized their Python server-side Appium instance scripts as a starting step and formulated the following changes:

Here we have added the python binding installation in the requirements.txt script:altunityrunner==0.1.3

We have developed the adb forward command in “run-scripts. sh”, just before beginning Appium:

ADB forward tcp:13001 tcp:13000

Also, automated testing is a procedure that validates if the software is working properly and meeting requirements before it is published into production. This software testing technique utilizes scripted sequences that are implemented by testing tools. Automated testing tools enforce examinations of the software, report consequences, and correlate outcomes with faster test runs.

An institution can correlate automated tests to a vast range of cases, such as API, unit, and regression testing. For instance, if unit testing uses a huge percentage of the quality assurance (QA) team’s resources, then this procedure should be examined as a nominee for automation.

Automated tests can run frequently at any time of day. This strategy suits in with continuous testing as well as continuous integration (CI) and continuous delivery (CD) software development exercises, which strive to shuttle code modifications to production without gates that expect manual intervention.  Let’s look at its advantages now.

Benefits of automated testing

Automated testing can increase the QA team’s efficiency. Here are a few advantages that are given below:

  1. Increased accuracy
  2. Better reporting abilities
  3. High coverage
  4. Improved resource efficiency
  5. Enhanced bug detection
  6. Boosted reusability

Automation enables the QA team to prevent these human mistakes in application testing and enforces checks in a rapid time frame than if it were accomplished in person. Similarly, automated testing is often utilized after the software has been evolved to drive longer tests that were presented during the preliminary manual testing. When automated, these prolonged tests can run solitarily on many computers with miscellaneous configurations.