Questions tagged [python-behave]

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:

enter image description here

521 questions
0
votes
2 answers

Python behave: How to check if current step is within 'Background' context or not

Summary: when producing test reports or test run dumps in -w mode I'd like to supress the stdout output of steps, which are run as Background steps. I have control over the output produced via an environment variable but I'm not able to detect when…
Red Pill
  • 511
  • 6
  • 15
0
votes
1 answer

django, wsgi_intercept and behave

Hi I am trying to implement behave test framework in my django python app. However not sure what the problem is and I keep getting connection refused. Following is the content of features/environment.py: import os import django import…
vivsriva
  • 43
  • 5
0
votes
1 answer

how to generate junit reports using Behave

I've tried to use console and configuration file to generate JUnit report - without any success. To be more precise, I get empty file TESTS-features.forms.xml in reports folder. I've tried to change default folder for reports - without any luck.…
master.py
  • 215
  • 2
  • 5
  • 16
0
votes
1 answer

How to run Python & Behave tests with some unit test framework?

I need to run my tests (written with Python and Behave) without using console. I prefer to create simple Python script and use some unit test runner. I'm thinking about unittest, but pytest and nose solutions are also welcome:) I couldn't find any…
master.py
  • 215
  • 2
  • 5
  • 16
0
votes
2 answers

Multiprocessing Manager seems to be blocking environment variable changes

I use behave for running our gherkin based test suite, with a custom runner that handles running behave in parallel. This functions perfectly on my local (Windows 8.1) machine, and allows me to change environment variables within my subprocesses,…
-1
votes
1 answer

Custom report for the Behave Python framework, need to fetch the Scenario Name and its status

I need to create a custom report for the Behave and Python framework, where I need to fetch the Scenario Name and the scenario status, how to acheive it? is there any event listener class in the behave framework, in which I can able to call that…
-1
votes
2 answers

Behave BDD reusing steps from common step file

How do i re use steps from common_step.py example: common_feature: Given log in with "abc" user common_step: @given('log in with "{user}" user') anotherFile_feature Given log in with "xyz" user anotherFile_steps: how do i pass that xyz user in here,…
-1
votes
2 answers

Python Behave feature file warnings

I am not new to web automation with selenium but I am very new to python I am trying to create my own dynamic structure. With a little bit effort I can do the BE coding with python but when it comes to behave feature file I don't get the problem I…
-1
votes
1 answer

How can I use BDD for writing test cases in testrail if I used Selenium with Python for my scripts?

I am trying to learn BDD (Behave) for a Android mobile app automation done in PyCharm using Selenium with Python (so is not pure Python; and I never understood the difference, even though I tried to find info about that). I'm a beginner, so I need…
Claudaette
  • 41
  • 1
  • 11
-1
votes
1 answer

attribute and traceback call error running behave

working in ubuntu instance installed python 3.7.8 installed pip3 installed virtual environment behave behave web driver allure-behave selenium chrome driver when running the feature files I get errors Exception Attribute Error: 'Options' object…
tom
  • 11
-1
votes
1 answer

How to create a bash script to execute non-headless automation in python-behave

I asked this few days back but it was assumed and erroneously linked to a previous question. This is the question.
-1
votes
1 answer

Using Behave I want to run all my feature files but it throws error No steps directory but the same runs through pycharm

When I use this command to run behave /ios_integration/features I get the ConfigError: no Steps directory [
-1
votes
1 answer

Any suggestions for the root cause of this error while running behave BDD tests

While trying to run some BDD behave Tests from my local mac machine I encountered the following error. Has anyone else experienced it and any suggestions to fix it. HOOK-ERROR in before_all: KeyError: 'SELENIUM_HUB'
philomath
  • 113
  • 2
  • 9
-1
votes
2 answers

Python unable to pass parameters from feature file to step definition in cucumber

I am trying to implement POM pattern in selenium with cucumber using python. When I am trying to do pass parameters from cucumber feature file to step definition getting blocked. I have already searched on stack over flow (link) but solutions…
FayazMd
  • 386
  • 2
  • 22
-1
votes
1 answer

Any built in method in behave that can parse a scenario given as text input and gives me back the list of steps

I have a unique problem where I need to list down all the steps in a behave scenario. I need to achieve this for hundreds of scenarios. My actual requirement is to convert a behave scenario into a manual test case so each step in a scenario can be a…
Balu
  • 141
  • 3
  • 17
1 2 3
34
35