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
-1
votes
1 answer

Can I use one Examples for multiple Scenario Outline

This is the code I am using: Scenario Outline: Fill for Shares When Select one of "" from Shares Then One of the Shares dropdown "" will be visible Scenario Outline: Fill for Forex When Select one of…
ivanori1
  • 1
  • 2
-1
votes
1 answer

How to clean database after scenario in Python behave

I'm pretty new to the world of python/behave and API testing, and I'm trying to clean the database after 1 scenario is run by calling the tag @clean_database. Can you please assist? I guess that I will need a database_context.py in my context_steps…
Bruno Soko
  • 624
  • 6
  • 20
-1
votes
2 answers

BDD python behave runner

At the moment I am running feature files either individually or using the terminal and using the command behave. Is there a runner class I can find somewhere that will run all the features one after the other that I can configure? Thanks
Sam
  • 1,207
  • 4
  • 26
  • 50
-1
votes
1 answer

python-behave-invalid command when executing behave

IDE PyCharm professional, python 3.4.5, behave 1.2.5, environment Windows 7; Note: I am running the command from the feature file directory; When I attempt to execute a feature file using the behave command syntax (ex: behave home_page.feature);…
-1
votes
1 answer

Loop executing n-1 times in python-behave

I have a step in behave that calls a method in another python class as follows @when('we query for a specific resource') def…
-1
votes
2 answers

PyCharm Python ImportError Behave

I'm trying to run some tests in PyCharm using Behave and it keeps telling me I have this issue: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/bin/behave", line 7, in from behave.__main__…
RenaissanceProgrammer
  • 404
  • 1
  • 11
  • 30
-1
votes
1 answer

TDD Implementing Step Definitions derived from Behave (Python)

Where do I put Behave's implementation code so that it will not fail Behave's tests? Further do I need to import anything or put any code in so the code I write is linked to the feature file. Here an excerpt from my feature file \steps\main.feature…
Brett
  • 3,296
  • 5
  • 29
  • 45
-2
votes
1 answer

Not Able to Run behave command from powershell getting Error "The term 'behave' is not recognized as the name of a cmdlet"

I have installed Behave for my BDD Project but not able to execute behave command from PowerShell. command line is not accessible at work station Not able to run the bheave command even though behave package is installed, I can run successfully…
Arpan Saini
  • 4,623
  • 1
  • 42
  • 50
-2
votes
2 answers

How can I run checks on all the tags used in my features?

I have many features, and want to control the list of tags, to prevent typos and other naming issues. Is there any way to get the list of tags in in all my features? So having @opponent Feature: Fight or flight In order to increase the ninja…
-3
votes
1 answer

How to use "actors" in python bdd scenarios?

I would like to create "actors" for my bbd scenarios, is there any simple way to use "actors" in tests written in Python using behave? I've found out Pykka which is a Python implementation of the actor model, but how can I connect behave with Pykka?
sada123
  • 11
-4
votes
2 answers

Getting error about argument when calling method

I have feature file from where I am trying to get the email : Scenario: Login to website Given I navigate to Login page When I click on login button Then I redirected to login page Then I enter valid "" | Email | |…
Helping Hands
  • 5,292
  • 9
  • 60
  • 127
1 2 3
34
35