-1

I have a case where I have cucumber scenario outline with 3 examples and each example is generating some data which I need to store it in hashmap. For example-

Example1 generates- acct no.- abc
Example 2 generates - acct no. - def
Exmaple 3 generates - acct no. - ghi

I want to store it like acct[0]-abc, acc[1]-def, acc[2]-ghi

Right now if use map.put it overrides the first value. Please help me that how to keep on appending the hashmap or ow to use the same map for all three examples.

I tried using map.put and its oveerides the first value

GhostCat
  • 137,827
  • 25
  • 176
  • 248
PG2009
  • 1
  • 1
  • 4
    It would help a lot if you edit this question and add the code that you have so far. (in between triple-backticks so it formats nicely). – rzwitserloot Mar 31 '22 at 12:38

1 Answers1

0

A scenario outline is just a 'quick' way of writing several single scenarios. As each scenario runs independently and in its own context you can't get the results of all your scenarios into one data structure.

Your data structure isn't being overwritten its being discarded as the scenario ends and recreated as the next scenario starts.

You would have to write a single scenario (no outline) to be able to do what you describe.

diabolist
  • 3,990
  • 1
  • 11
  • 15