0

I have a behave test where I would like to have part of the data inside a behave table to be generated after a step has executed. E.g.

Given I have a step
When I executed some other step
Then the message should have the following data
     | field | value |
     | a     | 20    |
     | b     | 30    |
     | var   | <val> |

Once the when step has been executed, I would like to modify <val> to some value depending on that step.

nnja
  • 325
  • 3
  • 15
  • Why would you need that? How could someone reading it interpret a scenario like that? Perhaps you could use an additional line instead of trying to include it in the table, like this "Then the var in the message should match the magic number coming from who-knows-where" – Szabo Peter Oct 20 '16 at 06:50
  • @SzaboPeter What i mean was that you would write the feature file like that but then the logging on the console (and the JUnit XML generated) would have the value. I'm not sure about this but I think this is similar to model-based testing – nnja Oct 21 '16 at 02:56

1 Answers1

1

Probably you can combine these two steps together and in that step:

  1. do what you do for your 'when' step
  2. do a context.execute_steps with parameters, for example:

context.execute_steps(u'''Then doing something with "you_parameters"'''.format(you_parameter=value)

And of course you can do context.execute_steps with a table having the data you generated

Chong
  • 335
  • 2
  • 9