Leverage python's dataclass to write clean and maintainable tests especially when testing Data Intensive Rest Microservices.
Most of the time, code defined in test hooks are very generic where the implementation is applied to their associated scope. But what if you want to run a specific code that only applies to a specific scenario? How would you implement it inside test hooks without affecting the other tests?
If you're used to traditional test frameworks you've probably encountered setup() and teardown(). In Behave this functionality can be implemented via environment.py
Now that you know how to compose your Feature Files and write the implementation code of your API tests, let's now continue to improve on what we've started by using Scenario Outline to parameterize our tests.
The goal is to make a working automated tests to cover GoRest's user creation which is triggered by calling the POST method that is described on their homepage. I will not be automating all the API endpoint's on GoRest's site like viewing users and updating their details.
This is a follow-up series on how to use Python's Behave library to create automated Behavior Driven Tests. It assumes that you already have prior programming experience
Before we integrate the requests package in our Behave Tests, I'd like to do a quick overview on how the HTTP Protocol works...
Now that you're done prepping up your programming environment let's dive in on the directory structure and the components needed in order to run your first API tests. At the end of this article you should have your project scaffolding ready