Cucumber 黄瓜黄瓜模糊定义问题

Cucumber 黄瓜黄瓜模糊定义问题,cucumber,gherkin,Cucumber,Gherkin,我有一个模棱两可的步骤定义的感觉,我不知道为什么我会得到第三个错误。我怎样才能避开它 And I look for an apple in yellow basket with the following items or And I look for an apple in basket with the following items @When("^I look for an? (apple|pear|grape) in (.*) basket

我有一个模棱两可的步骤定义的感觉,我不知道为什么我会得到第三个错误。我怎样才能避开它

      And I look for an apple in yellow basket with the following items
or
      And I look for an apple in basket with the following items


        @When("^I look for an? (apple|pear|grape) in (.*) basket with the following items:$")
        Public void findStoreItems(String fruit, Map<string,String> itemList)

        @When("^I look for an? (apple|pear|grape) in basket for the shop with the following items:$)
        Public void findColorItems(String fruit, String color, Map<string,String> itemList)
我要找一个装在黄色篮子里的苹果,里面有以下物品
或
我想买一个篮子里的苹果,里面有下列物品
@当(“^我在(.*)篮子里找一个?(苹果、梨、葡萄)和下列物品:$”时
Public void findStoreItems(字符串水果、映射项目列表)
@当(^我在商店的篮子里找一个?(苹果|梨|葡萄)和下列物品时:$)
Public void findColorItems(字符串水果、字符串颜色、映射项列表)
执行时使用
--guess

这将解决不明确的匹配错误

例如:

cucumber path_to_file.feature --guess
执行时使用
--guess

这将解决不明确的匹配错误

例如:

cucumber path_to_file.feature --guess
这是您的(.*)正则表达式。它可能毫无意义。我使用“([^”]*)”并将我的形容词(本例中为颜色)括在引号中。或者您可以使用(+++),它至少需要一个字符来匹配,并且应该消除歧义

And I look for an apple in "yellow" basket with the following items

顺便说一句,我没有问你,但是你错过了你的文章。作为一名软件测试人员,这让我感到“不舒服”;-)

这是你的(.*)正则表达式。这可能毫无意义。我使用“([^”]*)并将我的形容词(本例中为颜色)括在引号中。或者您可以使用(+++),它至少需要一个字符来匹配,并且应该消除歧义

And I look for an apple in "yellow" basket with the following items

顺便说一句,我没有问过你,但是你错过了你的文章。作为一名软件测试人员,这让我很讨厌;-)


你确定你在问题中输入的正则表达式与你的代码相同吗?如果是,那么我不确定你为什么会出错。你确定你在问题中输入的正则表达式与你的代码相同吗?如果是,那么我不确定你为什么会出错。虽然这可以解决错误,但它可以通过pi来解决正在选择一个不正确的步骤定义来执行。请谨慎使用!虽然这将解决错误,但它可能会选择一个不正确的步骤定义来执行。请谨慎使用!