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
0 answers

Unable to run behave from command line

I'm trying to run behave from command line ( using cmder & sublime text 3), but im getting the following output behave --name features\zero.feature Traceback (most recent call last): File "C:\Python27\Scripts\behave-script.py", line 9, in…
manju4ever
  • 325
  • 1
  • 13
0
votes
1 answer

How to run only half of python-behave tests

We have two machines with the purpose to split our testing across machines to make testing faster. I would like to know of a way to tell behave to run half of the tests. I am aware of the --tags argument but this is too cumbersome as, when the test…
Nightsreach
  • 101
  • 1
  • 1
  • 7
0
votes
2 answers

How to exclude multiple patterns using python behave

I have 10 feature files out of which I want to exclude api.feature and integration.feature . How do I do it using behave? behave --tags @test --no-capture --show-timings -e (int|u) behave --tags @test --no-capture --show-timings -e api.feature…
user3179786
  • 123
  • 2
  • 12
0
votes
1 answer

Log command-line options passed to behave

I am launching python-behave with command-line options like (tests outputs is being written to a logfile) behave -f json -D browser=safari -D browser_version=8 -D platform=MAC features I want to log which command-line options are being passed to…
xsqox
  • 51
  • 1
  • 9
0
votes
1 answer

context is unavailable in python behave

I am starting with Python behave and got stuck when trying to access context - it's not available. Here is my code: Here is the Feature file: Feature: Company staff inventory Scenario: count company staff Given a set of employees: …
xsqox
  • 51
  • 1
  • 9
0
votes
1 answer

KeyError: 'browser' with Splinter and Behaving automated testing

I followed the instructions here: http://shon.github.io/2014/06/19/ui_testing_and_bdd.html about setting up Splinter with Behaving to run automated tests. I'm able to run a test successfully, but at the end of the test, it throws an error saying: …
coreyg
  • 428
  • 8
  • 18
0
votes
0 answers

Repeat steps from a previous scenario in later scenarios

So I have a scenario outline where I need to repeat those steps in the other scenarios of this feature and I don't want to duplicate the steps manually in feature file. I tried Background but without success yet. Here is the scenario: Scenario…
Raj
  • 1
0
votes
1 answer

High memory usage when using python-behave

I ran into a problem when using python-behave. I create a sandbox database before every scenario and destroy it after scenario. But memory usage increase about 20MB for every scenario, and total usage is about 3.xGB for all test case(LoL). My…
nelson
  • 1
  • 3
0
votes
2 answers

Python - Read CSV cell from specific row - row index is passed in variable

I'm using Python Behave to run automated tests against a web application. There is a login page that takes a username and password. The Behave scenarios have different login requirements, for example; Given I am logged on as user1 Then do…
TonyM
  • 11
  • 3
0
votes
0 answers

Change in python script not reflected when I execute module "behave"

I am trying to use Behave from terminal. Typing behave in terminal, I received an error, Exception ImportError: No module named worker File "features/environment.py", line 11, in from worker import glob, json ImportError: No module named…
Eimi Okuno
  • 107
  • 8
0
votes
1 answer

Capture behave outputs into a dynamically created log file

I am trying to capture the Behave outputs in a file(let's say a log file). I am dynamically creating a new log file at '@then' step for every run of Behave based on datetime. Below is the sample code given in the steps/xx.py file. def…
Anoop Js
  • 39
  • 8
0
votes
2 answers

How can I determine if a (Python) behave feature file ran successfully from within the stepfile?

Say I have a master python-behave feature file, and in said file, I check to see if 25, give or take, feature files exist, run each of them in their correct order, and then verify some postconditions. I want to be able to test multiple features…
B J
  • 140
  • 1
  • 3
  • 10
0
votes
1 answer

Ambiguous step in Python Behave

My business user likes to use the then sentence "It should be created", where it is determined by the context of the scenario. For example: Given I have gift certificate for "" When I enter the gift certificate Then It should be…
suriyanto
  • 1,075
  • 12
  • 19
0
votes
1 answer

Django-behave - no behave tests

Does someone has expiriences with django-behave? I can not run behave tests. I have newests versions of 'behave' and 'django-behave' installed. 'django_behave' is in my INSTALLED_APPS and in my settings.py i also added TEST_RUNNER =…
krzyhub
  • 6,285
  • 11
  • 42
  • 68
0
votes
0 answers

Selenium is not handling my javascript dialog box correctly

I've passed the last 5 hours trying to find a solution that's been bugging me since yesterday. I am writing some BDD tests using behave and selenium to test the product addition functionality of my web app. So to add a product the user have to click…
Codejunky
  • 632
  • 1
  • 6
  • 15