09-23, 16:55–17:45 (Europe/Lisbon), Workshops
In this workshop we will learn how to create automated integration tests for a REST API using ScanAPI. We will learn how to configure the library, to define the endpoints to be hit, the expected behaviors for each response, how to run the tests and how to access the generated report - which might be used as the API documentation itself.
One of the most common use cases of Django is to create REST APIs, especially using the Django REST framework. When creating APIs, we need to ensure the endpoints are working properly, as expected. To ensure they do, in fact, what they should do.
ScanAPI is an open-source Python library that was created to help in this task. ScanAPI provides an easy way to create integration tests for REST APIs via configuration files. Given an API specification, written by the user in YAML/JSON format, the library hits the specified endpoints, runs the test cases, and generates a detailed report of this execution - that can be also used as the API documentation itself.
After a short intro of what ScanAPI is and what was the motivation to create it (5 min), we go over the following topics
- Short Intro about the API we will test and document
- Setup - Installation + configure the project name
- Document and test the first endpoint
- How to use environment variables
- How to hide sensitive information in the reports
- How to chain requests
- How to use nested endpoints
- How to use default values
- How to split the specification file into multiple files
- Quick overview about how to use custom reports
- Quick overview about how to add ScanAPI to a pipeline
ScanAPI Links:
- GitHub Organization: https://github.com/scanapi
- Website: https://scanapi.dev
- Twitter: http://twitter.com/scanapi_
I am a Brazilian software developer that loves to architect systems, create new DevTools, and automate processes. I am a backend developer that loves developing systems using Python or Ruby. 🐍 💎
I am truly passionate about sharing knowledge and connecting with people. For the last couple of years, I’ve been focusing increasingly on open source. Open source is where I could find the perfect fit between people connection and coding in my day-to-day. As a result of this effort, my GitHub profile was the first one to be accepted for the GitHub Sponsors program in Brazil, which made me incredibly happy.
Finally, I am an open-source advocate that does believe in the power of tech communities. People > Tech 💜