Test Fulfillment API

After you implement the Checkout and Order submit for your Ordering End-to-End fulfillment API, test the handler to make sure both flows work.

Prerequisites

To prepare to test your fulfillment API, follow these steps:

  • Ensure you have edit access to the GCP project associated with your Ordering End-to-End account in the Actions Center. 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 Ordering End-to-End data feeds section.

  • Update your Fulfillment API with the Checkout and Order submit actions code you implemented.

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

Testing

You can complete checkout testing in the Actions Center using either the automated integration tests or quick testing, with 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 Center provides a set of automated tests you can run against your fulfillment endpoint to test checkout and submit. This testing method can save you time by automating the testing process and providing a repeatable test set.

To test the checkout and submit order handlers of your fulfillment API, follow these steps:

  1. Make sure you have selected the right environment from the environment selector.
  2. Go to Inventory > Integration Testing in the Actions Center.
  3. Click New test.
  4. In the Fulfillment endpoint field, enter the fulfillment endpoint URL you want to test against.
  5. In the Test Cases section under Checkout drop down, select the test cases you want to run. We recommend starting with Eligible cart - items without options.
  6. In the Test Cases section under Submit Order drop down, select the test cases you want to run with your submit order handler. We recommend that you initiate with the Eligible cart test case.
  7. You may also adjust the Samples and QPS parameters:
    • Samples: The number of restaurant entities randomly selected for testing.
    • QPS: The max QPS your fulfillment API can support.
  8. To start the test, click Run.

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 API work as expected. You should have a success rate of at least 95% for each of the tests. 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 the quick testing tool

You can test your checkout and submit actions using a valid data feed for your Ordering End-to-End service. This testing process uses the Quick Testing tool to walk through the user ordering flow and simulate a cart checkout and order submit.

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

  1. Go to Dashboards > Quick Testing in the Actions Center.
  2. Use Upload File to upload the data feed you want to use for testing. The file must be in NDJSON format.
  3. After the upload finishes, click Submit.
  4. Wait until the system processes the data feed file. This can take up to a few minutes. The table refreshes automatically.
  5. After the status shows Success, click Quick Test.
  6. Insert in the Test API field the fulfillment API endpoint you want to test.
  7. Click Quick Test to initiate the ordering flow.
  8. Go through the Ordering End-to-End flow by selecting your desired restaurant and building a cart.

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

  10. If the checkout was successful, test your submit order endpoint by clicking the Place order button.

  11. If the order is successfully submitted, the interface displays a confirmation page containing your order details.

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 endpoint. Refer to this output while performing a manual test to troubleshoot specific issues.
  • Your fulfillment endpoint 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.