Behave is a BDD framework for Python, based on the Cucumber Framework.
Behave is Behaviour Driven Development (BDD) framework for Python. It follows the Gherkin syntax, which defines Scenarios and steps files.
A scenario is a human readable flow, for example:
Scenario: Calling the metadata API
Given A matching server
When I call metadata
Then metadata response is JSON
And response status code is 200
The steps file casts programmatic meaning to each line, for example:
...
@then('response status code is {expected_status_code}')
def step_impl(context, expected_status_code):
assert_equals(context.response.status_code, int(expected_status_code))
@then('metadata response is JSON')
def step_impl(context):
json.loads(context.metadata_response.data)
...
Behave combines the scenario and steps to a test report: