Search code examples
automated-testsbddjbehave

jbehave writing a story step in multiple lines


I have a step which is long enough not to be fully visible due to the number of parameters it has. I want it to split in two lines but when I do so the step is not recongnised.

When CC payment is made with amount=100 type=VISA name=card-holder-name number=1234567890123456
    verification code=000 expiry month=09 expiry year=14

Is there a way to make this happen?


Solution

  • When I have a lot of parameters in a single step I use a table parameter with the transformer=FROM_LANDSCAPE option, like this:

    {transformer=FROM_LANDSCAPE}
    |amount           |100|
    |type             |Visa|
    |name             |card-holder-name|
    |number           |1234567890123456|
    |verification code|000|
    |expiry month     |09|
    |expiry year      |14|
    

    http://jbehave.org/reference/stable/tabular-parameters.html

    Another way is to set all your parameters before with the @Given annotation