The pseudocode below describes the thesis contributions independently of MATE’s implementation. Names are kept close to the thesis terminology so the design can be reviewed without publishing the private experimental branch.
Supported recorded events are click, long click, scroll, and text input. Each event is translated into a framework action using stable UI metadata when available and coordinates as a fallback.
TRANSLATE(event):
reject event if its type is unsupported
if event contains an element:
read x, y, resource-id, class, text, adapter-index
else:
read gesture center x and y
if text is empty:
use the recorded input value
map:
CLICK -> CLICK
LONG_CLICK -> LONG_CLICK
TEXT_INPUT -> TYPE_TEXT
SCROLL UP -> SWIPE_UP
SCROLL DOWN -> SWIPE_DOWN
attach resource-id, class, text, adapter-index,
scroll distance, and direction
return primitive action
REPLAY_ALL(recording):
scenarios <- normalize recording into a list of scenarios
for each scenario:
reset application
enable replay-aware action resolution
test <- empty test case
for each recorded event:
action <- TRANSLATE(event)
execute action and append it to test
stop scenario if execution fails
disable replay-aware action resolution
collect fitness and coverage
finalize test
Replay-aware resolution first tries stable UI attributes such as resource ID, class, text, and adapter position. Recorded coordinates remain a fallback for cases where a live widget cannot be resolved.
Let s be the seed fraction and N the population size.
BUILD_SCHEDULE(s, N):
seeded_count <- clamp(round(s * N), 0, N)
schedule <- seeded_count times TRUE
followed by (N - seeded_count) times FALSE
shuffle schedule
return schedule
CREATE_INDIVIDUAL(schedule, max_actions):
rebuild schedule when a generation-sized schedule is exhausted
use_seed <- next schedule entry
reset application exactly once
test <- empty test case
if use_seed:
enable replay-aware action resolution
seed <- next trace in round-robin order
if every trace has already been used once:
keep a randomly selected prefix of seed
replay at most max_actions actions from seed
disable replay-aware action resolution
while test length < max_actions:
execute a random currently applicable action
collect fitness and coverage
finalize test
return test
The important design choice is that random padding happens in the same application session as replay. This allows exploration to continue from states reached by the human trace.
The recorded trace is represented as ordered segments:
segment = {
recorded event,
UI state before the event,
UI state after the event,
scenario identifier
}
For a screen state, visible widgets are converted into binary features composed from widget class, hierarchy depth, text or content description, and visibility. Cosine similarity is then computed over the two binary feature sets.
REPLAY_MUTATE(parent, tau, injection_probability):
reset application
child <- empty test case
injection_done <- FALSE
for each parent position:
current_state <- observe current UI
if not injection_done
and random() < injection_probability:
candidates <- all recorded segment starts whose
before-state similarity to current_state >= tau
if candidates is not empty:
start <- random candidate
budget <- remaining parent length
length <- random value within the same recorded scenario
and within budget
execute recorded segments [start, start + length)
injection_done <- TRUE
skip the replaced parent positions
continue
execute the next parent action
use applicable random actions as fallback on failure
fill any remaining action budget with random applicable actions
collect fitness and coverage
finalize child
return child
At the genetic-algorithm level, a separate replay probability selects between this operator and the framework’s classic cut-point mutation. This preserves an explicit exploration/exploitation trade-off.
mutation operator:
with probability replay_probability:
REPLAY_MUTATE(...)
otherwise:
CLASSIC_CUT_POINT_MUTATION(...)
inside REPLAY_MUTATE:
at each eligible parent position,
attempt injection with injection_probability
candidate eligibility:
cosine_similarity(current_UI, recorded_before_UI) >= tau
These are three distinct controls:
replay_probability: choose replay mutation versus classic mutation;injection_probability: attempt an injection at an eligible position; andtau: control how similar the live and recorded UI states must be.