Questions tagged [pytest-bdd]
86 questions
0
votes
0 answers
How can I better control which functions are ran under pytest_bdd?
I have a pytest_bdd test suite, where scenarios are defined in *.feature files and the associated test steps are defined in a _test.py file. For a given group of tests, I'll have a set of *.feature files and a single _test.py file in a single…
0
votes
0 answers
How to profile steps using python-bdd?
I am using pytest extension pytest-bdd to write my BDD tests and I would like to be able to profile the single steps @given/@when/@then etc. in order to find out how long takes each single step. I cannot find any info on the doc tho. Is there any…

Randomize
- 8,651
- 18
- 78
- 133
0
votes
1 answer
How to setup and teardown with multiple files and test cases in pytest
I am new to pytest.
I have 10 test files which has multiple tests defined in each test file like below
test_repo
- features
-step_defs
- stress_tests
-file1 (10 test cases)
-file2 (3 test cases)
-…

Ashu123
- 352
- 2
- 6
- 19
0
votes
0 answers
Pytest BDD - how to abort the test run based on a flag value
I have multiple step def file and decorated them with pytest.mark.order marker.So each step def file has a order marker so that I can run these files in a certain order.
Each file run multiple test cases based on the SCENARIO example defined in my…

Vikas
- 1
- 1
0
votes
0 answers
How to pass a file for pytest-bdd examples section
I am trying to create the Examples section dynamically for pytest-bdd instead of having it as a static value as here
Scenario Outline: Addition
Given I have entered into the calculator
And I have entered into the…

user1865928
- 47
- 1
- 1
- 6
0
votes
0 answers
Allure - Check if current step has attachment
I'm currently working with Allure + pytest-bdd for testing at work. I was wondering if there is any way to check during execution if a test step has an attachment called X.
I know that a trick for this is to define your own…

Meru
- 77
- 13
0
votes
0 answers
Is there a way to define step functions inside a class with pytest-bdd
I'm wondering if there's a way to define step test functions inside Python class with pytest-bdd framework.
Let me elaborate a bit further..., suppose that we have a feature file like this:
"test.feature" file:
Feature: Transaction
Calculate the…

blue2609
- 841
- 2
- 10
- 25
0
votes
0 answers
Adding an exception as a parameter in the examples of pytest-bdd
In the examples of a scenario outline using the pytest-bdd framework, I specify that a result of a test is an exception.
Here is a part of my code:
Scenario Outile:
Given ...
When ...
Then ...
Examples
|input | output …

Mounir
- 15
- 6
0
votes
1 answer
how can we get scenario name in pytest-bdd with pytest_bdd_before_scenario
unable to find scenario name
@sanity
Scenario Outline: B) Change User Name and validate message Master Credentials
Given the case is ""
output:
scenario : B) Change User Name and validate message Master Credentials

shujaat rahim
- 21
- 2
0
votes
1 answer
How to stop pytest_bdd from performing the teardown steps after each iteration of a Gherkin Scenario Outline?
I have the following Gherkin Scenario Outline:
Scenario: Links on main page
When I visit the main page
Then there is a link to "" on the page
Examples:
|site |
|example.com |
|stackoverflow.com|
|nasa.gov …

LokiRagnarok
- 220
- 1
- 10
0
votes
1 answer
Unknown marker with pytest-bdd only when parameter is declared
When I declare a marker in pytest.ini having a parameter, this is not recognized in pytest-bdd feature file. Markers without parameters seem to work fine.
[pytest]
markers =
swr(issue1): link to Software Requirement
smoke: Smoke Test…

amhest
- 85
- 6
0
votes
1 answer
Not able to click 'Add Friend' button on every iteration using pytest_bdd
I'm trying to build a framework for test automation based on pytest_bdd. I'm able to perform many functionalities on my Social Networking Site where I'm performing my automation.
So, my use case is, after logging in, I need to search for a user and…

Nitin Kumar
- 45
- 9
0
votes
0 answers
Not getting SKIPPED test-cases in cucumber html report
I'm using "cucumber-html-reporter" for my Appium, Pytest-BDD automation. For some reason, I'm not getting skipped test cases in my html report.
Below is my report generation script
var reporter = require('cucumber-html-reporter');
var date = new…

ArunBharath
- 143
- 2
- 17
0
votes
1 answer
pytest-django object not being persisted in test database
I am using pytest with pytest-django and pytest-bdd to test a simple django application.
The settings file defines a test sqlite3 database, which is created when the tests are run.
My first function creates a model object:
@given("A message…

miller the gorilla
- 860
- 1
- 7
- 19
0
votes
0 answers
PyTest Logging Capture & Output Control
I am using the JSON report (--json-report) to provide me a json report file that I can programmatically post process at the end of a test session. I want only the post processed report to be displayed at stdout/stderr. How do I "programmatically…

Walter Kelt
- 2,199
- 1
- 18
- 22