Title: Message Title
Alberto Scotto updated an issue
JBehave / JBEHAVE-1070
Loose StepType
Change By:
Alberto Scotto
Hi,I'verecentlystartedworkingwithjbehave,andIamnoticingduplicationwhenastepmethodcanbemorethanoneStepType,e.g.:{code}@When(thecartisempty)@Then(thecartisempty)publicvoidcartIsEmpty(){}{code}Aneasy(?)workaroundcouldbetosupportthefollowingsyntax{code}@When(thecartisempty)@ThenpublicvoidcartIsEmpty(){}{code}i.e.incaseamethodhasmultipleStepTypeannotations,onlyone[value|http://jbehave.org/reference/stable/javadoc/core/org/jbehave/core/annotations/Given.html#value()]needstobenotempty.ButIthinkthere'samoreelegantsolution.TheCucumberBooksayssomethinginterestingaboutthis:{quote}Given,When,ThenAretheSame.It doesn doesn tactuallymatterwhichofthethreemethodsyouusetoregisterastepdefinition,becauseCucumberignoresthekeywordwhenmatchingastep.Underthehood,allofthekeywordmethodsarealiasesforCucumber::RbDsl#register_rb_step_definition.Thekeywordsarereallyjustthereforextradocumentationtohelpyouexpresstheintentofeachsteporstepdefinition.Thismeansthat,whetheritwascreatedwiththemethodGiven,When,orThen,astepdefinitionwillmatchanyGherkinstepaslongastheregular_expression_matchesthemaintextofthestep{quote}Ilikethisconcept.Attheendoftheday,thedifferencebetweenaGivenandaThenisjustamatterofmeaning.Andof*position*(i.e.givenbeforethen),atmost.Sowhataboutgoingalittlebitfartheranddefiningageneric {code} @ Step {code} annotation?{code}@Step(thecartisempty)publicvoidcartIsEmpty(){}{code}Thereisaproblem,though,asIthinkthiswouldbreakJBEHAVE-196(?).Butthen,asfarasIunderstand,theultimatesolutionwouldbetosupportregexes,wouldn'tit?Whichisanotherfeaturethatwouldbeavery-nice-to-have,Ithink.Thanks
Add Comment
This message was sent by Atlassian JIRA (v6.1.6#6162-sha1:7af547c)