[英]Grails unit test fails sometime
I have unit test which in setup creates 4 users (mocked). 我有单元测试,在安装中将创建4个用户(模拟)。 Everything was fine until I upgraded to grails 2.2.4.
一切都很好,直到我升级到grails 2.2.4。
Now, sometimes the test only creates the last users, and then fails on asserts (naturally). 现在,有时测试仅创建最后一个用户,然后断言失败(自然)。
Has anybody been in the situation? 有人来过吗?
I have looked at test pollution, but the test order (when it creates all 4 users vs only last user) is the same! 我看过测试污染,但是测试顺序(创建所有4个用户与仅创建最后一个用户时)相同!
In my case, i was missing to mock some domain class. 就我而言,我缺少模拟某些域类的机会。 I just added the class in the @Mock annotation, and everything is working normally now.
我只是在@Mock批注中添加了该类,现在一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.