The App Testing agent is a test case generation, management, and execution agent powered by Gemini in Firebase . You define test goals in natural language, and the agent uses AI to understand and navigate your app, simulate user interactions, and provide detailed test results.
How App Testing agent uses your data
App Testing agent is provided by Gemini in Firebase and is governed under the same terms. See How Gemini in Firebase uses your data for more information about how Gemini in Firebase uses your data.
Before you begin
If you haven't already, register your app with Firebase .
If you aren't using any other Firebase products, you only have to create a project and register your app. You don't need to add any SDKs to your app. However, if you decide to use additional products in the future, be sure to complete all of the steps in Add Firebase using the Firebase console .
Create a test case
To run AI-guided tests, the App Testing agent uses your natural language test cases to execute tests against your app.
Each test case is broken down into steps, which will be executed in sequence. Steps allow you to break up your test case into phases, each with their own assertion. The agent may take many actions during any one step.
There are two ways to create a test case: using a YAML file or using the Firebase console. YAML files let you manage the test cases yourself, typically in a versioned source code repository. Alternatively, the Firebase console can store your test cases remotely along with your App Distribution data.
Using YAML files
The following example shows a YAML file that defines two test cases:
tests
:
-
displayName
:
Login as guest
id
:
login-as-guest
steps
:
-
goal
:
Log in as a guest
finalScreenAssertion
:
The home screen is visible
-
displayName
:
View biography card birth date
prerequisiteTestCaseId
:
login-as-guest
steps
:
-
goal
:
Open the article on "Bob Dylan"
hint
:
Use the search function to find it
finalScreenAssertion
:
> -
The article is opened and the title "Bob Dylan" is visible.
-
goal
:
Find Bob Dylan's birthday in the article
hint
:
> -
Look for the "Born" section in the infobox on the right side of the page.
finalScreenAssertion
:
> -
The text "May 24, 1941" is visible on the screen.
You can organize groups of tests in a single file and separate these test suites
in multiple files. You can add a prerequisite test case by adding an ID to the
test and then referencing that ID using prerequisiteTestCaseId
.
Using the App Distribution console
Alternatively, you can create and manage your test cases in the Firebase Console. To create a test case, open the App Distribution page of the Firebase console and take the following steps:
- On the Test Casestab, click New test case. If you don't want to create your own test case, you can modify or use the provided example test case .
- In the Add test casedialog, give the test case a name. This is used to identify the test, but is ignored by the agent.
- (Optional) Select a Prerequisite test casethat contains set-up steps to run before the main test. If the prerequisite test fails, the entire test will be marked as a failure. Steps and outcomes from the prerequisite and main tests will be shown together in the test results.
- Consider breaking your test into multiple steps, by clicking the Add another stepbutton.
- Give each step a Goalthat describes what the App Testing agent should do during that step.
- (Optional) Add a Hintto provide additional information to help the App Testing agent understand and navigate your app during that step.
- Add Final screen assertionto help the App Testing agent determine when the step has been successfully completed. This assertion should only refer to what's visible on the screen.
- Click Saveonce you're done customizing your test.
Example test case
The following is an example of how to create a test case using the App Testing agent:
Test title |
Home page loads |
Goal |
Load the home page |
Hint |
Navigate past any onboarding screens. Dismiss any popups. Don't sign in. |
Final screen assertion |
The main app home page is visible on screen, all images have loaded, and no errors are displayed. |
Run a test
How you run your tests depends on how you create and manage your test cases. If you define test cases using YAML files, you will run those tests using the Firebase CLI. If you create your test cases in the App Distribution console, you will run them from the console or through one of the App Distribution CLI tools.
Using YAML files
Test cases defined in YAML files can be executed using the Firebase CLI.
- Install or update to the latest version of the Firebase CLI . We recommend downloading the standalone binary for the CLI specific to your OS.
- Sign in and test that you can access your projects. Note that if you're using the Firebase CLI in a CI environment, you can also authenticate with a service account or by using login:ci .
-
Run the
apptesting:executecommand. For example:firebase apptesting:execute \ --app = 1 :1234567890:android:0a1b2c3d4e5f67890 \ --test-dir = ./mytests \ ./app/build/outputs/apk/debug/app-debug.apk
| apptesting:execute [options] [/path/to/app/binary] | |
|---|---|
--app
|
Required: Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page. |
--test-dir
|
Path to a directory that contains test case YAML files. The command will search recursively under this directory, so the files can optionally be organized into subdirectories. If unset, "./tests" is used by default. |
--test-devices
or--test-devices-file
|
The test devices you want to distribute builds to the App Testing agent feature. You can specify the test devices as a semicolon-separated list of test devices: --test-devices
"model=tokay,version=36,locale=en,orientation=portrait;model=b0q,version=33,locale=en,orientation=portrait"
Or, you can specify the path to a plain text file containing a semicolon-separated list of test devices: --test-devices-file
"/path/to/test-devices.txt"
You can look up the available device models using the gcloud CLI . |
--test-non-blocking
|
If set, the command will start the tests and then return immediately instead of waiting for them to complete. To see the test results, visit the Firebase console. If this flag is not set, the command will block until the tests are complete, and exit with a failure code if any of the tests fail. |
--test-file-pattern
|
A regular expression pattern. Only tests contained in files that match this pattern will be executed. |
--test-name-pattern
|
A regular expression pattern. Only tests with display names that match this pattern will be executed. |
/path/to/app/binary
|
Optional: The path to your app's binary. If omitted, the agent will use the last release uploaded to App Distribution for the specified app. |
Using the App Distribution console
To run test cases stored in App Distribution, you can use the Firebase console, the Firebase CLI, or App Distribution 's Gradle or fastlane plugins.
Run tests the Firebase console
The App Testing agent lets you run AI-guided tests in the console by clicking the Run tests button from either the Releases or Test Cases page. This opens the App Testing agent customization screen, where you can choose one or more of your existing test cases for the agent to execute. You can also choose the devices you want to test against, and whether to provide any login credentials. Note that running from the console only supports tests that were created using the console.
When a test run is successful, the App Testing agent will cache the actions taken for each device. These actions can be replayed during the future test runs to improve test repeatability. When replayed actions are used, the agent will still use AI to confirm the actions have succeeded, using any final screen assertions you have defined. If a test fails when using replayed actions, the App Testing agent will fall back to using AI for all actions.
You can also choose to run a Random crawl test by changing the test type. Random crawl tests use the Automated Tester feature.

