Maestro Intro
TestingBot provides a grid of remote iOS simulators and Android emulators, ready to run your Maestro flows.
Maestro is a mobile UI testing framework, which supports testing on both iOS and Android. You write flows, which are story-like tests, where you describe a specific flow in your mobile application. For example, you could have a login flow, or a checkout flow.
Maestro is a relatively new test framework and offers several nice features, such as:
- Built-in tolerance to flakiness: various mechanisms are added to try and prevent flaky tests, for example locators that have changed or moved positions.
- Automatic waits: Maestro will automatically wait for certain conditions, which means you do not have to worry about delays, or adding sleep commands to your tests.
- Declarative syntax, which is defined in Flow (
yaml
) files.
Setup
Installing Maestro locally on your computer is not a requirement, but it might help to first run Flows on your local computer before running in the cloud, to make sure the flow test files are valid.
To install Maestro CLI, please install it like this:
To run mobile app tests with Maestro on TestingBot, you will first need to upload your iOS or Android app to TestingBot. Once that is done, you will need to zip the Flow files together and upload these through the TestingBot API.
Finally, you can run a REST API call to start the Maestro tests on one or more iOS simulators or Android emulators.
Upload Mobile App
You will need to upload a mobile app to run tests with Maestro. The format of this file depends on which device type you'd like to test:
-
iOS Simulators:
You can upload your
.zip
file, see here how to prepare this zip file. -
Android emulators:
Upload the
.apk
file, which TestingBot will automatically install on the Android emulator.
Upload Maestro Flows
Maestro Flow files are .yaml
files which contain the actions that need to be performed. You can zip these together and upload to TestingBot by using the following command:
To upload the Flows zip file, please follow the example below.
Run Maestro tests
Once you've uploaded both your app and Flows zip file, you can run the Maestro tests on the TestingBot cloud.
Specify one or more capabilities, to indicate on which iOS simulators or Android emulators you want to run your tests on.
Replace the
:id
with the identifier you received during the app upload call. (In this example 4012)
View Maestro Results
The results of your Maestro tests will be available in the TestingBot dashboard.
Each test result contains a video, test logs and other meta data generated during the test run. Maestro flows will be displayed, together with the steps that were taken during each flow.
You can also use an API call to get back the result from the run(s):
JUnit Report
All Maestro tests on TestingBot will by default run with a JUnit reporter. This report is accessible programmatically:
curl -u api_key:api_secret \
"https://api.testingbot.com/v1/app-automate/maestro/:project_id/:run_id/"
Replace the
:project_id
with the identifier you received during the app upload call. (In this example 4012)Replace the
:run_id
with the identifier for this run.
The response will contain a report
string value that contains the XML formatted JUnit report.
For each flow, there will be a testcase
entry, together with multiple property
child items, for each step in a Maestro flow.
Example Maestro Flow
Below is a simple example Flow, where we input two values in the TestingBot example app.