我的问题与这个问题非常相似:Behave: Writing a Scenario Outline with dynamic examples。不同之处在于我不使用 Python。我使用 Cypress 处理我的 Gherkin 场景(通过 cypress-cucumber-preprocessor 库:https ://github.com/TheBrainFamily/cypress-cucumber-preprocessor )。
假设我有这个场景大纲(写在我的 Jira 中):
Given I provide <a list of numbers> and <another list of numbers>
Then I check wether they are equals
Examples:
| list of numbers | another list of numbers |
| 1 | 1 |
| 100 | 200 |
我想动态设置我的号码,因为我将从 REST 调用中收到它们。有没有办法做到这一点?
在具有行为的 Python 中,似乎可以使用 before_feature() 来做到这一点。
场景是这样的:
Given I provide <a list of numbers> and <another list of numbers>
Then I check wether they are equals
Examples:
| list of numbers | another list of numbers |
| . | . |
但我不知道如何迭代我的示例来设置它们。可能吗?