Introduction to behave

What is Behave?

Behave is a python BDD(Behavior Driven Development) approach to create test cases in simple english text language manner.

What type of files does it have?

It has features(.feature) files and steps(.py) files.

Feature file : A feature file is a natural language format describing a feature of an application or scenario of expected outcomes.

Steps file : Steps file is a normal python file where execution code as written in it based on steps in the feature file.



Structure of Behave

1. Inside a package or a folder we need to create a “.feature” file.

2. We need to create one more package and name it as “steps”. Inside that package we need to create “.py” files which consist of step definitions(code for test cases).

In the diagram below we can see how the structure of behave looks.

Package
Package/fileName.feature
Package/steps/.py files
Behave Structure