0

I am getting the following error when including in Mixin Build in unit tests:

TestDataConfig.groovy not found, build-test-data plugin proceeding without config file

it works like charm in the integration tests but not part of unit tests. I mean, 'build' plugin works itself in unit test but the 'TestDataConfig' is not populating default values

Thank You

latvian
  • 3,161
  • 9
  • 33
  • 62

2 Answers2

2

First you should verify the version from build-test-data in your BuildConfig.groovy

test ":build-test-data:2.0.3"

Second, check your test. If you want build objects you need:

import grails.buildtestdata.mixin.Build
...
@TestFor(TestingClass)
@Build([TestingClass, SupportClass, AnotherClass])
class TestingClassTest{
    @Test
    void testMethod{
        def tc1 = TestingClass.build()
        def sc1 = SuportClass.build()
        def ac1 = AnotherClass.build()
    }
}

Third, check the domains constraints, you could have some properties validations like unique that fails when you build two instances. You need set that properties in code:

def tc1 = TestingClass.build(uniqueProperty: 'unique')
def tc2 = TestingClass.build(uniqueProperty: 'special')
AA.
  • 4,496
  • 31
  • 35
  • Thank you for response. I am not sure what happened but it seems to be functioning now...as i play more with it i will get clarity what happened and post exactly the problem there was. Thanks again – latvian Aug 28 '12 at 15:24
  • Agree with the comment below - should be a `test` dependency not a compile one, surely? – Armand Aug 22 '13 at 08:05
  • It's true. I simply paste it from plugin page. Answer edited. – AA. Aug 22 '13 at 13:34
1

I guess the dependency should be:

test ":build-test-data:2.0.3"

Since is just used for testing, right?

tproenca
  • 136
  • 1
  • 6