Test suite for smart home

The test suite for smart home is a web application that allows you to self-test your smart home Action. The test suite automatically generates and runs test cases based on the devices and traits associated with your account. When you complete the tests, you can view the test results or fill in the submission form to submit the test results to Google.

Launch test suite

Prerequisites

Before you can self-test your smart home Action, complete these prerequisites:

  • A quiet environment for text to speech to be clear for the Google Assistant. The test suite for smart home uses the speech synthesis API to simulate user queries.
  • A computer with speakers and a web browser.
  • A Google Home device with language set to English. Tests are only supported in English. Place this Google Home device next to your computer.
  • Give your devices names that are clear and easy to understand. Avoid using numbers for a device name, such as "Lamp1".
  • Make sure that Report State and Request Sync are implemented for your devices and traits.
  • A service account key. If you do not have one, see service account key.
  • Your agentUserId. If you do not have it, see retrieve your agentUserId.

If you already have completed all of the prerequisites, see self-test your Action.

Service account key

GCP Console

Note: Ensure that you are using the correct GCP project when performing these steps. This is the project that matches your smart home project ID.
  1. In the GCP Console, go to the Create service account key page.

    Go to the Create Service Account Key page
  2. From the Service account list, select New service account.
  3. In the Service account name field, enter a name.
  4. In the Service account ID field, enter a ID.
  5. From the Role list, select Service Accounts > Service Account Token Creator.

  6. For the Key type, select the JSON option.

  7. Click Create. A JSON file that contains your key downloads to your computer.

Retrieve your agentUserId

agentUserId

  1. Replace the email@gmail.com and your_project_id with valid values for your project and open the page:

    https://gala-demo.appspot.com/app?login_hint=email@gmail.com&service_id=your_project_id_dev
    

    The page displays an Access Token. You can use this Access Token to retrieve your agentUserId.

  2. Replace the your_access_token and your_fulfillment_URL with valid values for your project and run the curl command:

    curl -X POST -H"content-type: application/json" -d '{"requestId":"ff36a3cc-ec34-11e6-b1a0-64510650abcf","inputs":[{"intent":"action.devices.SYNC"}]}' -H "Authorization: Bearer your_access_token" 'your_fulfillment_URL' | grep agentUserId
    

Self-test your Action

  1. In your web browser, open the test suite for smart home.

  2. Configure project settings:

    1. In the Agent User Id field, enter your agentUserId.
    2. Click the paper clip button that is next to the Service Account Key field. Then, from the file dialog, select your service account key. The Project ID is filled in automatically from the service account key.
    3. Click Next.
  3. Configure test settings:

    1. If certifying your smart home Action, leave the default Report State/Request Sync Timeout value unchanged. However, for testing, you may change the timeout value if your agent takes more time to report state to Home Graph.
    2. If certifying your smart home Action, make sure the Test Request Sync option is enabled—during testing, you will be prompted to add, update, or remove a device and check if the device list has changed in HomeGraph
    3. If you are using a Scene trait, select Test Scene trait.

  4. Run tests and view results:

    1. Click Next to start running tests. You will see the devices and traits that are being tested.
    2. Once the tests are complete, click Next to view the results. This will include the number of tests passed and failed, and a final score indicating percentage of passes.
  5. Submit test results:

    1. When you are ready to certify your smart home Action, click Submit.
    2. Download the test results by clicking the DOWNLOAD TEST RESULTS button.
    3. Click the GO TO SUBMISSION FORM to submit the test results to Google. Fill out all of the required fields, then click Submit.

Error messages

The following table lists some common error messages you may encounter and the suggested way to resolve them.

Error Message How to Resolve
HomeGraph API has not been used in project <_id_> before or it is disabled Make sure that you have enabled the HomeGraph API.
Requested Entity not found Check that your agentUserId is valid and is linked to your service.