Search code examples
google-cloud-functionsdialogflow-esactions-on-googleapi-ai

Actions on Google TDD or testing environment


I've been developing an Action on Google for a while now, but haven't figured out a way that I can do TDD effectively. Since I'm writing with the Node.js SDK for API.ai, I can test the fulfillment endpoint pretty easily with mocha unit tests. However, I cannot test anything on the api.ai side of things without it instantly going live.

My current workaround is creating two api ai projects, one used for testing that goes to my dev endpoint, which has to be a live endpoint (I use GC Functions). The other one production going to a different production endpoint.

My question is: Is there a way to run tests, or at least have an effective testing environment for the API.ai side of things without cloning everything and having to manually maintain any diffs between the two API.ai projects?


Solution

  • Currently, the best option is the one you've already discovered:

    1. Create a dev API.AI agent - test and develop here and once you're ready export the agent
    2. Create a prod API.AI agent - and restore the exported agent from your dev API.AI agent once you've tested and validated the agent on the dev API.AI agent.

    Here are API.AI's docs on importing and exporting: https://api.ai/docs/agents#export