Hello everyone!!
Behave is a tool used for Behavioral driven development in Python programming language. This blog is all about project set up for implementing BDD in PyCharm IDE.
Checklist:
· Python
· PyCharm IDE
· Selenium
· Behave
Let’s install Python in the system
Click the above link and download the python software. It will be in your downloads folder. Later double click and follow the installation instructions as below:
Once the installation is successful, in a command prompt type in below command to check version of Python installed.
python - -version
Next step is to install PyCharm IDE
Click the above link and download Community version .exe file.
Double click on .exe file in downloads folder and follow the below instructions:
Adding Selenium and Behave packages to Project.
Open the PyCharm IDE
File --> New Project --> Create
This will create new project.
File --> Settings
Here you can install Selenium and Behave packages to the project. You can add Selenium and Behave one by one by searching in Python Interpreter.
Final step is to create folders for our project.
Note: This is the basic folder structure for a project.
Create a python package features under the project
⬇️
Create a feature file with .feature extension
⬇️
Create a directory for steps under features package
⬇️
Create a file with extension .py as a stepDefinition file.
⬇️
Create a directory for pageObjects under features package
⬇️
Create a directory for logs under project.
⬇️
Create a directory for utilities under project.
Example:
Points to remember:
When installing Python, it's important to add path as shown in first wizard. If you miss you can add to environment variables later. But setting the path in the beginning is easy.
We can add as many libraries as needed for the project in Python Interpreter
I hope this blog is helpful. Thanks for reading!