1. Yes, I agree - GivenStory syntax is often preferable to be a
declarative precondition rather than setup/teardown paradigm which is
more akin to unit testing.
2. The synonyms of 'And' are definitely easier to implement because they
map to pre-defined types.
Please raise a JIRA issue for it.
On 11/02/2013 11:05, Iulian Greculescu wrote:
@Handa,
If I understand well the sub scenario need this can be achieved by
including that sub scenario part of a standalone story and then making
your each scenario that has your sub scenario a prerequest running
with a GivenStories pointing to that common story.
We applied this lots of time when exercising a banking system.
Say you have the user login story your common thing and then you have:
a BPay payment, a Bank Transfer, an International Payment, etc. All
these scenarios would gave a GivenStories UserLoginStory, etc
@Mauro
The user defined keyword attracted my attention quite a lot. I accept
that you can describe a business case just using Given/When/Then/And
suite. However when the scenario you need to write is a long one (say
30 or more steps) I have to accept that the story starts sounding a
bit to fade (say made up). It works but....:)
When this post came I was just about to come up with an idea/proposal
to bring some spice in our stories and make them sounds more natural.
What about including the flexibility of defining "And" synonyms with
exactly the same functionality as the actual "And"?
So you can say something like this:
Given our Payments system supports SWIFT messages
When a FX transaction message arrives
And the "from" currency is USD
And the "to" currency is GBP
And the exchange rate is 0.71002
And the transaction date is the next business day
And the transaction amount is $200.00
And the payer account no is 1234567890
....
And 30 others "when" steps describing the Foreigner Exchange message
Then.....
Someone would say (me included) that if I can say "With' and "Having"
are synonyms of "And" and rewrite the story like below then it would
sound more natural.
Given our Payments system supports SWIFT messages
When a FX transaction message arrives
Having the "from" currency as USD
And the "to" currency as GBP
With an exchange rate is 0.71002
......
What do u think? I was thinking to research a bit how difficult that
would be.
Regards,
Julian
--- On *Mon, 11/2/13, Mauro Talevi /<[email protected]>/* wrote:
From: Mauro Talevi <[email protected]>
Subject: Re: [jbehave-user] User defined keyword
To: [email protected]
Received: Monday, 11 February, 2013, 2:36 AM
You can request new features on JIRA:
http://jbehave.org/issue-tracking.html
That said, your features require substantial changes and are more
likely to be considered for the 4.x releases.
On 10/02/2013 15:13, Handa, Ramneek wrote:
I would love to have ability to write a sub scenario which is a
part of many scenarios so as to avoid repetition.
@Before/@AfterScenario/... – as a coder of my tool I wouldn’t
know what the story writer would like to do at teardown and setup.
Unfortunately these two are very basic needs for me to use
JBehave. Is it not done because its complex given how JBehave is
implemented or has it never been the priority?
I can write my requirement and file an issue if you think this
can be supported soon?
Regards
*From:*Mauro Talevi [mailto:[email protected]
</mc/[email protected]>]
*Sent:* Sunday, February 10, 2013 10:39 PM
*To:* [email protected]
</mc/[email protected]>
*Subject:* Re: [jbehave-user] User defined keyword
You can define "composite steps" from other defined steps:
http://jbehave.org/reference/stable/composite-steps.html
User-defined keywords are not supported, the only keywords
allowed in the scenario steps are "Given/When/Then/And" but the
rest of the step language is entire up to you to define. You
can also change the existing ones, ie use different values for
them, via i18n support. The idea being that Given/When/Then
represent generic step types (precondition/event/result) and you
should be able to fit comfortably into these types by appropriate
use of the step language that follows.
There is no setup/teardown in the story syntax, i.e. something
executed before and after *each* scenario or story. There is
however :
- GivenStories ... i.e. one or more stories executed on demand
(i.e. on explicit invocation) before scenarios or stories.
- @Before/@AfterScenario/Story/Stories ... i.e. annotated steps
in code that are executed before each scenario/story/group of stories
On 10/02/2013 13:59, Handa, Ramneek wrote:
Hi Guys,
Is it possible for the story writer to create new higher
level steps (which consists of multiple steps)? I am moving
from robot framework and it has this feature of user defined
keywords that i couldn’t find in jbehave website. Could
someone please point me in the right direction?
Also, i would like to know if there is a way for story writer
to write setup/teardown in gherkin?
Regards,
Ramneek
This email and any attachments are confidential and may also
be privileged. If you are not the intended recipient, please
delete all copies and notify the sender immediately. You may
wish to refer to the incorporation details of Standard
Chartered PLC, Standard Chartered Bank and their subsidiaries
at
http://www.standardchartered.com/en/incorporation-details.html.
This email and any attachments are confidential and may also be
privileged. If you are not the intended recipient, please delete
all copies and notify the sender immediately. You may wish to
refer to the incorporation details of Standard Chartered PLC,
Standard Chartered Bank and their subsidiaries at
http://www.standardchartered.com/en/incorporation-details.html.