App Actions test tool

The App Actions test tool is an Android Studio plugin for developers creating App Actions. During development and testing, you use the App Actions test tool to create a preview of your App Actions in the Assistant (for your Google account). You can then test how your App Action handles various parameters prior to submitting it for deployment.

What it does

The App Actions test tool parses your actions.xml file and creates a preview of your App Actions for a single Google account. These previews enable the Assistant to recognize your App Actions prior to deploying the production version of your app to the Google Play Console.

For each built-in intent (BII) in your actions.xml file, the plugin renders a corresponding JSON-LD object and provides default parameter values. You can then modify those values to test your App Actions with meaningful parameter combinations and ensure they perform the correct app functions. Previews can be created, updated, and deleted in the test tool, allowing you to iterate and test your App Actions in a safe environment.

Once a preview is generated, you can trigger an App Action on your test device directly from the test tool window. For built-in intents that are available for user triggering, you can also use the invocation name directly in the Assistant on your device to try out your App Action. For example, you could say "Hey Google, start my exercise using ExampleApp" to launch an App Action that uses the actions.intent.START_EXERCISE built-in intent.

Locale support

The App Actions test tool supports the en-US, en-GB, en-CA, en-IN, en-BE, en-SG, and en-AU locales for preview creation. Other locales are only supported for preview creation in certain built-in intent categories:

Built-in intent category Additional locale support
Finance es-ES, es-MX, pt-BR
Food and drink es-ES, es-MX, id-ID, pt-BR
Transportation id-ID

Getting the tool

To install the App Actions test tool in Android Studio:

  1. Go to File > Settings (Android Studio > Preferences on MacOS).
  2. In the Plugins section, go to Marketplace and search for App Actions Test Tool.
  3. Install the tool and restart Android Studio.

You can also download the plugin directly from the Jetbrains public repository.

Requirements

To use the tool, you must do the following:

  • Log in to Android Studio (version 3.4 or higher).
  • With the same account, log in to the Google app on your Android test device.
  • With the same account, get Play Console access to the app package to be tested.
  • Open the Google app on your Android test device and finish the initial Assistant setup process.
  • Enable device data syncing on your test device.

Using the tool

Access the App Actions test tool in Android Studio by going to Tools > App Actions Test Tool or by selecting App Actions Test Tool in the right-click context menu. When you open the tool, the view may be slightly different depending on whether you have an active test tool preview or not.

Creating, updating, and deleting previews

The test tool creates previews based on your Google account and app package name (application ID), so you can test multiple apps with the same Google account. As long as your application ID is different for each app, you can continue to use the same Google account for preview creation and testing. Multiple Google accounts with access to the same app package can each use the test tool to create separate previews for that app.

If you don't have an active preview, then you must create one before you can use the plugin for testing your App Action. To create a preview, do the following in Android Studio:

  1. Open the App Actions test tool.
  2. Optionally enter an invocation name and locale to test in. The default invocation name and locale are my test app and en-US.
  3. Click Create Preview. Once your preview is created, the test tool window will update to display information about BIIs found in your actions.xml file.

The invocation name is used when the test tool constructs and simulates a query to the Assistant for your App Actions. You can use any invocation name for the purposes of testing, but deployed App Actions use your Play Store app name. We recommend using the name of your app as your invocation name while testing as well.

You can only create a preview in one locale at a time, and the locale provided must be specific. For example, you can enter en-US but not en-** or en-US, en-GB.

To change the invocation name or selected locale for an existing preview, click the Delete Preview button in the test tool. Then, enter the desired invocation name and locale before creating a new preview.

To update an existing preview to match your actions.xml file, click the Update Preview button in the test tool. Information about your current preview can be found in the Test App Action section of the test tool window.

Configuring a built-in intent

Once you've created a preview for your app, you can test various parameter values for built-in intents in the plugin. For each BII in your actions.xml file, the plugin renders a corresponding JSON-LD object and provides default parameter values. You can modify those default values to test your App Actions with meaningful parameter combinations and ensure they perform the correct app functions.

Parameters and their values typically follow the schema.org or schema.googleapis.com structure for properties and descriptions. You can find information about any given built-in intent parameter by accessing the schema type descriptions of a parameter and its higher level parameters as labeled.

For example, the actions.intent.CREATE_MONEY_TRANSFER built-in intent supports the intent parameter moneyTransfer.transferMode. The schema.googleapis.com page for MoneyTransfer lists transferMode as a property. The transferMode property is described as a mode of transfer, and it expects values (like SendMoney) of the enumerated FinancialTransferMode type. In the test tool, you can provide either of the enumerations as the value of transferMode:

  • http://schema.googleapis.com/SendMoney
  • http://schema.googleapis.com/ReceiveMoney

Testing App Actions

After creating a preview and configuring a built-in intent, you can trigger an App Action on your test device directly from the test tool window:

  1. Connect your test device.
  2. In the Select Target Device section, choose the device on which you want to trigger your App Action.
  3. In the Test App Action section, click the Run button.

App Actions triggered in the test tool use the displayed Android Debug Bridge (adb) command. The generated adb shell command includes all the metadata required by the Google app to execute a built-in intent. This approach mimics the behavior of your App Action after the Assistant extracts key pieces of information from a query.

Android Studio logging

Logs specific to the test tool are available in the Android Studio log files, not as Logcat output. Android Studio logs are generated by processes running directly on your workstation, and you can use them to troubleshoot test tool operations like creating, updating, or deleting a preview.

To access your Android Studio log files, go to Help > Show log in explorer (Help > Show log in finder on MacOS).

Logs related to App Actions for your app are available in Logcat. Logcat captures logs from virtual or physical devices connected to Android Studio.

To get App Actions logs for your device, take the following steps:

  1. Access your Logcat log messages by clicking Logcat in the Android Studio tool window bar.
  2. Search for logs that include ActivityTaskManager.