c# - How can I use both 'Examples' and 'RunStepWithArgs' for a BDDfy scenario? -


overview

i'm starting project in c# , i've not used bdd framework in before. started project in python , used behave write specifications in gherkin format, i'm encountering problems porting specifications.

after little bit of research opted trying specify, bdd library builds on top of bddfy. in particular, trouble i'm having specification wrote in behave makes use of both example data (to allow whole scenarios executed different sets of data) , tabular data associated individual steps.

in bddfy, can set examples property on specification class utilise first feature, , can apply runstepwithargs attribute methods within specification class make use of second of these features, can't seem use both together.

i've created github issue on bddfy github page here , i'll post copy of below.

details

here's scenario made in behave i'm having trouble replicating in specify:

mofichan greeted      given mofichan configured use following behaviours:         | behaviour |         | identity  |         | greeting  |     , mofichan running     when "<greeting> mofichan"     mofichan should greet me      examples:         | greeting |         | hey      |         | hi       |         | hello    | 

in specify, i've tried following in specification context class without adding examples:

public void setup() {     this.container.set<imofichanbackend>(new mockbackend("mock")); }  [runstepwithargs("identity", steptexttemplate = addbehaviourtemplate)] [runstepwithargs("greeting", steptexttemplate = addbehaviourtemplate)] public void given_mofichan_is_configured_with_the_following_behaviours(string behaviour) {     this.container.set<imofichanbehaviour>(new mockbehaviour(behaviour), key: behaviour); }  public void andgiven_mofichan_is_running() {     //var mofichan = this.container.systemundertest;     throw new notimplementedexception(); }  public void when_i_say__greeting__mofichan(string greeting) {     throw new notimplementedexception(); }  public void then_mofichan_should_greet_me_back() {     throw new notimplementedexception(); } 

this produces following report:

test without examples

this pretty want - have same 'given' method run twice different arguments , have shown in report.

if try add examples:

public mofichanisgreeted() {     examples = new exampletable("greeting")     {         { "hello" },         { "hey"   },         { "hi"    },         { "yo"    },         { "sup"   },     }; } 

then following report:

test examples

not report less informative, causes incorrect test behaviour; given_mofichan_is_configured_with_the_following_behaviours called once if runstepwithargs applied multiple times.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -