Mobile Development 11 min read

How AI-Powered Journey Test Transforms Android UI Automation

Journey Test introduces Gemini AI to Android UI testing, letting developers write test steps in natural language that are automatically converted into executable test cases, with a complete workflow from file creation to execution, tips for efficient authoring, current limitations, and suitable use cases.

AndroidPub
AndroidPub
AndroidPub
How AI-Powered Journey Test Transforms Android UI Automation

In Android app development, unit testing frameworks are commonly used for UI testing. Android Studio introduced Journey Test, which leverages Gemini AI to bring a new paradigm.

Core capability: Natural‑language and AI‑driven testing

Journey Test’s biggest highlight is the combination of natural language and Gemini AI. Developers can describe test steps in everyday language, e.g., “type [email protected] into the email field” or “verify the ‘email is required’ error appears”. Gemini AI converts these descriptions into executable test cases that are readable by humans and runnable by machines, including assertions and navigation.

<action>Type "[email protected]" into the email field.</action>
<action>Verify that an error message "Email is required" is displayed.</action>

Gemini AI transforms the descriptions into full UI tests, similar to how a product manager or QA writes a test plan, and Android Studio generates a complete UI test with assertions and navigation.

Full workflow from creation to execution

1. Create a Journey file

In Android Studio, create a Journey file by:

Right‑click the app module in the project panel.

Select New > Test > Journey File.

Enter a test name and description to generate an XML file.

For a login screen test, Journey Test can verify required fields, email format, button enable/disable logic, and successful login.

2. Edit test steps

Test steps can be described in the XML Design or Code view.

Example XML for testing the login screen:

<?xml version="1.0" encoding="utf-8"?>
<!-- formatter:off -->
<journey name="LoginJourneyTestRefactored">
  <description>Tests the login screen's initial state, input validation, button actions</description>
  <actions>
    <!-- Step 1: Verify initial state and disabled login button -->
    <action>Verify that the email text input field is empty.</action>
    <action>Verify that an error message "Email is required" is displayed below the email field.</action>
    <action>Verify that an error message "Password is required" is displayed.</action>
    <action>Check the "Login" button is disabled.</action>

    <!-- Step 2: Test invalid email format -->
    <action>Type "abc@-" into the email text input field and move to next action.</action>
    <action>Verify that an error message containing "Invalid Email" is displayed.</action>
    <action>Check the "Login" button is still disabled.</action>

    <!-- Step 3: Test invalid domain -->
    <action>Just append "com" to the text in the email text input field and move to next action.</action>
    <action>Verify that an error message "This Domain is not allowed" is displayed.</action>
    <action>Check the "Login" button is still disabled.</action>

    <!-- Step 4: Clear email and verify required error -->
    <action>Clear the email text input field and verify its empty.</action>
    <action>Verify that an error message "Email is required" is displayed below the email field.</action>
    <action>Verify that the email text input field is empty.</action>

    <!-- Step 5: Test valid email and password required -->
    <action>Type "[email protected]" into the email text input field.</action>
    <action>Verify that no error message is displayed for the email field.</action>
    <action>Verify that an error message "Password is required" is still displayed.</action>
    <action>Check the "Login" button is still disabled don't enter anything.</action>

    <!-- Step 6: Enter valid password -->
    <action>Type "admin@12345" into the password text input field.</action>
    <action>Verify that no error message is displayed for the email field.</action>
    <action>Verify that no error message is displayed for the password field.</action>

    <!-- Step 7: Click login and verify navigation -->
    <action>Click the "Login" button and verify that the next screen is the HomeScreen.</action>
  </actions>
</journey>
<!-- formatter:on -->

3. Run and debug

Select a target device (emulator or physical), open the Journey XML file, and click “Run”. Android Studio will:

Deploy the app to the device.

Invoke Gemini AI to execute the test steps.

Generate a test report containing screenshots and Gemini’s reasoning to aid debugging.

Tips for writing efficient Journeys

Writing detailed and well‑structured Journeys improves Gemini’s accuracy. Recommendations:

Separate assertions from actions : Use phrases like “Verify that”, “Assert that”, or “Check that” to indicate assertions.

Guide Gemini with swipe actions : Describe swipe direction and intent; Gemini defaults to swiping from the screen center but can be directed to other areas.

Avoid complex interactions and configuration changes : Multi‑finger gestures, screen rotation, or foldable device actions are not yet supported.

Current status and limitations

Slow execution : Longer than Espresso tests, not suitable for CI pipelines.

Stability issues : Gemini may misinterpret commands, causing flaky failures.

Text‑input defects : Cursor positioning and incomplete deletions in long text inputs.

Suitable scenarios and alternatives

Applicable scenarios

Collaborative alignment of requirement documents and test cases among product, development, and QA teams.

Rapid UI flow validation during prototyping.

Supplementing existing Espresso/Compose tests for non‑core flows.

Unsuitable scenarios

Production CI/CD pipelines.

Performance‑sensitive high‑frequency testing.

Tests requiring complex interactions such as multi‑gesture or screen rotation.

Conclusion

Journey Test is an innovative attempt in Android testing that lowers the technical barrier of UI automation by combining natural language with AI. While it currently has limitations, it adds significant value in team collaboration and early‑stage validation. As Gemini AI evolves, Journey Test is expected to become an important part of the Android testing ecosystem.

mobile developmentAndroidUI AutomationAI testingGemini AIJourney Test
AndroidPub
Written by

AndroidPub

Senior Android Developer & Interviewer, regularly sharing original tech articles, learning resources, and practical interview guides. Welcome to follow and contribute!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.