如何从另一个场景执行场景?

时间:2016-03-05 18:34:34

标签: python-behave

下面是我想在另一个场景中执行场景的示例。有没有办法做到这一点?

Scenario: scenario-A
   Create an object obj-A
   Read  'key1' from the object obj-A

Scenario: scenario-B
   Step1: Create an object obj-B
   Step2: Read 'key2' from obj-B
   Step3: # I want to execute scenario-A here. This gives me value of 'key-1'
   Step4: Perform an operation using 'key1' and 'key2'

1 个答案:

答案 0 :(得分:0)

使用context.execute_steps()从另一个步骤重建您的方案或方案的一部分。我认为有必要让您的第二个场景更加精简,并专注于要测试的内容,但是在以后的维护中要小心。