Catch up on all the news, sessions, and announcements from Google I/O 2021. Watch now.

Testing your Conversational Action

The Actions Builder and Actions SDK development environment provides multiple methods for testing your Actions project at each stage of the development cycle, from interactive development testing to end user Beta testing.

Use the following features to improve the quality and reliability of your Action from initial development to release:

  • Manual testing via the simulator lets you test your Action in the Actions console as you are developing it.
  • Automated testing using testing frameworks and the Actions API helps you generate automated and repeatable tests.
  • User testing with limited release Alpha and Beta channels helps you get real-world testing and feedback.

Manual testing with the simulator

The simulator in the Actions console lets you test your Action manually through an easy-to-use web interface that simulates hardware devices and their settings. In the console, click Test to activate the simulator for testing on your currently selected project.

Figure 1. Actions console simulator interface showing input options.

The simulator lets you specify a target device (smart display, phone, speaker), input method (touch, voice, keyboard), language, and location of your manual testing environment. These options let you quickly and interactively test features of your Action across various devices and regions.

Learn more about the Actions console simulator.

Automated testing with the Actions API

Writing automated tests for your Action can help ensure that the conversational logic of your Action is working as intended, even when new code changes are introduced, without the need to manually test the code yourself each time.

The Node.js Testing Library uses the Actions API to interact with your project code. The testing library allows you to define a test suite that sends queries to your Action and makes assertions on that output to verify information specific to your Action's conversational state.

The Actions API provides REST endpoints that allow you to create a draft of your Action and programmatically interact with it using queries, and find matched intent data for a given query. If you wish to use these endpoints directly, you can download the Node.js Actions API client library.

Using the Testing Library, you can test a single round of conversation by sending a query using the sendQuery function. This method takes a text query as an input and produces a structured output that contains the contents of the prompt presented to the user, as well as other diagnostic information that explains how the request was handled. You can use built-in assertion methods in the output test object to verify the behavior of your Action, such as the matched intent and current scene.

The following example shows a test that asserts that an Action is triggered with the appropriate welcome response:

it('starts Action and enters the Welcome scene', async function() {
    testManager.setTestSurface('SMART_DISPLAY');
    await testManager.sendQuery('Talk to my test app');
    testManager.assertSpeech('Hello World!');
    testManager.assertText('Hello World!');
    testManager.assertIntent('actions.intent.MAIN');
    testManager.assertScene('Welcome');
    await testManager.sendStop();
    testManager.assertConversationEnded();
});

See the full working example of the test suite written in Node.js for our Conversation Components code sample.

For more information on getting started with this testing framework, see the Node.js Testing Library instructions.

User testing with Alpha and Beta releases

The Actions console provides options for releasing your Action to limited release channels for testing by a set of users that you select. Within the console, you can release your Action to Alpha and Beta channels, allowing a limited number of users to test your Action and provide feedback early in the development process. This feature gives you the opportunity to discover and fix technical or user experience issues before releasing your Action to production.

Figure 2. The Actions console Releases interface allows you to configure Alpha and Beta release channels for your Action.

The Alpha release channel allows you to release your Action to a set of 20 developer-specified users who can then test your Action through Google Assistant devices. Alpha releases are ideal for internal testing, as the release does not require Google’s Action review process. Alpha testers get immediate access to your Action when it is released to this channel.

The Beta release channel allows you to release your Action to a set of 200 developer-specified users who can then test your Action through Google Assistant devices. Beta releases are ideal for giving access to users outside your organization when your project has been through a full Google review. When you are satisfied with the result of your Beta test, you can release the Beta version to production, since it has already passed the Google policy review.

For more information on release channels, see the Actions console Releases documentation.