Contribute Media
A thank you to everyone who makes this possible: Read More

ScanAPI

Description

Automated Integration Testing and Live Documentation for your API

In the current IT scenario, the use of APIs is, without question, widely vast, popular, and significant. It seems at least prudent to ensure they are working properly, as expected. To guarantee the quality of the data that is being consumed or used. To ensure that communication between services is occurring as expected. To ensure the system does, in fact, what it should do.

ScanAPI is an open-source library that was created to solve all these points. ScanAPI provides an easy way to create integration tests for REST APIs via configuration files.

The three main reasons that led me to the creation of this library were:

  1. To be a firefighter in a scenario where most of the reported bugs were directly related to some API contract being broken or some endpoint having a behavior different from that expected by the consumer.
  2. To need to deal with APIs with outdated or mistaken documentation.
  3. To need to debug an endpoint in the middle of a "chain" of other endpoints. Where I needed to recreate a state that depends on the action of other endpoints.

Given a fictitious example: debug an endpoint to reserve seats on an airplane, which depends directly on the previous call of an endpoint for user registration.

The ScanAPI is open-source and written in Python. However, it can be used in APIs created in any other programming language, since the tests provided by it are integration tests.

With ScanAPI you can:

  • Use environment variables
  • Create variables
  • Chaining requests - making a request from a result of previous responses
  • Hide sensitive information of the requests and responses in the generated report
  • Write Python code - if you want, it's not necessary :)

Topics I intend to address in this talk:

  • Motivation to create the library
  • What problems the library solves
  • How to test an API using a ScanAPI
  • Show the documentation generated by ScanAPI
  • An overview of how it is implemented
  • Where it is currently being used
  • Next steps

Project Link: https://github.com/scanapi/scanapi

Prerequisites: - Python - REST APIs - Integration tests

Improve this page