【发布时间】:2019-12-28 04:54:19
【问题描述】:
在以下情况下,我收到了 AmbiguousStepDefinitionsException,我找不到任何原因导致此问题。请帮忙!
场景
Scenario Outline: Testing the stars hotel filter
When the <star> stars hotel filter is clicked
Then all hotels are <star> stars
Examples:
| star |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
步骤文件
@When("^the ([^\\\"]*) stars hotel filter is clicked$")
public void theStarStarsHotelFilterIsClicked(String star) {
hotelPage.activateStarsFilter(star);
}
@Then("^all hotels are ([^\\\"]*) stars$")
public void allHotelsAreStarStars(String star) throws InterruptedException {
hotelPage.checkHotelStars(star);
}
@When("^the ([^\\\"]*) filter is clicked$")
public void thePriceOrderFilterIsClicked(String priceOrder) {
hotelPage.activatePriceFilter(priceOrder);
}
错误
cucumber.runtime.AmbiguousStepDefinitionsException: ✽.When the 5 stars hotel filter is clicked(hotelSearches.feature:16) matches more than one step definition:
^the ([^\"]*) filter is clicked$ in HotelSearchesSteps.thePriceOrderFilterIsClicked(String)
^the ([^\"]*) stars hotel filter is clicked$ in HotelSearchesSteps.theStarStarsHotelFilterIsClicked(String)
【问题讨论】:
标签: java automation cucumber