我的应用程序中有四个非常相似的部分,并且我尝试使用场景大纲将足够相似的测试组合在一起以方便维护,并将它们所在的部分(页面)作为参数提供。但是,这些测试单独编写时在其数据表下包含不同数量的项目(但仍执行相同的断言),所以我想知道是否可以为每个示例部分提供不同的数据表?
就像是:
Scenario Outline: Verify that the user is able to see the details recorded on the note
And I navigate to the "<page>" screen
Then the following items are displayed for their respective fields
@page1
Examples:
Then the following items are displayed for their respective fields
| field | text |
| title | My title |
| history | My history |
@page2
Then the following items are displayed for their respective fields
| field | text |
| comment | My comment |
| details | My details |
| status | My status |
注意我省略了 page 参数,因为不确定它应该去哪里,好像做下面这样的事情意味着它们将在每个示例中运行多次
@page1
Examples:
Then the following items are displayed for their respective fields
| page | field | text |
| page1 | title | My title |
| page1 | history | My history |
我也不能有类似的东西:
Scenario Outline: Verify that the user is able to see the details recorded on the note
Then the following items are displayed for their respective fields
@page1
Examples:
Then the following items are displayed for their respective fields
| field | text | item1 | item2 |
因为这些数量会发生变化,所以我可以在一个页面上测试三个项目,但另一个页面上有两个项目,另一个可能有四个项目。
我希望我对我想要实现的目标足够清楚?
非常感谢。