-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't build domain class in Grails 2.1.4 app #1
Comments
Looks like grails 2.1.4 has a pretty big change to how they're mocking domain classes in unit tests. The release notes specify that you need to manually I was able to get your test to pass by also calling
Not optimal, but apparently they did it for performance reasons. That change removes BTDs ability to "know" what classes are related to each other in unit tests and this is the unfortunate side effect. Integration tests should be fine, but for performance reasons the grails authors have made the decision to push the wiring knowledge onto the unit test to explicitly define. |
I believe this is fixed in the 2.0.5 RC that I've been testing. I'll merge it into master and push out a release next week. I should have done it awhile ago but have been sidetracked. The changes make BTD more friendly with some of the recent grails changes. -Aaron On Apr 19, 2013, at 8:52 PM, Ted Naleid notifications@github.com wrote:
|
I just tested the attached application with what is currently in the BTD develop branch and the test passes with no changes. The problem with 2.1.4 and later is that the mockDomain method changed in the grails mixins to take all fo the domains at once in order to optimize. BTD was always automatically mocking required, associated objects but in the new scheme those need to be determined entirely upfront and the newer method used or it doesn't seem to work properly. The latest code does that properly and is able to take advantage of the perf improvements in Grails at the same time. Also, 2.0.5 fixes a number of other performance issues that were introduced in 2.0.3 and 2.0.4, mostly in unit tests. |
I pushed out a 2.0.5 release which fixes the issues you are seeing. Please upgrade and let me know if you still have problems. |
thanks for addressing this so quickly, I'll check this out on Monday and report back here |
Upgrading to 2.0.5 fixed my unit tests failing, as well. Good work and thank you! |
while 2.0.5 reduced the number of errors i see, i still got some MissingMethodExceptions for MyDomain.addToMyHasManys(). anyhow, adding @mock for those makes it work. |
Assuming this is fixed, please comment if there are still issues here. |
I'm trying to use the v. 2.0.4 to build test data in a unit test of a Grails 2.1.4 application. The app has the following domain classes
Then in my unit test I try to build an instance of PageTag with
But it fails with the error
My example looks exactly the same as that shown in the plugin's docs, so I've no idea why this isn't working. A sample app that demonstrates the issue is available here
https://bitbucket.org/tednaleid/grails-test-data/issue-attachment/69/tednaleid/grails-test-data/1366373541.27/69/btd-bug.zip
The text was updated successfully, but these errors were encountered: