A Compiler for Multiplatform Behaviour-Driven Development UI Testing

From MobileBDD scenarios to executable Maestro flows

Denis Schüle, BSc Master thesis

Agenda

01 Motivation and RQs
02 Language and compiler path
03 Evaluation design and evidence
04 Issues, contribution, outlook

Mobile quality affects retention and spend

$171B

global consumer spend on mobile apps

Mobile app quality can affect more than implementation cost.

Global consumer spend, 2023 · Statista dossier, p. 14
2.1% / 3.7%

Day-30 retention

Reported for Android and iOS apps in Q3 2024.

Statista dossier, pp. 26-27

App quality is not only a technical concern; it can influence retention and market outcomes.

Quality is experienced through observable interaction

The challenge is turning readable behavioural intent into executable mobile UI tests.

1

Black-box, system-level

Mobile GUI testing exercises the application through visible behaviour, not through source-code access.

2

Model-based logic

Test generation needs a model of intended interaction, but creating and maintaining that model is difficult.

3

BDD as source model

Constrained scenarios keep intent readable while giving the compiler structure to validate and transform.

This thesis is a BDD-inspired, model-based test generation approach: scenarios become an interaction model and then Maestro UI test flows.

Three checks separate generation from correctness

RQ1

Compile

S1 analysis + S2 synthesis

Can the compiler process and translate BDD scenarios into schema-valid Maestro YAML?

SRcomp compilation success rateVG1 requires 1.0 on V first
RQ2

Execute

S3 runtime execution

Can generated flows reach a terminal verdict on Android and iOS?

SRexec,p execution success rate per platformH1 target >= 0.9
RQ3

Agree

S4 oracle comparison

Do generated Pass/Fail verdicts match the manual reference oracle?

SRgt,p generated-vs-manual agreement rateH2 target >= 0.9

RQ1 outcomegenerates schema-valid Maestro flows

RQ2 outcomereaches terminal verdicts on each platform

RQ3 outcomematches the manual Pass/Fail oracle

SR = success rate · V = validation set · VG1 = validation gate before held-out evaluation

Grammar and editor support

grammar_example.mbdd
Feature: Grammar example
As an actor
I want to provide controlled input
So that I can verify parser behavior

Scenario: Controlled input and assertion
Given actor launches app
When actor enters field "value"
Then subject "value" should be displayed

What the grammar keeps explicit

Document shell: Feature, Scenario, Given/When/Then

Controlled step categories

Quoted values and placeholders

Scenario tags and screenshot directives

VS Code extension hint

Live diagnostics, AIM-aware completions, hover/go-to-definition into AIM, and generate/run commands from the editor.

AIM = App Interaction Model · maps reusable scenario terms to app-specific targets, selectors, and Maestro recipes

The CLI turns scenarios into measured evidence

S0

config

InputAIM file, platform, corpus path

Appliedconfiguration and AIM validation

Outputvalidated run plan

S1

semantic gate

InputMobileBDD feature files

Appliedparse, tag filter, semantic resolution

Outputaccepted scenario model

S2

generation

Inputresolved scenarios and AIM recipes

AppliedMaestro backend synthesis

Outputschema-valid Maestro YAML

S3

execution

Inputgenerated and manual flows

AppliedMaestro CLI runtime execution

Outputverdicts, logs, screenshots, reports

S4

agreement

Inputgenerated and oracle verdicts

AppliedPass/Fail verdict comparison

Outputagreement report and metrics

The pipeline separates compilation evidence from runtime evidence before comparing generated and manual verdicts.

One scenario becomes a Maestro flow

MobileBDD input

SCN-F5-01-P.mbdd
@capability-saved-attractions
Feature: Visitors maintain a personal list of Salzburg activities
As a visitor
I want to maintain a personal list of attractions
So that I can revisit activities I plan to visit

@SCN-F5-01-P @flow-interaction-response @expected-pass @refine
Scenario: Saving Getreidegasse changes its state to Saved
Given a visitor has opened details for "Getreidegasse"
When the visitor saves the activity
Then the activity state "Saved" should be displayed
S2

Maestro YAML

maestro/SCN-F5-01-P.yaml
appId: ${APP_ID}
name: "SCN-F5-01-P Saving Getreidegasse changes its state to Saved"
tags:
  - "generated-s2"
  - "capability-saved-attractions"
  - "SCN-F5-01-P"
  - "flow-interaction-response"
  - "expected-pass"
  - "refine"
