1

次のように2つの簡単なシナリオを作成していました:

Scenario: 1
Given I am on the homepage
When I click the expand arrow
Then the drawer is expanded

Scenario: 2
Given the drawer is expanded

問題は、最初のシナリオの THEN と 2 番目の GIVEN がキュウリによって次のように記述されていることです。

Then /^the drawer is expanded$/ do
Given /^the drawer is expanded$/ do

そして、次のエラーメッセージが表示されます。

Ambiguous match of "the drawer is expanded"

実行しようとすると。

このあいまいな手順を回避する方法はありますか?

どうもありがとう!

4

1 に答える 1

0

2 つのステップが異なるように、ステップを書き直すことをお勧めします。

これを行う 1 つの方法は、Pat Maddox のRewriting Ambiguous Cucumber Stepsブログ投稿での提案に従い、2 番目のシナリオを次のように書き直すことです。

Scenario 2
Given that the drawer is expanded
于 2012-12-12T04:16:29.443 に答える