<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Andrysunandar on Medium]]></title>
        <description><![CDATA[Stories by Andrysunandar on Medium]]></description>
        <link>https://medium.com/@andrysunandar?source=rss-7eb91054b83b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7n1k9CmLJH2YASsh</url>
            <title>Stories by Andrysunandar on Medium</title>
            <link>https://medium.com/@andrysunandar?source=rss-7eb91054b83b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 22:44:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andrysunandar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Agentic AI for Mobile Test Automation with Maestro Dev, Part 5: Stable Test]]></title>
            <link>https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-d29800ef0a67?source=rss-7eb91054b83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d29800ef0a67</guid>
            <category><![CDATA[qa-testing]]></category>
            <category><![CDATA[maestros]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[qa-automation]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Andrysunandar]]></dc:creator>
            <pubDate>Thu, 20 Aug 2026 21:40:41 GMT</pubDate>
            <atom:updated>2026-08-20T21:44:40.887Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 5: Stable Test — Keeping It Working Past Month Three</h3><p>Every AI tooling demo works on day one. The interesting question is what it looks like in week twelve, after the novelty has worn off and the thing has been quietly making decisions in the background.</p><p>This closes the series. Parts <a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397">1</a> through 4 built an agent that reads screens, writes Maestro flows, and repairs them when they drift. This part is about the habits that keep it honest.</p><h3>The boundary, one last time</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YAhYUIVU05ghzrzes4xpwA.png" /><figcaption><em>Figure 1. The only thing crossing between authoring and CI is a YAML file.</em></figcaption></figure><p>I’ve restated this in every part, and I’m restating it again because it’s the discipline that erodes first. It never erodes deliberately. It erodes as a series of individually reasonable shortcuts: a quick heal during a nightly run to unblock a release, a temporary flag, a “just this once.”</p><p>Two mechanical defences, worth more than good intentions:</p><p><strong>Separate directories.</strong> The agent’s working directory is not the directory CI reads from. Promotion between them is an explicit commit, reviewed by a person.</p><p><strong>No model credentials in CI.</strong> If the CI environment has no OPENAI_BASE_URL, the shortcut isn&#39;t available to take. Constraints beat discipline.</p><h3>Watch how often each flow gets healed</h3><p>A single heal is normal — apps change. The signal isn’t in individual repairs, it’s in the pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hvfN9Qp5LVYXCd6HQdTaRA.png" /><figcaption><em>Figure 2. Repeated healing of the same flow is a signal about the app, not the test.</em></figcaption></figure><p>Keep a counter per flow. When one crosses three heals in a month, stop patching and look at why.</p><p>Almost always the answer is the same: that screen has no stable test identifiers, so every selector is anchored to something incidental — visible text, an auto-generated ID, a position. Each patch reattaches to another incidental thing, and the cycle repeats.</p><p>The fix isn’t a better agent. It’s a conversation with your developers, asking for a testTag or an accessibilityIdentifier on the elements your journeys depend on. That&#39;s usually a small change and it permanently ends a recurring cost.</p><p><strong>This is the most valuable output of the whole system, and it’s easy to miss.</strong> The heal counter is a map of where your app is hostile to testing. Without it you just feel vaguely like maintenance is heavy. With it, you can point at three screens and make a specific request.</p><h3>Version the prompt like code</h3><p>Your system prompt encodes real decisions: the selector ladder from Part 3, the classification rules from Part 4, your pruning thresholds. It is configuration, and it will drift.</p><p>Keep it in the repository next to the flows. When you change it, commit the change with a reason. When flow quality shifts, you’ll want to know whether the prompt moved.</p><p>Pin the model too — the exact quantization, not just “Qwen3 Coder 30B.” A different quant produces measurably different output, and “we upgraded the model” is a plausible explanation for a quality change you’d otherwise chase through your pruning code for a day.</p><h3>Keep measuring the number that matters</h3><p>Part 2 introduced YAML validity rate: give the model the same hierarchy dump twenty times, count how many responses parse as valid Maestro flows. Run it monthly against a fixed set of dumps.</p><p>It’s the canary. When it drops, something changed — a prompt edit, a model update, an app redesign that made hierarchies harder to read. Catching that as a number is much better than catching it as a slow accumulation of frustration.</p><h3>What this does and doesn’t do</h3><p>An honest accounting, now that the whole picture is assembled.</p><p><strong>What it genuinely gives you.</strong> Faster authoring of long, unfamiliar journeys. Selector drift handled without a human reading XML. A structured diagnosis when something breaks, instead of a stack trace. And that map of which screens are hostile to testing.</p><p><strong>What it doesn’t.</strong> It doesn’t write your test strategy — deciding what’s worth testing remains entirely yours. It doesn’t test what it can’t see: no visual regression, no performance, no accessibility auditing. It doesn’t replace exploratory testing, which is about curiosity rather than repetition. And it doesn’t remove the need to understand Maestro; when the agent proposes something wrong, you need to know why.</p><p>The honest summary is that this is a power tool for a specific chore. Maintenance of selector-based flows was a real cost, and it’s now much smaller. Everything else about testing is unchanged.</p><h3>If you’re starting from zero</h3><p>The order that works, in rough time:</p><p>Get Maestro running by hand first. Write ten flows yourself — you need to know what good YAML looks like before you can judge generated YAML. Then stand up the model and measure it. Then add MCP, and author one flow with the agent watching closely. Then enable healing, reviewing every patch by hand for the first month.</p><p>Only after that should you let it run with lighter supervision, and only for flows you’ve seen it handle.</p><p>The failure mode I’d warn against: wiring the whole thing up in a weekend, letting it author thirty flows, and discovering in month two that half of them target fragile selectors you’d never have chosen. Undoing that costs more than the agent saved.</p><h3>The last thing</h3><p>The instinct with agentic tooling is to give it more autonomy over time. Resist that here.</p><p>The value in this setup isn’t that the agent works unsupervised. It’s that it does the tedious, mechanical parts of test maintenance — reading trees, matching elements, drafting YAML — while you keep every decision that determines whether the suite is trustworthy.</p><p>An agent that authors flows and reports failures is a genuine improvement over doing it yourself. An agent that silently keeps your suite green is a liability wearing the costume of one.</p><p>Keep it on the authoring side of the line.</p><p><em>Series: </em><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397"><em>Part 1 — Why Maestro</em></a><em> · </em><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-9137cf4d5b47?sharedUserId=andrysunandar"><em>Part 2 — The Local Stack </em></a><em>· </em><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-part-3-wiring-the-agent-mcp-5881610eee73?sharedUserId=andrysunandar"><em>Part 3 — Wiring the Agent</em></a><em> · </em><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-part-4-self-healing-34344eaf37d5?sharedUserId=andrysunandar"><em>Part 4 — Self-Healing</em></a><em> · Part 5 — Production Discipline</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d29800ef0a67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI for Mobile Test Automation with Maestro Dev, Part 4: Self-Healing]]></title>
            <link>https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-part-4-self-healing-34344eaf37d5?source=rss-7eb91054b83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/34344eaf37d5</guid>
            <category><![CDATA[maestros]]></category>
            <category><![CDATA[qa-automation]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[qa-testing]]></category>
            <dc:creator><![CDATA[Andrysunandar]]></dc:creator>
            <pubDate>Thu, 20 Aug 2026 21:34:12 GMT</pubDate>
            <atom:updated>2026-08-20T21:34:12.596Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 4: Self-Healing, Done Carefully</h3><p>A test that used to pass has started failing. Something changed — but what?</p><p>That question is the entire subject of this article, and getting it wrong in one specific way is worse than having no automation at all.</p><p>Parts <a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397">1</a> through 3 built the machinery: Maestro, a local model, and an agent wired through MCP that can read a screen and write a flow. Now we point it at maintenance, which is where the actual cost lives.</p><h3>The loop</h3><p>Self-healing is the same authoring loop from Part 3 with one branch added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiEG7TbyjBd2nnpSK_UKbw.png" /><figcaption><em>Figure 1. The authoring loop, with the diagnosis branch that makes it self-healing.</em></figcaption></figure><p>The green path is unremarkable. The interesting question is what happens on the left branch, and the answer is not “ask the model to fix it.”</p><h3>Four causes, not one</h3><p>“The test failed” is not a diagnosis. There are four distinct things that produce a red flow, and they want four different responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SEFxLRNXegQFtvliO9H-mA.png" /><figcaption><em>Figure 2. Classifying a failure before attempting to repair it.</em></figcaption></figure><p><strong>Selector drift.</strong> A developer renamed checkout_button to cta_primary. The element exists, does the same thing, answers to a different name. Fetch a fresh hierarchy, find the semantic match, update the selector. This is the case self-healing was invented for and the agent handles it well.</p><p><strong>Timing.</strong> The element arrives, just later than the flow expected — a slow API call, an animation, a lazy-loaded list. Maestro absorbs most of this automatically, but not all. The fix is an explicit wait, not a selector change.</p><p><strong>An OS dialog.</strong> A permission prompt, an OS update banner, a biometric sheet. Nothing is wrong with your app or your test; something is sitting on top of both. The fix is a handler for the interruption.</p><p><strong>A genuine app bug.</strong> The element is gone because it’s broken.</p><p>That fourth case is the one everything hinges on.</p><h3>The failure mode that matters</h3><p>Picture it concretely. A bug ships that removes the checkout button from the cart screen. Your flow fails. Your agent dutifully reads the new hierarchy, notices there’s no checkout_button, finds a plausible-looking continue_button nearby, and updates the selector.</p><p>The suite goes green. Nobody is told. The bug reaches production.</p><p><strong>Self-healing that can’t recognize a real bug is a mechanism for hiding real bugs.</strong> That’s not a minor risk to manage — it’s an inversion of the entire purpose of having tests.</p><p>So the classification rule needs to be explicit in your system prompt, not left to the model’s judgment:</p><ul><li>The element is missing <strong>and</strong> no semantically equivalent element exists → app bug. Stop. Report. Do not repair.</li><li>The element is missing but something clearly equivalent is present under a different identifier → selector drift. Propose a patch.</li><li>The element appears after waiting → timing. Add a wait.</li><li>Something unexpected is covering the screen → interruption. Add a handler.</li></ul><p>Note where the burden of proof sits. The default is <em>stop and report</em>. Repair requires positive evidence that an equivalent element exists. Build it the other way around — repair by default, stop only when confused — and you’ve built the bug-hiding machine.</p><p><strong>“Semantically equivalent” is the load-bearing phrase</strong>, and it needs to be strict. Same function, same position in the journey, same visible purpose. A button that happens to be nearby does not qualify. When in doubt, the agent should escalate rather than guess, and you should tune it toward escalating too often rather than too rarely.</p><h3>Three iterations, then stop</h3><p>The retry limit in Figure 2 is not arbitrary.</p><p>A 30B model that has failed to fix something twice will usually fail a third time in the same way. It doesn’t have new information between attempts, so it re-derives the same reasoning and produces a near-identical patch. Left unbounded, you get ten minutes of inference producing nothing, and on this hardware that’s ten minutes you notice.</p><p>Three attempts is enough to cover the cases where the second dump reveals something the first didn’t. Past that, a human is faster.</p><p>Make the escalation message useful. Not “healing failed” but: what the flow expected, what the hierarchy actually contained, which patches were attempted, and why each was rejected. That report should be enough to diagnose the problem without reproducing it — and if you find yourself reproducing it anyway, the report format needs work.</p><h3>Patches, not rewrites</h3><p>The agent proposes a diff. It does not silently rewrite the file.</p><p>This matters for a reason that isn’t obvious until you’ve lost it: <strong>without diffs, you lose the history of why your tests look the way they do.</strong> Six months in, a flow has been healed a dozen times, and nobody can tell whether the current selector is deliberate or the residue of an agent’s guess in March.</p><p>Commit healing patches as ordinary commits, with the diagnosis in the message. Your git history then answers the question “why does this flow use this selector,” which is a question you will eventually ask.</p><h3>What the agent never touches</h3><p>One boundary, restated because it’s the one people erode gradually.</p><p>Self-healing runs in authoring mode. Never in CI.</p><p>The temptation is real — a nightly run that repairs itself sounds like the whole point. But an agent that can edit tests during a regression run destroys the meaning of a green build. Did the app pass, or did the model paper over a failure while you slept? You can’t tell, and a signal you can’t trust is worse than no signal, because you’ll act on it.</p><p>The workable version: CI fails normally and reports. Healing happens afterward, in authoring mode, with a human reviewing the diff. Slower by a few hours. Still trustworthy.</p><h3>Coming in Part 5</h3><p>The habits that keep this working past month three: tracking which flows get healed repeatedly, knowing when the right answer is a conversation with your developers rather than another patch, and the small governance details that stop an agent from quietly degrading your suite.</p><p><em>Previous: </em><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397"><em>Part 1</em></a><em> · Part 2 — The Local Stack · Part 3 — Wiring the Agent</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34344eaf37d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI for Mobile Test Automation with Maestro Dev, Part 3: Wiring the Agent — MCP]]></title>
            <link>https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-part-3-wiring-the-agent-mcp-5881610eee73?source=rss-7eb91054b83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5881610eee73</guid>
            <category><![CDATA[ui-automation-testing]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Andrysunandar]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 09:15:44 GMT</pubDate>
            <atom:updated>2026-08-19T09:15:44.755Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 3: Wiring the Agent — MCP, the Authoring Cycle, and the Pruning Problem</h3><p><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397">Part 1</a> covered why Maestro and why an agent. Part 2 covered the model and how to serve it across two machines. This part connects them.</p><p>Most of what follows is straightforward plumbing. One piece isn’t, and it’s the piece that quietly kills homegrown setups: deciding what the model is allowed to see.</p><h3>The connection, in one picture</h3><p>Maestro ships an MCP server. That’s the whole integration story — you don’t write a driver, you don’t parse XML yourself, you don’t maintain a translation layer between the model and the device.</p><p>Here is what one authoring cycle actually looks like on the wire.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hxSD7X_sN8NBvGk8H9Jmng.png" /><figcaption><em>Figure 1. One authoring cycle, from the agent’s first call to the returned artifacts.</em></figcaption></figure><p>Read it left to right and the division of labour is clear. The agent never touches the device. It asks the MCP server for things, the MCP server translates those requests into Maestro commands, Maestro talks to the device, and results flow back the same way.</p><p>Two details in that sequence deserve attention.</p><p><strong>The agent’s first move is a read, not a write.</strong> It launches the app and asks what’s on screen before proposing anything. An agent that generates a flow from the app description alone will invent selectors, every time.</p><p><strong>The fifth arrow says “pruned element tree,” not “hierarchy.”</strong> That word is the subject of the second half of this article.</p><h3>Getting it connected</h3><p>The MCP server is exposed through the Maestro CLI on your Mac mini. Your agent client — whichever one you use — needs a config entry pointing at it, and the model endpoint from Part 2 pointing at your PC.</p><p>The shape of the config is the standard MCP one:</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;maestro&quot;: {<br>      &quot;command&quot;: &quot;maestro&quot;,<br>      &quot;args&quot;: [&quot;mcp&quot;]<br>    }<br>  }<br>}</pre><p>Check Maestro’s current documentation for the exact invocation — this is the part of the stack that has moved most, and a version mismatch produces a confusing “server not found” rather than a useful error.</p><p>Verify the device connection independently before you involve the model at all:</p><pre>maestro test flows/smoke.yaml</pre><p>If that runs, the MCP layer will run. If it doesn’t, you’re debugging adb or simulator setup, not AI.</p><p><strong>Order matters here.</strong> Get Maestro working manually, then add MCP, then add the model. Every step you skip becomes a step you have to bisect later, and a failure three layers deep looks identical to a failure one layer deep when you’re staring at “the agent didn’t do anything.”</p><h3>The pruning problem</h3><p>Now the part that matters.</p><p>A real Android accessibility dump for a moderately complex screen runs 8,000 to 15,000 tokens. iOS dumps are worse — XCUITest hierarchies are verbose, deeply nested, and full of container nodes that exist for layout reasons and have no bearing on anything a test would touch.</p><p>Your context window is 16,384 tokens. Do the arithmetic: one raw dump consumes most of it, leaving nothing for the system prompt, the task description, the conversation history, or the model’s output. And an authoring cycle needs <em>several</em> dumps — one per screen the flow traverses.</p><p>So the dump has to shrink. The question is what to throw away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vY0Am9yvBW8BZBVxU15PZw.png" /><figcaption><em>Figure 2. Four filtering stages take a raw dump from roughly 12,000 tokens to about 800.</em></figcaption></figure><p>The stages, in order of how much they save:</p><p><strong>Drop non-interactive nodes.</strong> Layout containers, spacers, decorative views. If a node isn’t clickable, focusable, or text-bearing, a test can’t act on it. This alone typically removes two-thirds of a dump.</p><p><strong>Drop what isn’t visible.</strong> Offscreen elements, nodes with zero bounds, anything behind a modal. These are real elements the model could legitimately reference, and referencing them produces a flow that fails on the device — the worst kind of wrong, because it looks right when you read it.</p><p><strong>Drop attributes you don’t use.</strong> A raw node carries a dozen attributes. Maestro selectors need identifier, text, accessibility label, and bounds. Everything else is noise consuming tokens.</p><p><strong>Flatten the nesting.</strong> Deep hierarchies burn tokens on structure. A flat list of actionable elements with their identifiers is easier for the model to work with and dramatically cheaper.</p><p>What comes out the other side looks roughly like this:</p><pre>[button] id=checkout_button  text=&quot;Place order&quot;  visible<br>[input]  id=promo_field      label=&quot;Promo code&quot;  visible<br>[text]   text=&quot;Subtotal $42.00&quot;                  visible<br>[button] id=nav_back         label=&quot;Back&quot;        visible</pre><p>Four lines instead of four hundred. Every element a test could plausibly target, nothing else.</p><h3>Why this matters more than the model</h3><p>Here’s the failure mode that makes pruning worth an entire section.</p><p>When a dump overflows the context, it doesn’t error. It truncates. The model receives the top of the tree and none of the bottom, and — critically — <strong>it has no way to know something is missing.</strong> So it does what a helpful model does: it produces a confident, well-formed, completely wrong selector for an element it never saw.</p><p>You then spend an afternoon concluding the model isn’t good enough for this task. It was fine. You fed it half a screen.</p><p>Two defences:</p><p><strong>Log the token count of every dump you send.</strong> If it’s near your context limit, your pruning is too permissive. This is a one-line check that saves hours.</p><p><strong>Fail loudly on truncation.</strong> If the pruned dump still exceeds budget, stop and say so rather than sending it anyway. A clear error beats a plausible hallucination.</p><h3>Which selectors to ask for</h3><p>Pruning decides what the model can see. Your system prompt decides what it reaches for. These are different problems and the second one is where flow durability comes from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z0d5B8_v3yb1W52aTQrVBg.png" /><figcaption><em>Figure 3. Selector stability, from most durable to most fragile.</em></figcaption></figure><p>Encode this ladder in your system prompt explicitly — tell the model to prefer identifiers over labels, labels over visible text, and never to use positional selectors. A model left to its own devices will often grab visible text, because it’s the most semantically obvious thing on the screen. It’s also the thing that breaks the moment someone ships a translation.</p><p>The top rung is worth pushing for. If your app has no stable test identifiers, every flow you write is one refactor away from breaking, and no amount of agent cleverness fixes that. Which is a conversation with your developers, not a technical problem — and it’s where Part 5 ends up.</p><h3>A realistic first session</h3><p>Set expectations for what this feels like when it works.</p><p>You describe a journey in a sentence or two. The agent launches the app, reads the screen, proposes a few steps, runs them, hits a screen it didn’t expect, reads again, adjusts. Two or three minutes of back-and-forth per flow, most of it waiting on inference.</p><p>That’s slower than writing simple YAML by hand. For a login flow, you’d be faster yourself.</p><p>Where it wins is the long tail — the eleven-step checkout journey through screens you don’t have memorized, where finding the right identifiers is most of the work. The agent reads the tree faster than you can scroll through maestro studio, and it doesn&#39;t get bored on step nine.</p><p>Keep maestro studio open alongside anyway. When the agent proposes something odd, checking the live hierarchy yourself is usually faster than asking the model to explain itself.</p><h3>Coming in Part 4</h3><p>Self-healing: what happens when a flow that used to pass stops passing. Classifying a failure into selector drift, timing, an OS dialog, or a genuine app bug — and why that last category is the one you must get right.</p><p>An agent that heals the wrong thing is worse than an agent that heals nothing.</p><p><em>Previous: </em><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397"><em>Part 1</em></a><em> · Part 2 — The Local Stack</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5881610eee73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI Mobile Testing with Maestro, Part 2: The Local Stack]]></title>
            <link>https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-9137cf4d5b47?source=rss-7eb91054b83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9137cf4d5b47</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[automated-ui-testing]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[llm-agent]]></category>
            <dc:creator><![CDATA[Andrysunandar]]></dc:creator>
            <pubDate>Tue, 18 Aug 2026 21:54:39 GMT</pubDate>
            <atom:updated>2026-08-18T21:56:30.481Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 2: The Local Stack — Running a Capable Model on Hardware You Already Own</h3><p>In <a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397">Part 1</a> I argued that Maestro solves flakiness but not maintenance, and that an agent can attack the maintenance bill — as long as you keep it strictly on the authoring side and never let it touch a regression run.</p><p>This part is about the machine underneath. Which model, why that one, how to serve it across two computers, and the one architectural decision that determines whether any of this is affordable on ordinary hardware.</p><p>Short version: you need far less GPU than you think, because you’re not doing computer vision.</p><h3>The constraint isn’t the one you expect</h3><p>My GPU is an RTX 3050 with 4GB of VRAM. That is not a serious inference card. If you’d asked me a couple of years ago whether it could host a useful coding agent, the answer would have been no.</p><p>The reason it can now is that <strong>VRAM is a speed constraint, not a capacity ceiling.</strong> Modern local runtimes — llama.cpp, and LM Studio which wraps it — will split a model across GPU and system RAM. The layers that fit on the GPU run fast; the rest run on the CPU. You don’t get an out-of-memory error, you get a slower model.</p><p>Which reframes the whole question. With 32GB of system RAM, the ceiling isn’t 4GB. It’s closer to 24GB once you leave room for the operating system. The real question is how to spend that 24GB without ending up with something too slow to use.</p><h3>Why mixture-of-experts changes the math</h3><p>A dense model activates every parameter for every token it generates. A 30-billion-parameter dense model does 30 billion parameters’ worth of arithmetic per token, and on a CPU that is agonizing — you’ll measure output in seconds per token, not tokens per second.</p><p>A mixture-of-experts model separates two things that dense models conflate: how much memory it occupies, and how much compute it does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HfYWwo8TnLPLjI73uuaX6w.png" /><figcaption><em>Figure 1. Dense and MoE models of the same size occupy similar memory but differ tenfold in compute per token.</em></figcaption></figure><p>Qwen3–30B-A3B is the concrete example. Thirty billion parameters total, of which roughly three billion are active for any given token. The file on disk is the same size as a dense 30B. The arithmetic per token is a tenth of it.</p><p>That combination — large memory footprint, small compute footprint — is exactly backwards from what most hardware wants, and exactly right for a machine with plenty of slow RAM and little fast VRAM. It’s the difference between a model that’s unusable on CPU and one that keeps up with your typing.</p><p>The practical consequence: on this hardware, a 30B MoE model is <em>faster</em> than a 14B dense model, while being meaningfully more capable. That’s a genuinely unusual tradeoff and it’s the single biggest reason this setup works at all.</p><h3>Picking among the variants</h3><p>Search LM Studio for “Qwen3–30B” and you’ll get several results that look nearly identical. They aren’t.</p><p><strong>Qwen3 Coder 30B</strong> is what I run, and it’s the right default for this job. Our workload is almost entirely structured generation: emit valid Maestro YAML, call MCP tools with well-formed arguments, don’t invent selector syntax that doesn’t exist. Coder-tuned models are noticeably more disciplined about staying inside a schema, and schema discipline matters more here than eloquence. It also has the long context you’ll need once accessibility dumps start arriving.</p><p><strong>Qwen3–30B-A3B-2507</strong> is the general-purpose instruct refresh and a fine alternative. If you find the Coder variant too terse — or too eager to answer a plain question with code — switch to this. It writes better failure explanations.</p><p><strong>Qwen3 VL 30B</strong> adds vision. Tempting, and we’ll come back to why I don’t use it.</p><p><strong>The original Qwen3–30B-A3B</strong> (the older release) has been superseded by the 2507 split. No reason to pick it now.</p><p>On quantization: <strong>Q4_K_M</strong>, around 18GB. LM Studio will happily offer Q6 and Q8 versions that technically load and then spill to disk, at which point throughput collapses. The quality difference between Q4_K_M and Q8 for structured text generation is small; the speed difference between “fits in RAM” and “doesn’t” is not.</p><h3>The memory budget</h3><p>Here’s how 32GB actually gets spent on the inference machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xMRZMSwnQKlhnuP6akpgQA.png" /><figcaption><em>Figure 2. How 32 GB is spent on the inference machine.</em></figcaption></figure><p>The KV cache line is the one people forget. It grows with context length, and in this workload context gets large — a full iOS accessibility dump can run past 10,000 tokens on its own. Budget for it explicitly rather than discovering it when your machine starts swapping.</p><p>Set context length deliberately in LM Studio’s load settings. 16,384 is a reasonable starting point. The default is often lower, and a truncated hierarchy is worse than no hierarchy: the model doesn’t know it’s missing the bottom of the tree, so it confidently produces a selector for an element it never saw. That failure looks like a model quality problem and isn’t.</p><p>This budget also explains why the machines are split. There is no room in it for an iOS simulator, Xcode, and a JVM. Those live on the Mac mini.</p><h3>Serving it across the network</h3><p>LM Studio exposes an OpenAI-compatible API. Three things to get right.</p><p><strong>Enable network serving.</strong> By default the server binds to localhost only, which means the Mac mini can’t reach it. There’s a toggle for serving on the local network in the server settings. This is the single most common reason people’s first connection attempt fails.</p><p><strong>Give the PC a fixed address.</strong> Static IP or a DHCP reservation on your router. Otherwise the endpoint moves whenever the lease renews, and the resulting failure looks confusingly like the model misbehaving.</p><p><strong>Verify from the Mac before wiring anything up:</strong></p><pre>curl http://192.168.1.50:1234/v1/models</pre><p>If that returns JSON listing your loaded model, you’re done. If it hangs, it’s the localhost binding. If it’s refused, it’s a firewall rule on the PC.</p><p>Point your agent at it with the standard environment variables:</p><pre>export OPENAI_BASE_URL=&quot;http://192.168.1.50:1234/v1&quot;<br>export OPENAI_API_KEY=&quot;not-used-but-required&quot;</pre><p>LM Studio ignores the key, but most client libraries refuse to start without a non-empty value.</p><p>One security note worth stating plainly: <strong>this endpoint has no authentication.</strong> Anyone who can reach that IP can use your model. Keep it on your LAN, and do not port-forward it. If you need remote access, put it behind a VPN rather than exposing the port.</p><p>The latency of the network hop is irrelevant, by the way. A LAN round trip is single-digit milliseconds against inference times measured in seconds. Wired Ethernet is still worth it for stability, not speed.</p><h3>Why not a vision model</h3><p>This is the decision that saves you the most hardware, and it’s worth being explicit about the reasoning, because the instinct runs the other way.</p><p>The obvious design for a UI agent is: screenshot in, tap coordinates out. It demos beautifully. For test automation it’s the wrong architecture on three separate counts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bbwYBuauqCejEQRnskuzVQ.png" /><figcaption><em>Figure 3. The screenshot path costs more and returns less than the accessibility tree path</em></figcaption></figure><p><strong>Token cost.</strong> A phone screenshot becomes on the order of 1,600 vision tokens. A pruned accessibility tree covering the same screen is roughly half that, and it compresses far better because most of a UI tree is repetitive structure.</p><p><strong>Prefill cost.</strong> This is the killer on CPU. Generating text is cheap per token; processing an image up front is not. On this hardware, prefilling a screenshot takes tens of seconds. Tolerable once, for a manual “why did this fail” question. Useless inside a loop that runs it every step.</p><p><strong>Output quality.</strong> A vision model returns coordinates — a guess about where to tap. An accessibility tree returns identifiers. Maestro selectors resolve against identifiers, so the tree path produces exactly the artifact you need, while the vision path produces something you’d have to translate and that breaks the moment the layout shifts.</p><p>There’s a fourth reason that matters more than the others combined: <strong>coordinates aren’t reviewable.</strong> When your agent proposes tapOn: {id: &quot;checkout_button&quot;}, you can read that and judge whether it&#39;s right. When it proposes tapping pixel (540, 1832), you cannot.</p><p>Vision has one legitimate role here — a manual escalation when the hierarchy genuinely doesn’t explain a failure, which happens with canvas-rendered UIs and some games. Keep a small VL model around for that if you like. Just keep it out of the automated path.</p><h3>What to measure before you continue</h3><p>Before wiring up MCP in Part 3, get a baseline. Three numbers, ten minutes:</p><p><strong>Generation speed.</strong> Tokens per second on a plain prompt. If you’re below about 8, revisit your GPU offload layer count — push it up until you hit an out-of-memory error, then back off two.</p><p><strong>Time to first token</strong> with a realistic context. Paste a 5,000-token blob of XML in front of your prompt and time it. This is what every authoring cycle will pay, and it’s the number that determines whether the loop feels workable.</p><p><strong>YAML validity rate.</strong> The one that actually predicts success. Give the model the same hierarchy dump twenty times and ask for a flow. Count how many parse as valid YAML with real Maestro commands. Below roughly 80%, you’ll spend more time correcting the agent than writing flows yourself — try the Coder variant if you weren’t already, raise the context length, or tighten your system prompt before going further.</p><p>That last metric is worth more than any benchmark score you’ll read online, because it measures the only thing you need this model to do.</p><h3>Coming in Part 3</h3><p>Wiring the agent to Maestro through MCP: the full sequence of calls in one authoring cycle, and the implementation detail that matters most — how to prune a hierarchy dump down to something a 16k context can hold without losing the elements you actually need.</p><p>That pruning step is where most homegrown setups quietly fail, and it has almost nothing to do with the model.</p><p><em>Previous: </em><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397"><em>Part 1 — Why Maestro, and Why an Agent Changes the Math</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9137cf4d5b47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI for Mobile Test Automation with Maestro Dev, Part 1: Why Maestro]]></title>
            <link>https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-f87abf02f397?source=rss-7eb91054b83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f87abf02f397</guid>
            <category><![CDATA[mobile-testing-tools]]></category>
            <category><![CDATA[ui-test-automation]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Andrysunandar]]></dc:creator>
            <pubDate>Tue, 18 Aug 2026 04:18:05 GMT</pubDate>
            <atom:updated>2026-08-20T21:46:26.204Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 1: Why Maestro?</h3><p>Every mobile QA team eventually hits the same wall. Not writing tests — writing tests is fine. The wall is <em>keeping</em> them.</p><p>A designer moves a button. A developer renames a view ID. An A/B test swaps the checkout screen for half your users. None of these are bugs, but every one of them turns your suite red, and someone has to spend Tuesday morning figuring out which failures are real.</p><p>This series is about attacking that maintenance bill with a local AI agent driving Maestro. Not “AI writes your tests and you go home” — that’s a demo, not a workflow. Something more useful: an agent that reads your app’s actual UI, drafts flows, and diagnoses failures, while you keep the parts that need judgment.</p><p>Part 1 covers the foundation: what Maestro is, how it stacks up against the alternatives, and where an agent genuinely helps versus where it just adds a new thing to debug.</p><h3>What Maestro actually is</h3><p>Maestro is an open-source mobile UI testing framework from Mobile Dev Inc., first released in July 2022 and licensed under Apache 2.0. Tests are plain YAML files. No compilation step, no client library, no driver matrix.</p><p>Here’s a complete, runnable login test:</p><pre>appId: com.example.myapp<br>---<br>- launchApp<br>- tapOn: &quot;Sign in&quot;<br>- tapOn:<br>    id: &quot;email_field&quot;<br>- inputText: &quot;user@example.com&quot;<br>- tapOn:<br>    id: &quot;password_field&quot;<br>- inputText: &quot;hunter2&quot;<br>- tapOn: &quot;Continue&quot;<br>- assertVisible: &quot;Welcome back&quot;</pre><p>That’s it. That file runs on Android and iOS unchanged.</p><p>Two things about this deserve more attention than they usually get.</p><p><strong>Your product manager can read it.</strong> This sounds like a soft benefit until you’ve sat in a bug triage where nobody in the room can tell what the failing test was actually checking. When tests are readable YAML, the person who wrote the acceptance criteria can verify the test matches them.</p><p><strong>There are no explicit waits.</strong> This is the design decision Maestro is really built around. Mobile UIs are unstable — animations, network calls, lazy-loaded content — and Maestro treats that instability as the framework’s problem rather than yours. It waits for content, retries taps, and tolerates minor UI shifts automatically. Anyone who has scattered Thread.sleep(2000) through an Appium suite and watched it fail anyway will recognize what&#39;s being solved here.</p><h3>How it compares</h3><h3>Against Appium</h3><p>Appium is the decade-old standard, and the honest framing is that these two tools sit at opposite ends of the same problem.</p><p>Appium is language-agnostic and enormously flexible. You write tests in Java, Python, JavaScript, Ruby — whatever your team knows. It reaches platforms Maestro doesn’t touch, and it plugs into mature Selenium Grid infrastructure and every major device farm. If you need custom gestures, deep device access, or an exotic platform, Appium is where you’ll end up.</p><p>What you pay for that flexibility is responsibility. Appium hands you the controls and expects you to teach the test when to wait, when to retry, and how to stay stable. That work never ends, and it’s where most Appium suites go to die.</p><p>Maestro takes that responsibility off your plate and gives up flexibility in return. Setup is minutes rather than days — a single binary, no driver configuration. Maestro’s own published figures put a typical checkout flow at 12–18 seconds versus 30–45 for Appium, and flakiness below 1%. Treat those as vendor numbers and benchmark your own app, but the direction is consistent with what teams report independently.</p><h3>Against Espresso and XCUITest</h3><p>These are the native options, and they’re genuinely excellent at what they do: fast, reliable, with deep access to the app’s internals because they run inside the app process.</p><p>The cost is that you maintain two entirely separate suites. Espresso in Kotlin, XCUITest in Swift, written by developers, living in the app repositories, requiring a build to run. Your QA engineers can’t touch them. Your test coverage for Android and iOS drifts apart over time because they’re written by different people at different moments.</p><p>Maestro’s pitch is one flow, both platforms, readable by anyone. You lose the white-box access — you can’t reach into the app and stub a repository — but for end-to-end user journeys, you rarely want to.</p><h3>Against Detox</h3><p>Detox is the React Native specialist, and if you ship a React Native app it deserves serious consideration. Its gray-box architecture — it knows when the app is idle rather than guessing — makes it fast and reliably synchronized, and reported flakiness is low.</p><p>The catch is scope. Detox requires instrumenting your app, and it’s built for React Native specifically. Maestro handles React Native too, alongside native, Flutter, and hybrid stacks, without instrumentation. If React Native is your only target, Detox is arguably tighter. If you have a mixed portfolio, Maestro covers more of it with one skill set.</p><h3>Where Maestro genuinely hurts</h3><p>Any comparison that doesn’t include this section is marketing.</p><p><strong>Complex logic gets ugly in YAML.</strong> Conditionals, loops, branching scenarios, dynamic test data — these don’t map cleanly to a declarative format. Maestro lets you drop into JavaScript when you need real logic, which helps, but a flow with heavy branching is harder to read than the equivalent Kotlin. The readability advantage is real for straightforward journeys and erodes as complexity climbs.</p><p><strong>You hit walls at the edges.</strong> The abstraction that makes simple cases effortless means unusual requirements — custom multi-finger gestures, deep device state manipulation, integration with niche tooling — may simply not be reachable.</p><p><strong>The ecosystem is younger.</strong> Fewer Stack Overflow answers, fewer third-party plugins, thinner documentation coverage of edge cases. Appium has roughly twice the GitHub stars and a decade more accumulated answers.</p><p><strong>iOS physical devices are a real constraint.</strong> Maestro’s iOS support is simulator-based; physical iOS devices are not natively supported for local testing. Plan your device strategy around this before you commit.</p><p><strong>And the big one: selectors still break.</strong> This is the point that matters most for this series. Maestro reduces flakiness dramatically — the timing kind, the animation kind, the “the tap didn’t register” kind. What it does not do is update your test when a developer renames checkout_button to cta_primary. A human still authors every flow and repairs it whenever the UI moves.</p><p>That remaining bill is exactly what an agent can attack.</p><h3>Where the agent comes in</h3><p>Here’s the part people get wrong. The instinct is to build an AI that watches the screen and taps pixels like a human tester. That’s the flashiest demo and the worst architecture for testing, for one reason: a model that re-decides every step at runtime is non-deterministic, and non-determinism is the opposite of what a regression suite is for.</p><p>The design that actually works separates two modes.</p><p><strong>Authoring mode</strong> has the agent in it. The agent reads the live view hierarchy — the accessibility tree, as text, not screenshots — drafts a flow, runs it, and iterates when it fails. Slow, exploratory, human in the loop. This is where the AI earns its keep.</p><p><strong>Execution mode</strong> has no agent at all. It runs the YAML that authoring mode produced. Deterministic, fast, identical every time. This is what runs in CI.</p><p>The only thing crossing the boundary is a YAML file. Not a model, not a prompt, not an MCP connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*YAhYUIVU05ghzrzes4xpwA.png" /><figcaption>Figure 1. Authoring mode contains the LLM; CI mode does not. Only the YAML file crosses between them.</figcaption></figure><p>Why this matters: if the agent can modify tests during a CI run, a red build becomes ambiguous. Did the app break, or did the model have an off day? You’ve replaced a trustworthy signal with a coin flip that’s always green. Self-healing belongs in authoring, never in regression.</p><p>Maestro makes this architecture unusually easy, because it ships an MCP server. A coding agent can query the view hierarchy, take screenshots, and generate flow YAML directly — no manual hunting for element IDs, no writing a custom integration layer.</p><p>And crucially, because Maestro selectors resolve against the accessibility tree, the agent’s job is text in, text out. That means it does not need an expensive vision model — no screenshots, no pixel coordinates, no 40GB of VRAM. A mid-sized open-weight coding model is enough.</p><h3>The setup this series uses</h3><p>You don’t need a workstation for this. The hardware I’m running is deliberately ordinary, split across two machines that most teams already have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*ss564cGBFoJrLBlq2e1yqg.png" /><figcaption>Figure 2. The PC serves the model over LAN; the Mac mini runs the agent, Maestro, and the devices.</figcaption></figure><p>The split matters more than the specs. The PC does nothing but serve the model — LM Studio exposes an OpenAI-compatible endpoint on the local network, and that’s its entire job. The Mac mini runs everything else: the agent, the MCP client, Maestro, and the devices.</p><p>There are three reasons this beats putting everything on one box.</p><p><strong>iOS requires macOS, period.</strong> Maestro drives iOS through simulators that only exist on a Mac. No amount of GPU on the PC changes that.</p><p><strong>Memory stops competing.</strong> A 30B model at 4-bit occupies roughly 18GB. An iOS simulator, Xcode, and the JVM want their own several gigabytes. On one machine those fight; split across two, neither notices the other.</p><p><strong>The Mac mini can be modest.</strong> It’s a test runner, not an inference host. Its RAM goes entirely to simulators and tooling.</p><p>The latency cost of the network hop is negligible — a LAN round trip is single-digit milliseconds against inference times measured in seconds. Use wired Ethernet if you can, and keep the LM Studio endpoint on your local network only. It ships without authentication, so it is not something to expose to the internet.</p><h3>What’s coming in this series</h3><p><strong>Part 2 — The local stack.</strong> Picking a model that fits. Why mixture-of-experts architectures change what’s possible when you have plenty of RAM and little VRAM, how to serve it from LM Studio across the network, and why the accessibility tree beats screenshots for this job.</p><p><strong>Part 3 — Wiring the agent to Maestro.</strong> MCP setup, the full sequence of calls in one authoring cycle, and the single most important implementation detail: pruning the hierarchy dump before it reaches the model’s context.</p><p><strong>Part 4 — Self-healing, done carefully.</strong> Classifying a failure into selector drift, timing, OS dialog, or genuine app bug — and why getting that last category wrong is worse than having no automation at all.</p><p><strong>Part 5 — Production discipline.</strong> Retry limits, patches instead of overwrites, tracking which flows get healed repeatedly, and knowing when the right fix is asking your developers for a stable test ID.</p><h3>The honest summary</h3><p>Maestro solves flakiness. It does not solve maintenance. An agent can take a real bite out of maintenance, but only if you keep it firmly on the authoring side of the line and never let it touch a regression run.</p><p>If you’re currently drowning in Appium waits, Maestro alone is worth the migration. If you’re already on Maestro and drowning in selector updates instead — that’s the problem the rest of this series is about.</p><p><a href="https://medium.com/@andrysunandar/agentic-ai-for-mobile-test-automation-with-maestro-dev-9137cf4d5b47?sharedUserId=andrysunandar"><em>Next: Part 2 — running a capable coding model locally on hardware you already own</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f87abf02f397" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>