Can we use Appium for automating UNITY Android mobile game?

Hi Guys,

I wanted to automate android game which is build in UNITY. Can anyone suggest me how we can automate using appium.
I gave one try using APPIUM but my home screen has play button but it is not detecting that play button. it is taking whole screen as one frame and not showing content in between that.
Any type of suggestions are welcome.

1 Like

@Sahil_Garg: Yes it would be very difficult to automate the mobile games using appium directly. For this you should follow the image recognition approach. Follow this article for more reference: http://testdroid.com/tech/building-the-latest-opencv-and-akaze-for-image-recognition

Personally, I never worked on automating mobile games. But I’m always interested to put my hands on it. Let me know how it goes.

1 Like

Let me go through this and if it works will let you know the approach. In between can you see some other way to do automation. it will be a very grt help.

we use image recognition as final case when we failed to get any other approach.

the worse of all of this staff is that with different screen resolution you should use different images to search.

we wrote own approach in such case when we have array of images and any match means we got needed image.

@Aleksei: i have to go through document for image recognition feature but can we use unity itself for this? Is Appium involvement is mandatory?
i saw this video “https://www.youtube.com/watch?v=RDee1OFl6YM” and they didnt use appium anywhere.
This approach is good but i don’t have clear picture about this.
Can you see this and give me some suggestions like how to start and what all things i need to start

DO i need MAC compulsory for this image recognition approach?

Mac not need. with MAC we met that openCV library did not work and found in openCV forum specially build for 64bit MAC openCV file.

partially i wrote our approach here: https://github.com/appium/appium/issues/943 see reply to @Simon-Kaz

can you please provide me your contact number.wanted to discuss on this. its very urgent.

howto install image recognition addon/support for Appium?

you need just include openCV and any image working library.

we use Sikuli thus in our POM file was added:

        <dependency>
            <groupId>org.sikuli</groupId>
            <artifactId>sikuli-api</artifactId>
            <version>1.2.0</version>
        </dependency>

do add openCV use:

<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>opencv</artifactId>
    <version>3.1.0-1.2</version>
</dependency>

You can try to use the recently released AltUnityTester: https://assetstore.unity.com/packages/tools/utilities/altunitytester-112101
Full tutorial here: http://altom.ro/blog/altunitytester-unity-using-appium

I am working on test framework for UI testing of Unity3d application that’s called Puppetry. You can find source code here and its documentation on Wiki.

Puppetry can find a GameObject by its name and position in the hierarchy, and then emulate interaction with it (Click, SendKeys, DragAndDrop, Swipe, etc).To make validation and asserts you can check if GameObject is exist, is active in the hierarchy, plus get its component to check its value.

You can run UI testing against game launched in Editor or combine it with Appium, for example, to test the application on mobile devices. To use it on a device, Puppetry can provide screen coordinates of a GameObject, and you can click on them, or just use Puppetry’s click.

The framework is easy to combine with NUnit, XUnit or MSTest.