- Behave - Home
- Behave - Introduction
- Behave - Installation
- Behave - Command Line
- Behave - Configuration Files
- Behave - Feature Testing Setup
- Behave - Gherkin Keywords
- Behave - Feature Files
- Behave - Step Implementations
- Behave - First Steps
- Behave - Supported Languages
- Behave - Step Parameters
- Behave - Scenario Outlines
- Behave - Multiline Text
- Behave - Setup Table
- Behave - Steps in a Step
- Behave - Background
- Behave - Data Types
- Behave - Tags
- Behave - Enumeration
- Behave - Step Matchers
- Behave - Regular Expressions
- Behave - Optional Part
- Behave - Multi-Methods
- Behave - Step Functions
- Behave - Step Parameters
- Behave - Runner Script
- Behave - Exclude Tests
- Behave - Retry Mechanism
- Behave - Reports
- Behave - Hooks
- Behave - Debugging
Behave Useful Resources
Behave - Installation
Behave package is not a part of Python's standard library, hence it must be installed. Before installing the latest version, let us create a virtual environment, as per Python's recommended method.
A virtual environment allows us to create an isolated working copy of python for a specific project without affecting the outside setup.
We shall use venv module in Python's standard library to create virtual environment. PIP is included by default in Python version 3.4 or later.
Use the following command to create virtual environment in Windows
D:\behave>py -m venv myenv
On Ubuntu Linux, update the APT repo and install venv if required before creating virtual environment
mvl@GNVBGL3:~ $ sudo apt update && sudo apt upgrade -y mvl@GNVBGL3:~ $ sudo apt install python3-venv
Then use the following command to create a virtual environment
mvl@GNVBGL3:~ $ sudo python3 -m venv myenv
You need to activate the virtual environment. On Windows use the command
D:\behave>cd myenv D:\behave\myenv>scripts\activate (myenv) D:\behave\myenv>
On Ubuntu Linux, use following command to activate the virtual environment
mvl@GNVBGL3:~$ cd myenv mvl@GNVBGL3:~/myenv$ source bin/activate (myenv) mvl@GNVBGL3:~/myenv$
Name of the virtual environment appears in the parenthesis. Now that it is activated, we can now install Behave in it.
(myenv) D:\behave\myenv\pythonProject> pip3 install behave
Collecting behave
Obtaining dependency information for behave from https://files.pythonhosted.org/packages/63/71/06f74ffed6d74525c5cd6677c97bd2df0b7649e47a249cf6a0c2038083b2/behave-1.3.3-py2.py3-none-any.whl.metadata
Downloading behave-1.3.3-py2.py3-none-any.whl.metadata (10 kB)
Collecting cucumber-tag-expressions>=4.1.0 (from behave)
Obtaining dependency information for cucumber-tag-expressions>=4.1.0 from https://files.pythonhosted.org/packages/7d/b5/e85d70fd73e598499d62aa8f358591c2014b4d6c3f78f3874f0b777f31fd/cucumber_tag_expressions-8.1.0-py3-none-any.whl.metadata
Downloading cucumber_tag_expressions-8.1.0-py3-none-any.whl.metadata (4.7 kB)
Collecting cucumber-expressions>=17.1.0 (from behave)
Obtaining dependency information for cucumber-expressions>=17.1.0 from https://files.pythonhosted.org/packages/80/e0/31ce90dad5234c3d52432bfce7562aa11cda4848aea90936a4be6c67d7ab/cucumber_expressions-18.0.1-py3-none-any.whl.metadata
Downloading cucumber_expressions-18.0.1-py3-none-any.whl.metadata (2.5 kB)
Collecting parse>=1.18.0 (from behave)
Obtaining dependency information for parse>=1.18.0 from https://files.pythonhosted.org/packages/d0/31/ba45bf0b2aa7898d81cbbfac0e88c267befb59ad91a19e36e1bc5578ddb1/parse-1.20.2-py2.py3-none-any.whl.metadata
Downloading parse-1.20.2-py2.py3-none-any.whl.metadata (22 kB)
Collecting parse-type>=0.6.0 (from behave)
Obtaining dependency information for parse-type>=0.6.0 from https://files.pythonhosted.org/packages/85/8d/eef3d8cdccc32abdd91b1286884c99b8c3a6d3b135affcc2a7a0f383bb32/parse_type-0.6.6-py2.py3-none-any.whl.metadata
Downloading parse_type-0.6.6-py2.py3-none-any.whl.metadata (12 kB)
Collecting six>=1.15.0 (from behave)
Obtaining dependency information for six>=1.15.0 from https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl.metadata
Downloading six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Collecting colorama>=0.3.7 (from behave)
Obtaining dependency information for colorama>=0.3.7 from https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl.metadata
Downloading colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Downloading behave-1.3.3-py2.py3-none-any.whl (223 kB)
ââââââââââââââââââââââââââââââââââââââââ 223.6/223.6 kB 1.5 MB/s eta 0:00:00
Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Downloading cucumber_expressions-18.0.1-py3-none-any.whl (20 kB)
Downloading cucumber_tag_expressions-8.1.0-py3-none-any.whl (9.7 kB)
Downloading parse-1.20.2-py2.py3-none-any.whl (20 kB)
Downloading parse_type-0.6.6-py2.py3-none-any.whl (27 kB)
Downloading six-1.17.0-py2.py3-none-any.whl (11 kB)
Installing collected packages: parse, six, cucumber-tag-expressions, cucumber-expressions, colorama, parse-type, behave
Successfully installed behave-1.3.3 colorama-0.4.6 cucumber-expressions-18.0.1 cucumber-tag-expressions-8.1.0 parse-1.20.2 parse-type-0.6.6 six-1.17.0
With Git Repository
We should first have the pip installed in the system.
Later on, to install the latest version of Behave with Git repository, run the below mentioned command −
pip3 install git+https://github.com/behave/behave
If we use the PyCharm Editor for writing the Behave code, we should have the Professional version of PyCharm along with the Gherkin plugin installed with it.