Comments (18)
@evbo do you mean https://github.com/pytest-dev/pytest-bdd#test-code-generation-helpers
but it's a generation of the step definitions, not the steps. The vice versa wouldn't make any sense to me, as this is a behavior-driven development, where the feature in plain text precedes anything else.
from pytest-bdd.
But there's auto generation for that
Did you try it?
On Mar 16, 2015 7:12 PM, "Leonardo Santagada" [email protected]
wrote:
pytest-bdd would be much more awesome if it would auto create scenario
functions, so you wouldn't have to define empty functions just to make the
test go. I think this either could be implemented as a test collector (also
would make the test reporter more user friendly as it would show the
feature file as the source of tests) or it could be just a invocation form
of scenario function like:scenario('feature/something.feature', auto=True)
—
Reply to this email directly or view it on GitHub
#103.
from pytest-bdd.
@bubenkoff
Are you referring to https://github.com/pytest-dev/pytest-bdd/blob/master/README.rst#test-code-generation-helpers?
I think what @santagada is a bit more involved (if I understand it correctly): the advanced code generator would say "Scenario is not bound to any test":
Please place the code above to the test file(s):
@scenario('tests/generation.feature', 'Code is generated for scenarios which are not bound to any tests')
def test_Code_is_generated_for_scenarios_which_are_not_bound_to_any_tests():
"""Code is generated for scenarios which are not bound to any tests."""
But this seems to be redundant. It would be nice if the scenario files could
be considered to be (pytest) tests automatically.
from pytest-bdd.
Yes I'm about that
I wanted all of interested people to play with existing possibilities first.
I'm more than open for the change, just it should really improve things.
On Mar 16, 2015 10:46 PM, "Daniel Hahler" [email protected] wrote:
@bubenkoff https://github.com/bubenkoff
Are you referring to
https://github.com/pytest-dev/pytest-bdd/blob/master/README.rst#test-code-generation-helpers
?I think what @santagada https://github.com/santagada is a bit more
involved (if I understand it correctly): the advanced code generator would
say "Scenario is not bound to any test":Please place the code above to the test file(s):
@Scenario('tests/generation.feature', 'Code is generated for scenarios which are not bound to any tests')
def test_Code_is_generated_for_scenarios_which_are_not_bound_to_any_tests():
"""Code is generated for scenarios which are not bound to any tests."""But this seems to be redundant. It would be nice if the scenario files
could
be considered to be (pytest) tests automatically.—
Reply to this email directly or view it on GitHub
#103 (comment)
.
from pytest-bdd.
Cool.
What are your current thoughts on providing this?
I see that behave does this automatically.
I've thought that maybe pytest would require the test functions to collect any tests, but that can be certainly hooked into / provided in a different way.
from pytest-bdd.
there are discussions in #89 and #92
from pytest-bdd.
I like the idea from #90 (comment), where you would import / create tests for a set of scenarios:
scenarios('my.feature')
This could then also support using directories (with or without recursion), which would allow to set up all features like:
scenarios()
And for directories:
scenarios('frontend', recurse=True) # recurse=True could be the default
It's probably useful to also accept an iterable here, allowing to fine tune it using some generators etc.
(please keep in mind that I am new to pytest-bdd, so am lacking any experience in this regard)
from pytest-bdd.
this will only work for simple cases, but if you'll need to parametrize certain test directly on the function level, then you'll need a way to exclude certain test from that automatic 'suite'
from pytest-bdd.
The problem with the generator is that it is too manual. There should be some way to auto collect tests, just like py.test does for functions and all.
from pytest-bdd.
I'll try to experiment with this (again)
from pytest-bdd.
It is starting to look good 👍
from pytest-bdd.
2.7.0. is out
please play and say what you think
from pytest-bdd.
@bubenkoff I only wanted to say cheers, good stuff :-)
from pytest-bdd.
@spinus thanks, have you tried it?
from pytest-bdd.
Yes, works almost nice :-) (#138)
from pytest-bdd.
@bubenkoff as a newcomer to pytest-bdd, it's very hard to discern in your docs how to automatically generate feature
files from .._test.py
files, or vice-a-versa.
Could you link me to where it's documented how to generate 1 from the other?
from pytest-bdd.
@bubenkoff thank you, that's perfect and I answered a similar Discussion with references. Someone else was also looking for a way to define .features
from test code.
Here's my take on what people like me are looking for: A way to automatically document their code (auto-convert to .feature
or .md
markup), while writing tests, without a product owner necessarily in the loop (for very small teams or single person businesses).
I don't think what I'm looking for exists and maybe writing my own CLI that parses the Python code of pytests wouldn't be so hard. Thank you otherwise for a great repo, maybe my use case just isn't a good fit for it.
from pytest-bdd.
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.