Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Hi I want to generate dynamic data in the cucumber tables:

Feature: Generate dynamic data

 Scenario Outline:
 
  When open url

  Then get the price list and save to "Price List" in context 

  #Note: Price list is an array and returned as [10, 20, 30, 40] and this is dynamic

  When send "<singlepricelist" to server

  .......the remaining steps....

 Examples:

 | singlepricelist |

 | <<Price List   |

Question: In the step "When send "", I want to send the values present in arraylist one by one i.e. the said step in this example should run 4 times with the values 10, 20, 30 and 40.

Can I generate the dynamic data in the Examples so that the above step will run 4 times? Note: singlepricelist can take only one value at a time.

Thanks in Advance !!!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
196 views
Welcome To Ask or Share your Answers For Others

1 Answer

First of all, you cannot use the feature file to do any programming. So you cannot pass dynamic values from the feature file.

If you want to perform the above scenario with the listed values (10, 20, 30 and 40), you can add each of them as an example.

If you want the values to be dynamic / random, you can implement this in your step definition. In that case, rather than sending the values from your feature file, you would generate them in the implementation of your step definition. In that case I don't understand why you would want to run it 4 times.

To be honest, I don't understand your use case from the question. Can you explain the reason you want to send 4 dynamic values? (what is the problem you are trying to solve with this?)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...