My cuke4duke tests hang and never terminate
I can't work out why my web based cucumber tests never terminate. All step definitions pass but the browser never exit on the last step and therefore my script is hanging.
I'm currently running cuke4duke (0.4.3), Geb(0.5.1), maven(2.2.1), selenium-firefox-driver/selenium-chrome-driver (2.0a6 and a7)
I've tested my scripts in Chrome and Firefox (3.6) / Windows XP and Ubuntu without any success.
Here is the output from my maven build
[INFO] Scenario: Nav开发者_开发知识库igate from homepage # features/helppage.feature:7
[INFO] Given I am on the homepage # Helppage$_run_closure1@f93ee4
[INFO] When I click on the about page # Helppage$_run_closure2@1c87031
[INFO] Then the title should display "About Google" # Helppage$_run_closure3@1f784d7
[INFO]
[INFO] 1 scenario (1 passed)
[INFO] 3 steps (3 passed)
[INFO] 0m5.421s
HANGING HERE
Env.groovy
import geb.Browser
import org.openqa.selenium.chrome.ChromeDriver;
this.metaClass.mixin(cuke4duke.GroovyDsl)
Before() {
new Browser(new ChromeDriver(),'http://www.google.com')
}
After() {
clearCookies()
}
helppage.groovy
this.metaClass.mixin(cuke4duke.GroovyDsl)
Given (~/I am on the homepage/) {
go('/')
}
When (~/I click on the about page/) {
go('/intl/en/about.html')
}
Then (~/the title should display "(.*)"/) { pageTitle ->
assert title == pageTitle
}
I'm not able to work out if the problem is in webdriver or in the cuke4duke distribution or anywhere else. I'm also not sure how I can add more debugging to the maven build in order to find out what is going wrong.
I think you need to call quit()
on the Browser (you'll probably need to save a handle to it in your Before()
hook).
I don't have time to test it for sure - we've moved from cuke4duke to cucumber-groovy, but I think it's actually a Geb Browser issue you're seeing here.
Have you tried running it without cuke4duke?
I found cuke4duke quite interesting but decided to even drop JRuby (not sure if you are using that) and go with a straight ruby installation, which is faster and more reliable.
Try updating to the latest jRuby (1.6.0). Might be related to this issue: Cucumber 0.4.3 (cuke4duke) with java + maven gem issues
精彩评论