A new minor release of the Grails WebTest plugin to allow the plugin to download the latest WebTest snapshot (which uses HtmlUnit 2.5 which fixes issues with testing JQuery 1.3.2).
It will download the latest snapshot by default when installed. If you would prefer the latest stable release (3.0) you can answer no when prompted.
Thursday, April 30, 2009
Testing a JQuery-UI Drag and Drop using WebTest
Just a quick post regarding using WebTest with JQuery-UI Draggable and Droppable.
The way that WebTest performs a drag and drop is as follows:
What this means is that you need to configure your Draggable to start dragging on mousedown without delay. You can do this by setting the distance and delay options to zero (delay is zero by default):
The way that WebTest performs a drag and drop is as follows:
from.mouseDown() to.mouseOver() to.mouseUp()Note that there is no intermediate move events between mouse down on the thing you're dragging and mousing over the target element.
What this means is that you need to configure your Draggable to start dragging on mousedown without delay. You can do this by setting the distance and delay options to zero (delay is zero by default):
$('.block').draggable({distance:0});WebTest will now be able to click and drag it correctly. Unfortunately due to HtmlUnits 'renderless' behaviour you cannot specify exactly where you want to drop it so if you require precise targeting to properly test your application you're out of luck.
Saturday, April 4, 2009
Grails WebTest Plugin 1.1.4 Released
Another WebTest plugin release, this time with some new functionality!
Soenke Sothmann has contributed a nice patch to allow you to run custom suites of tests:
run-webtest -suite=MyTestSuite
Note that under windows you will need to quote the -suite argument due to an issue with Gant's argument parsing e.g. "-suite=MyTestSuite"
import grails.util.WebTest class MyTestSuite extends WebTest { static void main(args) { new MyTestSuite().runTests(args) } void suite() { new SomeTest1(ant:ant).suite() new SomeTest2(ant:ant).suite() // You could also load up certain tests based on naming conventions or annotations } }
In addition to this patch, there were some bug fixes relating to running webtests under Hudson and also around setting a custom port when starting up the server.
Wednesday, April 1, 2009
Comments
Apologies to those people who left me comments to which I hadn't replied. I thought I had email notification turned on - looks like I didn't! I've replied as best I could although some of the topics are well out of my recent memory :)
cheers
Lee
cheers
Lee
Tuesday, March 31, 2009
Grails code example: Integration testing quartz job
Here's a quick snippet to use to integration test a quartz job.
I couldn't find a clear example after a quick Google so hopefully this is useful.
There's a good chance that there's a better auto-magical way to get the job injected but I haven't poked through the testing code to work it out :)
I couldn't find a clear example after a quick Google so hopefully this is useful.
There's a good chance that there's a better auto-magical way to get the job injected but I haven't poked through the testing code to work it out :)
package au.com.refactor class TempCleanerJobTests extends GrailsUnitTestCase { def tempCleanerJob def grailsApplication protected void setUp() { super.setUp() tempCleanerJob = grailsApplication.mainContext.getBean(TempCleanerJob) } protected void tearDown() { super.tearDown() } void testCleanNothing() { tempCleanerJob.execute() } }
Monday, March 30, 2009
Grails WebTest Plugin 1.1.2 Released
I've just released the latest version of the WebTest plugin for Grails. This was an update to fix a couple of issues with interactive mode use and parameter parsing and to de-couple the WebTest distribution zip.
Highlights
- run-webtest now supports -headless to stop the Swing progress gui being shown during test runs (this was previously possible via system properties, this is just a tidy up)
- install-plugin webtest will now prompt you to download WebTest (currently version 3). It installs it into your .grails directory by default or you can answer 'n' and manually set the install location via webtest/conf/webtest.properties using wt.config.home
Tuesday, February 24, 2009
Grails WebTest Plugin 1.1.1 Released
I've released an updated version of the WebTest plugin which is compatible with Grails 1.1.
It also has the latest WebTest release and a couple of small bug fixes.
If you are on 1.0.x DO NOT UPGRADE, stay with 0.6.
It can be installed via:
It also has the latest WebTest release and a couple of small bug fixes.
If you are on 1.0.x DO NOT UPGRADE, stay with 0.6.
It can be installed via:
grails install-plugin webtest
Subscribe to:
Posts (Atom)