Archive for April 2011
-
mysql based ORM for node.js
No tags
From the “I didn’t know that was possible” department:
Apparently by defining an abstract method on an enum the actual values can provide their own implementations of that method. Discovered this recently while digging around in some open source project. Handy.
No tags
Gradle has been my new pet interest lately… it gives me the out of the box power of maven and an awesome amount of control over my builds that I have only seen in rake and capistrano. Recently I’ve been day dreaming of an idea: a multi-module project setup containing a web application and a integration test module that starts the webapp up using jettyRun, runs integration tests against it, then shuts down and reports the results. In the spirit of starting small, I figured I’d first investigate the integration test portion of this by looking into geb’s easyb integration and seeing if I could get the example from the site running.
Getting It
Getting it setup is easy enough, the only gotcha is that you’ll have to specify the webdriver and easyb dependencies for the application as geb doesn’t bring these in transitively. So let’s start with a fresh build.gradle:
Running It
Now we need to figure out someway to run easyb from gradle. The awesome thing about gradle is that we can use any existing ant tasks out there programatically so we can just steal easyb’s bundled ant task and go strong. So lets add a new execution to run at the end of the test task.
This is setup to pick up any files that end with *.story under the src/test/stories directory and execute then as easyb stories, generating an output file under the test output directory.
Finally, let’s run the example from the geb integrations page by creating a new story file src/test/stories/look-for-chuck.story.
I know I know, you don’t look for Chuck Norris he finds you blah blah blah. Moving on, we can execute this by running gradle test from the project directory. If all goes well the build will succeed and we’ll find the results in build/test-results/story.html. If the build fails we should also be able to find some clues as to why the test failed. One particular pitfall to take note of is that the easyb+geb from the manual doesn’t work in real browsers due to auto-complete. I tend to favor htmlunit-driver because I don’t like tons of web browsers popping up while tests execute but I’m sure that the example could be made to work. It just isn’t what I’m concerned with at the moment.
Running This Example
The example project I created to try this out is available on my githuib account as gradle-easyb-geb-example so feel free to clone it and give it a spin. Let me know if you have any issues getting it running.
Next
Next up I’ll try creating a multi-module setup with a spring-mvc web application and an integration module to run easyb+geb stories against it. Stay tuned!
No tags
-
Way cool geb integration with easyB story specifications
No tags
