I was out of offfice, so had no time to review your patch. The current commit seems to leave the checkout unclean after running tests; my response to the failure mail:
it looks like Dawid's commit placed these .tests.totals files in the wrong directory. Should be inside build! Maybe some property is incorrectly initialized.
So I would rewrite the <scriptcondition> to a simple <groovy/> executed before the condition task, which sets a property thats used by the condition. Or alternatively directly throw a BuildException in the groovy without using a scriptcondition at all.
I can provide a patch tomorrow.