---
- launchApp:
    clearState: true
- assertVisible:
    text: "Salzburg activities"
- tapOn:
    id: "search_input"
- inputText: "Getreidegasse"
- tapOn:
    id: "poi_row_poi_7"
- tapOn:
    text: "Save to My List"
- assertVisible:
    text: "Saved"

The generated flow keeps scenario metadata and emits executable Maestro commands.

Balanced corpus, platform-aware evaluation

SetRoleScenariosOracle
Vdevelopment / validation32 × target platform16 pass + 16 fail per platformnone required
Eheld-out evaluation32 × target platform16 pass + 16 fail per platformmanual Maestro
SupplementForbes + KotlinConf app corpora2 × 32 × target platformportability probe corpusportability probe

Platform scope

Android + iOSGenerated flows are considered per target platform.

Per-platform runsExecutability and agreement stay separated by platform.

Manual oracleManual Maestro flows provide the reference where reported.

Held-out Android run: full agreement

The current reported result is bounded to the Android SalzburgCard evaluation run.

32/32
generated-vs-manual
agreements

0 disagreed / 0 missing / 0 non-executable

16runtime pass
16expected fail
S1semantic gate4/4

feature files accepted; 32 scenarios extracted

S2generation32/32

schema-valid Maestro artifacts generated

S3execution32/32

generated and manual Android flows reached terminal verdicts

S4agreement32/32

generated terminal verdicts matched the manual oracle

Source: build/pipeline-runs/android/pipeline-report.json

Issues explain design choices

These issues do not answer the RQs directly, but they explain the final pipeline shape.

Issue Observed during implementation Design response

SUT and platform behaviour

iOS TextField cursor jumps, Android first-start screens, and password-manager prompts affected runtime stability.

Clean app state, explicit launch behaviour, and isolated manual oracle flows.

Grammar and diagnostics

Free-form descriptions could hide misspelled step keywords; ANTLR predicates coupled grammar to Java.

Keep grammar structural; move typo diagnostics into Kotlin validation.

Maestro validation feedback

Per-file CLI validation increased runtime; expected-fail flows look like failures in raw Maestro output.

Tag filtering, expected-status reporting, streamed logs, and per-flow evidence.

Selector acquisition

Some targets required scrolling; scrollUntilVisible behaviour depended on speed and current view state.

Represent acquisition strategies in AIM recipes, not in the grammar.

Execution environment

Parallel local Maestro runs could collide on emulator, simulator, and driver channels.

Serialize local S3 execution; treat scaling as device sharding or cloud infrastructure.

SUT = system under test · ANTLR = ANother Tool for Language Recognition

The contribution is a traceable compiler path

Readable intent stays separate

MobileBDD captures behaviour; AIM captures app-specific targets; Maestro YAML captures execution.

Evidence is staged

S1 and S2 check generation; S3 checks technical executability; S4 checks verdict-level agreement.

Reuse belongs at the behavioural-specification level, but correctness must still be checked at the automation level.

Four implementation artifacts support the compiler path

MBDD

MobileBDD language

A constrained Mobile Behaviour-Driven Domain language for readable interaction intent.

CLI

Transformation pipeline

A command-line compiler that turns MobileBDD scenarios into Maestro test flows.

LSP

Language Server

Editor diagnostics and feedback for grammar-level and validation-level constraints.

VS Code

Extension support

Tooling that supports interaction with the transformation pipeline from the editor.

The next step is broader evidence

The prototype establishes the path; the remaining work is mostly about scale, platforms, and robustness.

Restrictions

1Evaluation evidence is bounded to the available scenario corpus and reported platform runs.

2Execution stability still depends on app state, platform prompts, selectors, and device runtime conditions.

3The approach depends on explicit AIM recipes instead of automatic selector discovery.

Further research

1Extend the evaluation to more apps, larger corpora, and both mobile platforms.

2Investigate stronger acquisition strategies for selectors, scrolling, and runtime state.

3Study scalable execution infrastructure for repeated generated-vs-manual comparisons.

4Validate the approach with a target group of mobile developers and QA practitioners.

Thank you for your attention

Questions?

MobileBDD to MaestroA compiler path from behavioural scenarios to executable mobile UI test flows.