xiaochong / zkui

Grails ZK UI Plugin
http://grails.org/plugin/zkui
GNU Lesser General Public License v3.0
24 stars 8 forks source link

Improved Grails 2.0.x by using TestMixin #52

Closed herrvendil closed 12 years ago

herrvendil commented 12 years ago

Hi

First of all thanks for a great plug-in.

But I've been having trouble with performing unit + integration tests with mocked domain classes in Grails 2.0.x, When testing a composer I have been using the old mockDomain way, but that seems to break other unit tests that uses the never TestMixin way of Mocking.

I have written my own version of ComposerUnitTestMixin that works for me. I may need some improvements before it can be generally used but it maybe of some help to others in doing this kind of test suite as well.

The code is:

package grails.test.mixin.web

import grails.artefact.Enhanced; import grails.test.ComposerMockUtils; import grails.test.mixin.support.GrailsUnitTestMixin import groovy.lang.MetaClass; import org.codehaus.groovy.grails.commons.metaclass.MetaClassEnhancer

/**

And in the test scripts I have used the following header: import grails.test.mixin. import grails.test.mixin.support. import grails.test.mixin.web.ComposerUnitTestMixin

@TestMixin(ComposerUnitTestMixin) @Mock(Resource) class MainComposerTests { ....

}

herrvendil commented 12 years ago

Sorry for the bad formatting, but i cannot find any way to attach text files to the issue.

It should be a capital M on Mock(Resource)

xiaochong commented 12 years ago

Good,thank you for your contribution.I will merge it in v0.5.1

BTW,you can contribute your code by pull requests.

xiaochong commented 12 years ago

0.5.1 Release,but remove the "extends GrailsUnitTestMixin" that not support for grails 1.3.7