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

How do I run dev_appserver.py from within my feature file in behave python?

dev_appserver.py starts a local deployement of my appengine service. I want to run my tests on behave on this local service. I want to start the server within my tests first. How to run the dev_appsrrver.py app.yaml command in my behave feature file…
ssbb191
  • 1,486
  • 3
  • 12
  • 23
0
votes
2 answers

Python Behave BDD framework -Step Definition Jumper

Do we have some alternative plugin for python behave for jumping from feature file to step definition.I know Behave BDD Support is available in professional edition. So do we have something to achieve jumping feature in pycharm community edition or…
0
votes
2 answers

Behave installation with Pydev

I'm new to Python. I would like to run Behave on an IDE. So I'm trying to run the official tutorial of Behave. When I run behave in a terminal command everything is OK. So I guess code/installation are OK ! Issues : 1 - I don't know why I still…
0
votes
2 answers

Running only Feature/Steps files with Behave

I'm struggling to figure out how Behave works with Python. When I set up my files like this: . ├── features │ ├── tests.feature │ └── steps │ └── steps.py └── mycode.py and run Behave from the command line from the root directory of my…
0
votes
1 answer

Capture/redirect console output to file

So, I believe this issue can be applied to any python file generating logs to console. I am trying to capture the output generated while running a behave test(all code is in python3.x). Or more precisely: I am trying to capture the live generated…
linuxstack
  • 757
  • 8
  • 19
0
votes
1 answer

With Python (3.6) Behave, using JUnit reports, how can one stop the step definitions from appearing in the reports?

I'm working with Behave in Python 3.6 - it's great, totally, love it, however, I have to use junit reports. The --junit switch works fine, but the output is really heavy because it includes all the feature gherkin definitions. I'd rather just…
0
votes
2 answers

improving performance of behave tests

We run behave BDD tests in our pipeline. We run the tests in the docker container as part of the jenkins pipeline. Currently it takes ~10 minutes to run all the tests. We are adding a lot of tests and in few months, it might go upto 30 minutes. It…
Bala
  • 1,129
  • 1
  • 9
  • 23
0
votes
2 answers

Selenium not able to find the search field

Here is the website - https://www.phptravels.net/m-hotels I am not able to find the field called the city field(see attached screenshot) Even the selenium is not able to record that field. I want to enter the text in that field. This is what i…
Poonam
  • 166
  • 2
  • 14
0
votes
1 answer

Python Behave BDD Tutorial Error on Windows

So, I`m comparing some python test frameworks and came across behave. Thought it was interesting and worth a test drive. Followed the steps on the tutorial, available at: https://behave.readthedocs.io/en/stable/tutorial.html When I ran the behave…
0
votes
2 answers

Behave print all tests to a text file

I have been asked to provide a list of every behave Feature and Scenario we run as part of our regression pack for a document to an external client (not the steps) As our regression test suite is currently around 50 feature files with at least 10…
Richard C
  • 513
  • 1
  • 7
  • 26
0
votes
1 answer

Pycharm can't interprete behave

Helllo, Im trying to do do tutorial from https://behave.readthedocs.io/en/latest/tutorial.html and when im creating tutorial.feature in pycharm (by gherkin file), all the code is underlined and marked as wrong... Here you can see my setup (i have…
0
votes
1 answer

I got the following error when I executed my behave code. can someone please tell me why this issue is occuring

Error: TypeError: step_impl() missing 1 required positional argument: 'context' Code: @when('the user clicks on "Login"') def step_impl(self,context): """ :type context: behave.runner.Context """ homePage.loginButton(self)
Vibha
  • 31
  • 6
0
votes
1 answer

iterating over a directory in python's behave

I'm using python's behave BDD tool, and I have a directory of xml config files that I'd like to run some automatic tests against before running other end to end tests. I've started writing some feature files using scenario outlines, and just…
Maxwell Bottiger
  • 411
  • 1
  • 4
  • 18
0
votes
1 answer

AttributeError: 'Context' object has no attribute 'find_element_by_name'

I am new to testing with Appium and I'm running my tests with Behave using a page object model structure and ran into an issue that I am completely unable to resolve. when trying to run my behave script I am met with the following error: $ behave…
0
votes
1 answer

How to pass in command line values for a gherkin step

I have a test that is being kicked off via Jenkins, that has the following information: branch=def jenkinsProject=abc123 build=123 Considering that these values will change with every build, using an examples table would not be ideal, nor work? How…
vay
  • 65
  • 1
  • 7