我有一个网站,可打开一个对话框,您可以在其中添加电子表格等信息行。窗口中显示的总计金额总计表中的一列项目(在用户单击“保存”之前)。用户完成信息编辑后,单击“保存”,这将关闭窗口并将信息发送给服务器,服务器将处理数据并根据输入的数据使用更多的计算值更新前端。
使用Gherkin,Cucumber和nightwatch.js,我需要在用户单击保存之前测试窗口中的总显示,但是我还需要在用户单击保存之后测试窗口外的值。但是从我对小黄瓜的理解来看,有两个when语句是不好的做法。但是,如果我将其分为两个方案,它们将相互依赖。
我现在所拥有的:
Scenario: Modify data in the data window
Given the window is open
When I modify the data inside the window
Then the total amount should reflect that change
When I click save
Then the data should save
And the processed data should reflect my changes
答案 0 :(得分:0)
我会这样写场景:
Scenario: Modify data in the data window
Given the window is open
When I modify the data inside the window
Then the total amount should reflect that change
And I click save
And the data should save
And the processed data should reflect my changes
-但是-没有理由不能将其分为两种情况,因为它们会顺序运行
Scenario: Modify data in the data window
Given the window is open
When I modify the data inside the window
Then the total amount should reflect that change
Scenario: Save data in the data window
Given I have modified data inside the window
When I click save
Then the data should save
And the processed data should reflect my changes