On 27/06/2011, at 6:07 PM, netextzhwa wrote:
> Thanks a lot Luke!
>
> It's great if this can be improved :)
>
> What I want to achieve is to programmatically detect if a user-login module
> has broken on our website. So that I have a Geb test to do login and assert
> it's success. And I want to do the same geb test twice if the first test
> failed, and if it failed again I want to do some work to fix the problem.
> And so that comes this script.
>
> Then I have this script running in Hudson CI to continuously build and run
> test.
>
> I was thinking to have two Geb test classes with the same function but not
> the same name, and to use taskA and taskB call them separately. But this
> seems not improving the script much now.
Using a testing framework is overkill here and making things harder than they
need to be. You could use Geb directly in your build script which is probably a
better fit here.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.codehaus.geb:geb-core:0.6.0",
"org.seleniumhq.selenium:selenium-htmlunit-driver:2.0rc3"
}
}
task checkWebSite << {
geb.Browser.drive {
config.reportsDir = file("$buildDir/checkWebSite")
go "http://mywebsite"
report "front page"
assert $("h1").text() == "My Website"
}
}
--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email