Comments (8)
I cannot see where the "Some\nExtra\nLines" is coming from. Probably the
assertion needs to be fixed / enhanced to handle / compare the indentation.
it comes from the given, because like any given it's fixture which you can access later in other given, when, then functions
from pytest-bdd.
about the rename i totally agree and will do
from pytest-bdd.
it comes from the given
Ah, I see. Missed that.
But then the text
argument is invalid here maybe?
I see that i_have_text
comes from the when
, but not where text
is coming from.
from pytest-bdd.
text is coming from the step text as a step argument
It's probably a bit too complicated example
from pytest-bdd.
@given(re.compile(r'I have a step with:\n(?P<text>.+)', re.DOTALL))
def i_have_text(text):
return text
this is an argumented step so it's function gets an argument 'text' because it's a regex group name
cool that you've pointed out this place - because it uses an outdated way of declaring argumented steps
from pytest-bdd.
So this means that any step arguments are available in the then
automatically / when requested?
I would have expected that only fixtures (and pytest-bdd's extension of them) could be requested/used as arguments.
Anyway, it would certainly benefit from some explanation.. :)
from pytest-bdd.
any step argument is injected into pytest's request as a normal fixture, no difference, so you access it in natural way. this allows you to 'mark.parametrize' your test with argumented given, without having to decorate the actual test! And if the name of the argument clashes with existing fixture name, it will override it - so very powerful and we use that quite a lot.
pytest-bdd is build on top of fixtures and only fixtures :)
yes, i'll add more to the step arguments section - about that fact that step arguments are fixtures as well.
from pytest-bdd.
Thanks!
Sounds very powerful indeed.
from pytest-bdd.
Related Issues (20)
- RFE: is it possible to restart making github releases?🤔 HOT 2
- How to use multiple values for a parameter in Scenario Outline Examples
- Custom hooks HOT 1
- Issue with pytest-bdd Failing to Identify Correct Scenario Path After Folder Name Change HOT 2
- `iterparentnodeids` removed from pytest HOT 1
- Step definition parses wrong parameter from feature file
- Unable to run parallel tests with pytest-xdist - can't serialize <class 'pytest_bdd.parser.Step'> HOT 1
- Pytest emits deprecation warning: "A private pytest class or function was used" HOT 3
- pytest-bdd doesn't support pytest 8.1.0 HOT 5
- Missing git tags for 7.1 and 7.1.1 releases HOT 1
- Python 3.8/pytest 3.0.4/pytest-bdd 3.1.0 crash: TypeError: an integer is required (got type bytes) HOT 2
- Pytest 8.1.1 fixture injection compability HOT 2
- Unable to run pytest-bdd with pytest-xdist, can't serialize <class 'pytest_bdd.parser.Step'> HOT 4
- Does pytest-bdd support pytest-xdist? HOT 2
- Version 7.1.2 no longer provides pytest_bdd.steps.inject_fixture HOT 1
- Issue with existing working automation after python 3.11.1 and pytest-bdd 7.00 upgrade HOT 6
- Re-use of target_fixture not possible anymore HOT 1
- How to apply for function/module/package/session scope to feature HOT 2
- Is there a hook for 'before_feature' in pytest-bdd?
- Multiple step scenarios targeting the same fixture doesn't update the fixture HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-bdd.