AdnanKukuljac/spock

Execute single iteration of a data driven feature

Opened this issue · 0 comments

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


Original issue reported on code.google.com by s...@c4media.com on 30 Mar 2014 at 7:43