mardi 12 décembre 2017

How to test API calls (Twitter, Google)

So I've written a bot that uses mostly API calls to the Twitter API and the Google API (http requests).

The bot:

  1. generates some random phrases from local data
  2. calls google to get a related image
  3. posts everything to twitter

If I'd wanted to test this bot automatically what'd be the best approach:

  • Integration testing with a fake HTTP backend
  • Unit tests for every API call faking some results for the actual HTTP calls
  • Other

I'm working in node, in case that's relevant.

Aucun commentaire:

Enregistrer un commentaire