Friday, 18 April 2008

TaskMaster - Day 2

Today was testing day. Having previously done no testing on Grails, there was some reading involved. Much frustration was involved in trying to get the test to run. There was light at the end of the tunnel when this, under the section 'Testing Domain Classes' was found. Basically the need to flush while saving, to make sure it all flows to the database.

The light that was the flush was quickly snuffed out by the bold, hated 'FAILURE' from the test run. Much despair ensued. After some gritting of teeth and grinding of stone, the reason for the failed test surfaced. Apparently dates are not welcomed and with their exclusion, 'SUCCESS' was assured.

Now to properly build the test classes...

More information (or not) here :)

1 comment:

fauzan said...

Actually, I tried doing the tests without flushing and it works!

Regarding using Date, it seems that in the groovypublishing example, although Post.groovy has the Date lastUpdated property, it was not mentioned in testCrud when doing a new Post(). The same goes for the SortedSet comments property.