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?
Untested Code is Broken Code
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