我创建了一个使用cucumber和geb的gradle项目。我的编程语言很棒。我的所有步骤文件都位于com.bada.bada.bada.ucumber.step
Feature:
User usecases
@Login
Scenario: Login User to website
Given I am on the mywebsite
And I log in with a valid username and a valid password
When I see profile
Then I can see my profile image
我的Hook代码是
this.metaClass.mixin(cucumber.api.groovy.Hooks)
this.metaClass.mixin(cucumber.api.groovy.EN)
Before("@Login") {
// Go nuts
}
如果钩子的定义在com.bada.bada.bada.ucumber.step.SomefileSteps.groovy中,那么钩子会被识别,但如果它存在于com.bada-bada.bada.ccumber.hooks.SomeHooks.groovy中,那么它就不会被识别。
为什么这是一个问题?
Glue目录未更新。更新这些解决了问题。