AoG ProTips: Test Suite for Smart Home

Missed our weekly video? Don’t worry, watch this week’s #AoGProTips ????https://medium.com/media/cb39746b5ea1cee222ed498e0f828115/hrefThe test suite for smart home allows you to self-test your smart home Action and verify that it meets all the necessary criteria before you submit for review. The test suite automatically generates test cases for the supported devices and traits reported by your Action. The test suite cannot verify traits which do not have state (such as Locator) or cannot accept commands (such as RunCycle).In this post, we’ll explore some of the best practices to ensure that your test suite runs are successful!Can you hear me now?The test suite generates text to speech (TTS) audio commands for each device trait reported by your Action. The commands must be heard by a nearby Google Home or Nest device in order to reach your smart home Action. If the device hears the command incorrectly, it will not execute the correct command and the test will fail.Note: This also means

AoG ProTips: Test Suite for Smart Home
Illustration of a home with the Smart Home technology and other tech symbols.

Missed our weekly video? Don’t worry, watch this week’s #AoGProTips ????

https://medium.com/media/cb39746b5ea1cee222ed498e0f828115/href

The test suite for smart home allows you to self-test your smart home Action and verify that it meets all the necessary criteria before you submit for review. The test suite automatically generates test cases for the supported devices and traits reported by your Action. The test suite cannot verify traits which do not have state (such as Locator) or cannot accept commands (such as RunCycle).

In this post, we’ll explore some of the best practices to ensure that your test suite runs are successful!

Can you hear me now?

The test suite generates text to speech (TTS) audio commands for each device trait reported by your Action. The commands must be heard by a nearby Google Home or Nest device in order to reach your smart home Action. If the device hears the command incorrectly, it will not execute the correct command and the test will fail.

Note: This also means that you must ensure the Nest device you are testing with is linked to the same user account that you supplied to the test suite.
Test suite uses audio for commands

Ensure that you run the test suite in an environment where the Nest device can hear your computer speakers clearly without background noise. You might even consider putting headphones over the device microphones to block out any external sound!

Implement Report State

The test suite verifies command results by inspecting the state in Home Graph for the expected value. The test suite does not verify the EXECUTE response or send a QUERY intent to determine success, so you should test those portions of your smart home Action separately. If you do not update Home Graph directly after each command, the tests will fail.

Test suite requires data in Home Graph

To update Home Graph, you must implement the Report State API in your smart home Action to notify Google of asynchronous changes with your devices, and enable the willReportState flag for each device in your SYNC response — the test suite will skip devices with this flag set to false.

{
"requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
"payload": {
"agentUserId": "1836.15267389",
"devices": [
{
"id": "123",
"willReportState": true
...
}
],
},
}

Report state frequently

It’s critical for your smart home Action to maintain accurate data in Home Graph at all times. When Google Assistant does not find recent state data in Home Graph, it must issue a QUERY intent to your service to determine the current state, adding latency to the user experience. You should also call Report State after any command sent to the device, even if the command does not trigger a state change (e.g. the light is already on).

Following these steps ensures Home Graph is accurate starting from the initial SYNC, and avoids common failure cases in the test suite due to missing or incorrect Home Graph data for the devices under test.

Submit your results

After completing your test run, it’s time to submit your results through the certification form in the Actions console. During submission, you will have the opportunity to note any device traits that require additional testing and add comments to your results to indicate if any failing tests are due to design considerations in your devices.

Certification request in Actions console

For more helpful tips on getting the most out of your actions, be sure to check out the rest of the AoG ProTips series — and share your tips with us on Twitter using the hashtag #AoGProTips.


AoG ProTips: Test Suite for Smart Home was originally published in Google Developers on Medium, where people are continuing the conversation by highlighting and responding to this story.

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow