Ted Slocum

Absurdity, gambling, mindfulness, programming, golf, well-being, and my opinions.

06 Nov 2024

Maestro Part 1 -- Mobile UI Testing and AI

This week I dove into Mobile UI Testing and Maestro. Here’s what stuck out:

Mobile UI Testing

As someone who’s sloppily built a cross-platform app, I’ve experienced the chaos of maintaining consistent UI elements and user experiences across iOS and Android. Frameworks like React Native and component libraries like Paper handle the heavy lifting of enabling single-codebase development for cross-platform applications. That said, there is still a lot of room for UI errors as developers usually only test on a single simulator and are moving quickly.

This is where mobile UI testing frameworks come in: They let you connect your codebase to a single testing suite that validates your app’s appearance and functionality across multiple platforms and devices. I wish I used one of these frameworks when I built my app… next time!

Maestro

Maestros tagline

Maestro is the simplest and most effective mobile UI testing framework.

Their topline sample code:

appId: com.example.app
---
- launchApp
- onTap: Search
- inputText: Testing

A YAML-based testing framework with simple syntax and no code? I was extremely skeptical. It seemed ‘toyish’ and too basic to be useful.

Wrong! After working with it for a few days, I’m thoroughly impressed. Maestro is powerful, well-designed, and importantly, it just works!

Standout features:

  • The simple YAML syntax is easy to write, extensible, and covers everything I wanted
  • Hierarchical and flexible element selection allows the engineer (not the framework) to decide on the tradeoff between development speed and strictness
  • Easy to use tools like Maestro Studio for graphical element selection
  • AI capabilities that extend capabilities beyond traditional rule-based tests
  • Clear, comprehensive documentation and logging

A Good Use Case for AI!

The joke is “Hundreds of billions of dollars have been poured into AI development and infrastructure. What do we have to show for it? A chatbot!”. While this is a joke and I believe AI products will eventually lead to a productivity explosion, it was fun to see an implementation of AI that is simple, user-friendly, and solves a concrete problem. Maestro’s AI configuration took 2 minutes to setup and solves test cases that would be cumbersome, if not impossible, to codify.

For example: How do you write a test case for this? app-defect

With Maestro’s AI capabilities, you can simply add a command to your test flow. Such as:

- assertNoDefectsWithAI

And get a report like this:

maestro-ai

Wow! That’s cool and very compelling. It’s one thing to have a test suite that can validate UI elements and functionality. It’s another thing to have a test suite that can validate the presence of unspecified defects!


Anywho… Thanks for reading. In the next post, I’ll explore Maestro’s cloud environment, CI workflow, and whether LLMs are any good at writing Maestro tests!

Be well