Tuesday, March 31, 2020
Monday, March 30, 2020
Cheat-Sheet for running a simple Feature Test using Behave with Pycharm (Community edition)
1. Install
Python 3.8
2. Install Pycharm Community Edition
3. Install Gherkin(pip install gherkin-official)
8. To run a very simple program copy the following in ‘tutorial.feature’
14. Run each python file with .py extension individually and check for errors. This can be done by opening the file, right-click and select Run 'file-name'.
15. To run the project click ‘Run’ in the menu on the top of the screen.
17. Click on it and the following screen
will appear
2. Install Pycharm Community Edition
3. Install Gherkin(pip install gherkin-official)
a.
Open Pycharm
b.
Press Ctrl+Alt+S , select Plugins.
c.
It will look like this

d.
Select marketplace (top middle)
e.
In the search on the top (Type/ to
see options) type ‘Gherkin’
f.
Click install and Gherkin will be
installed.
4. Install behave (pip install -U behave in the command prompt)
5.Open Pycharm and create a new project (Testing)
6.Under the project create directory and name it as ‘features’
7. Under
features create a new file and name it as ‘tutorial.feature’4. Install behave (pip install -U behave in the command prompt)
5.Open Pycharm and create a new project (Testing)
6.Under the project create directory and name it as ‘features’
8. To run a very simple program copy the following in ‘tutorial.feature’
Feature: showing off behave
Scenario: run a simple test
Given we have behave installed
When we implement a test
Then behave will test it for us!
Scenario: run a simple test
Given we have behave installed
When we implement a test
Then behave will test it for us!
9. Create
another directory called ‘steps’ under‘features’
10. Under ‘steps’ create a python file and
name it as ‘tutorial.py’
11.
The flow would be like this
12. Type the following in ‘tutorial.py’
from behave import * @given('we have behave installed')def step_impl(context): pass @when('we implement a test')def step_impl(context): assert True is not False @then('behave will test it for us!')def step_impl(context): assert context.failed is False
13.
To run behave
a. Install
behave in the virtual environment ie. in the terminal type ‘pip install behave’
b. Check
if behave is installed.
15. To run the project click ‘Run’ in the menu on the top of the screen.
16. You
will get a pop up which says Edit Configuration
18.
Click on Python to see the__main__ file
and edit the configuration
19 The first entry Name should be __main__
19 The first entry Name should be __main__
20.
Script path is (path of __main__ file.py ) C:\Users\SASHA\AppData\Local\Programs\Python\Python38\Lib\site-packages\behave\__main__.py
21. Working directory is the path of the project ‘Testing’
C:\Users\SASHA\PycharmProjects\Testing
22.
Checkmark the Emulate terminal in the output console
to see the output in the terminal.
23.
Click ‘Apply’ and ‘Run’
24. The following output will be seen in the
terminal
CONGRATULATIONS !! YOU WON !!
Subscribe to:
Posts (Atom)
The Winning Combo – Cryptocurrency and Block Chain
The Winning Combo – Cryptocurrency and Block Chain ABSTRACT: Commercial transactions on the Internet have come to rely exclusively on ...

-
WARNING ! This blog has been created to take away the nightmare of...
-
1. Install Python 3.8 2. Install Pycharm Community Edition 3. Install Gherkin(pip install gherkin-official) ...
-
Sender – User ‘A’ Receiver – User ‘B’ Message to be sent - plaintext.txt The commands are to be run in Linux Environment. This is...