Test the checkout handler

After you implement the checkout handler for your Food Ordering web service, test the handler to make sure the checkout flow works.

Prerequisites

To prepare to test your web service, follow these steps:

  • Ensure you have edit access to the Actions on Google project associated with your Food Ordering service in the Actions console. You can check and modify access to the project using the Google Cloud Identity Access Management (IAM) console.

  • Upload a data feed JSON file to be used for testing. The data feed must contain at least one Restaurant entity and the corresponding Service and Menu entities. You can use one of the valid data feeds you previously created in the [Food Ordering data feeds][data feeds] section.

  • Update your project's web service with the submit order fulfillment code you implemented for the [Build submit order][build submit order] section.

  • Make sure your order fulfillment URL endpoint is publicly accessible from your web service.

Testing

You can complete checkout testing with the Actions console using either an automated testing method or a manual test, using your valid data feed. If possible, use the automated testing method for faster results and testing coverage.

Test with the automated testing tool

The Actions console provides a set of automated tests you can run against your web service to test checkout. This testing method can save you time by automating the testing process and providing a repeatable test set.

To test the checkout handler of your Food Ordering web service, follow these steps:

  1. Go to Test > Integrations.
  2. For Data feed, select Preview.
  3. For Fulfillment endpoint, enter the fulfillment endpoint URL you want to test against.
  4. In Advanced settings, select the test cases for your integration test to run. For now, focus on the Checkout > Eligible cart - items without options test case.
  5. Click Run.
  6. Wait for the test to complete. This can take up to 20 minutes depending on the number of entities and test cases selected.

Review the results of your integration test to make sure your feed and fulfillment work as expected (success rate of at least 95%). For test cases with a low success rate, you can get more information about associated error messages by clicking on the test case.

Test manually with a data feed

You can test your checkout using a valid data feed for your Food Ordering service. This testing process uses the data feed preview mode to walk through the checkout process and simulate a checkout.

To manually test with your data feed, follow these steps:

  1. Go to Develop > Data feeds in the Actions console.
  2. On the Test your app with feeds card, click Get started.
  3. Select Preview as the data feed environment from the dropdown.
  4. Click Launch Test to preview your feed.
  5. Go through the Food Ordering flow by selecting your desired restaurant and building a cart.

  6. Test your checkout endpoint by clicking the Checkout button.

Additional resources

In addition to the steps outlined above, you can use console tools to further test and troubleshoot your order fulfillment.

Refer to the following tools for additional guidance:

  • The Chrome DevTools Console outputs request and response JSON between the console and your fulfillment. Refer to this output while performing a manual test to troubleshoot specific issues.
  • Your fulfillment outputs its Stackdriver logs to the Google Cloud console. If you're troubleshooting issues with your fulfillment code, refer to these logs for detailed error messages.