我可以将一个示例用于多个场景大纲

问题描述 投票:0回答:1

这是我正在使用的代码:

Scenario Outline: Fill <answers> for Shares
  When Select one of "<answers>" from Shares
  Then One of the Shares dropdown "<answers>" will be visible

 Scenario Outline: Fill <answers> for Forex
  When Select one of "<answers>" from Forex
  Then One of the Forex dropdown "<answers>" will be visible

Examples:
  | answers    |
  | Frequently |
  | Sometimes  |
  | No         |

但是我得到的错误是第一个Scenario Outline没有例子。重点是:这个例子是重复的,所以我问我可以使用一个例子表来表示多个场景大纲吗?

cucumber feature-extraction python-behave
1个回答
0
投票

场景大纲必须有例子。您可以使用以下单一场景大纲和所有选项。

Scenario Outline: Fill <answers> for Forex
  When Select one of "<answers>" from <type>
  Then One of the Forex dropdown "<answers>" will be visible
Examples:
  |type   | answers    |
  |forex  | Frequently |
  |forex  | Sometimes  |
  |forex  | No         |
  |shares | Frequently |
  |shares | Sometimes  |
  |shares | No         |
© www.soinside.com 2019 - 2024. All rights reserved.