Cucumber Java : Scenario Outline: Is it possible to update value at runtime

1,064 views
Skip to first unread message

Ramkumar Sivanandan

unread,
Feb 12, 2016, 10:03:58 AM2/12/16
to Cukes

In our cucumber feature file, we are using scenario outline, and we have requirement before running script to populate data at run time.

Based on the city route being passed in the data file, we create PNR using a API which returns me a actual PNR. PNR value created need to be stored in the scenario data table so it can be used in step definition.

If we have Scenario, we can use the DataTable function to access the values inside function. Do we have any class to interact with scenario outline data table

e.g.

Scenario Outline:
  Given user have opened the application
  And verifies if lookup page is loaded successfully
  Then enter <PNR> as confirmation number
  Then enter <LastName> as last name

Examples:
  |DepartureCity|ArrivalCity|PNR|PassengerName|
  |BAH          |AUH        |   |BRUCE WAYNe  |

If you notice, i'm not passing PNR value in the data table as blank, and want to update the value once script execution starts

Based on the route being passed, PNR get created at run time. I want to update the value which i receive from CreatePassengerNameRecord() function

Kindly let me know if existing class or alternative solution to solve this issue.

Andrew Premdas

unread,
Feb 12, 2016, 11:36:23 AM2/12/16
to cu...@googlegroups.com
Cucumber features are not designed to be programmed by external files. If you want to do this sort of thing, you need to do it in the step definitions. To get a better idea of what you are trying to do you should write a scenario for say 3 data instances. Don't use a scenario outline and try and explain what the user is doing, ( it looks like they are booking some sort of ticket ). Perhaps something like

Given I am booking a ticket from BAH to AUH
...

Your current example scenario makes no sense, and doesn't explain what a PNR is, or how the user is supposed to get it, so you'll need to refine your question carefully if you want to get a better response

All best

Andrew



--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
------------------------
Andrew Premdas

Vimal Kumar Chandran

unread,
Aug 8, 2016, 7:47:03 PM8/8/16
to Cukes
Hi Sivanandan,

Did you find any solution for your scenario.. If yes, please tell me the solution. Am also facing the similar scenario.

Thanks,
Vimal.

Ward Poulisse

unread,
Aug 9, 2016, 3:23:40 AM8/9/16
to Cukes
Specflow (the C#-version) handles empty columns really badly but leaving out the column doesn't hurt (and might probably solve your issue, depending on the code-behind).

Also, both of your then-steps look like actions from the user, and therefor should be when-steps.
Reply all
Reply to author
Forward
0 new messages