Here's an example of dynamic lookup via a parameter converter method:
https://github.com/jbehave/jbehave-core/blob/master/examples/core/src/main/java/org/jbehave/examples/core/steps/TraderSteps.java
Look for:
publicTraderretrieveTrader(Stringname);
On 05/04/2015 16:07, Patel, Nikunj (GE Healthcare) wrote:
Thanks Mauro.
Can you please guide to the example (if any)?
Thanks,
Nikunj
*From:*Mauro Talevi [mailto:mauro.tal...@aquilonia.org]
*Sent:* Saturday, April 04, 2015 11:01 AM
*To:* dev@jbehave.codehaus.org
*Subject:* Re: [jbehave-dev] Override step in Jbehave
Hi,
thanks for explaining your scenario. In this case, a custom
ErrorMessage type and a custom converter that looks up the translation
in a file or database would seem your best option.
Let use know if you encounter problems in its implementation.
Cheers
On 03/04/2015 14:38, Patel, Nikunj (GE Healthcare) wrote:
HI,
This is one the option we are thinking for i18n testing.
I know JBehave have i18n testing example but we don’t want to
convert entire story file in language we supporting. We only want
to convert labels and messages in different language and test and
keep everything in English. We are planning to have converted text
in multiple languages available in files (key/values) or database.
Using below example, error message or label “abc” will be in
English, then using language files we convert values to
appropriate language(language set in application.properties)
before do compare with actual value. Now, we want to include this
converted text in the HTML report.
One other option I was thinking to these message in story example
template and use meta filter but there are so many and we don’t
want to maintain in feature file.
What do you suggest we should do to test this kind of scenario?
Thanks,
Nikunj
*From:*Mauro Talevi [mailto:mauro.tal...@aquilonia.org]
*Sent:* Friday, April 03, 2015 6:15 AM
*To:* dev@jbehave.codehaus.org <mailto:dev@jbehave.codehaus.org>
*Subject:* Re: [jbehave-dev] Override step in Jbehave
It's possible if you define your own custom converter, but it
should be associated to a custom parameter type, e.g. ErrorCode.
Then you implement the value conversion logic in the parameter
converter.
That said, it does not really seem very logical to do this.
What's your usecase?
On 03/04/2015 03:00, Patel, Nikunj (GE Healthcare) wrote:
Hi,
Is there any way in Jbehave we can override step with
converted parameter values?
Here is what I am trying to do:
For Example:
I have step in feature file- Then error message “abc” should
be displayed.
Let’s see I am converting string from “abc” to “xyz”.
Now, I want to override feature file step with converted value
and see HTML report like- Then error message “xyz” should be
displayed.
Thanks,
Nikunj