spockframework / spockframework/spock
Execute single iteration of a data driven feature
Open
Nobody has claimed this yet.
Module-Core
Type-Enhancement
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 483
- PR merge metrics
- No merged PRs in 30d
Description
Originally reported on Google Code with ID 356
Would like to have the possibility to call/execute a data driven feature as a single
iteration.. in other words to call it as a normal method and bypass the data provider
logic.
I used a couple of hacks for doing achieving this, like:
calling the generated feature method (ex. some_spec.$spock_feature_3_0(params...))
but this does not play well with shared instances.
another one was to use a customized ParameterizedSpecRunner and using feature.getDataProcessorMethod().setReflection,
feature.getDataProviders().get(0).getDataProviderMethod().setReflection in an ISpecRunner
to hack the data provider state, this is really ugly and error prone.
I need this to easily aggregate and compose data driven features. For example I can
have a spec that tests authentication for different kinds of users and another one,
that depends on a kind of user being authenticated, that tests authorization and some
business flow spec that depends on a user being authorized to execute it. My business
spec would have a setup in which it calls authorizeSpec.authorizeSomeActions, in turn
authorizeSomeActions would contain a setup that calls authenticateSpec.someUser
Reported by sebi@c4media.com on 2014-03-30 19:43:18
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the generated feature method and the ParameterizedSpecRunner and ISpecRunner paths mentioned in the report, including their data processor and data provider handling. Trace how shared instances are managed during data-driven execution. Done means a single iteration can be invoked without the data provider hacks and still behaves correctly with shared instances.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100