[Automatic test] How to start making automatic test during runtime with Airtest

This is a memorandum on how to start the application automatic test tool Airtest.

What you can get by reading this article

People who have never used Airtest will be able to create simple runtime tests of applications from environment construction. (I hardly write a program)

procedure

  1. Install Airtest IDE
  2. Connect the actual Android device to the Airtest IDE
  3. Write a simple test process
  4. Run the test

1. Install Airtest IDe

Airtest Project Download it from this official website and install it.

2. Connect the actual Android device to the Airtest IDE

This is the state immediately after starting the Airtest IDE.

Click Refresh ADB with the actual device connected to the PC with a USB cable. Then, the actual device will be listed in Devices> Mobile Phone Connection.

Click around `connect`.

The screen of the actual Android device connected in this way is displayed in synchronization.

3. Write a simple test process

Let's write a test that "touch when the specified button is found".

if(exists(button)):
    touch(button)

The source code is very simple, but the point is how to define this button.

Defined by image recognition

kentei.gif As shown in the video, define the button variable with an image.

The source code looks like this.

4. Run the test

Press the play button to run the test.

kentei_sample.gif

Since the specified button existed like this, the touch process ran and the screen transitioned as expected.

Finally

I was able to create a test with almost no programming. I did the first time from installation to writing tests while writing this article, but I didn't get lost.

This time it was a very simple case of "touching when you find a button", but you can write a longer story and apply it in various ways such as tutorial breakthrough test, game main loop through test, application transition test etc. Many will come out).

By the way, the app used in this test is a game called Color Reduction Test made with Unity1Week.

environment

Recommended Posts

[Automatic test] How to start making automatic test during runtime with Airtest
How to do portmanteau test with python
How to deal with run-time errors in subprocess.call
How to update with SQLAlchemy?
How to cast with Theano
How to Alter with SQLAlchemy?
How to separate strings with','
How to RDP with Fedora31
How to start Apache by specifying httpd.conf with systemd (CentOS7, CentOS8)
How to Delete with SQLAlchemy?
How to start the program
How to batch start a python program created with Jupyter notebook
How to cancel RT with tweepy
Python: How to use async with
[Django] How to test Form [TDD]
How to use virtualenv with PowerShell
How to deal with imbalanced data
How to install python-pip with ubuntu20.04LTS
How to deal with imbalanced data
Try to profile with ONNX Runtime
How to get started with Scrapy
How to get started with Python
How to deal with DistributionNotFound errors
How to get started with Django
How to Data Augmentation with PyTorch
How to use FTP with Python
How to calculate date with python
How to install mysql-connector with pip3
How to INNER JOIN with SQLAlchemy
How to install Anaconda with pyenv
How to authenticate with Django Part 2
How to authenticate with Django Part 3
[Image recognition] How to read the result of automatic annotation with VoTT
How to do arithmetic with Django template
[Blender] How to set shape_key with script
How to title multiple figures with matplotlib
How to get parent id with sqlalchemy
Image classification with Keras-From preprocessing to classification test-
How to add a package with PyCharm
How to install DLIB with 2020 / CUDA enabled
How to use ManyToManyField with Django's Admin
How to use Google Test in C
How to use OpenVPN with Ubuntu 18.04.3 LTS
How to use Cmder with PyCharm (Windows)
Searching for properties to start with TensorFlow-Part 1
How to prevent package updates with apt
How to work with BigQuery in Python
How to study deep learning G test
How to use Ass / Alembic with HtoA
How to deal with enum compatibility errors
How to use Japanese with NLTK plot
How to search Google Drive with Google Colaboratory
How to display python Japanese with lolipop
How to download youtube videos with youtube-dl
How to use jupyter notebook with ABCI
How to power off Linux with Ultra96-V2
"How to pass PATH" to learn with homebrew
How to scrape websites created with SPA
How to use CUT command (with sample)
How to enter Japanese with Python curses
How to test on a Django-authenticated page