English 中文(简体)
Grails - Save(a) 未能在一体化测试中进行失修
原标题:Grails - save() failing with MissingMethodExcepition in integration test

I m 学习农业/铁路,撰写我的第一份融合测试。

它目前未能做到:

groovy.lang.MissingMethodException: No signature of method: com.mangofactory.scurry.User.save() is applicable for argument types: () values: []

我的考验是没有做任何事:

class UserEventControllerTests extends ControllerUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testAddingAUser()
    {
        def user = new User(emailAddress: "martypitt@test.com")
        user.save()
    }
}

当我通过铁路提供的有条不紊的页面时,向该实体节省费用。

我错了什么?

最佳回答

如果你想要进行一体化测试,就不应延长单位测试基级之一,从而改变它。

class UserEventControllerTests extends GroovyTestCase {
...
}

并确保测试/融合,而不是测试/统一。

但我们认为,你希望测试一名控制员(称为用户名册测试员),该控制器应延伸到<代码>《总注册号<>。 如果是这样的话,你就应当进行单位测试,但改变域层(使用<条码>mockDomain等),因为你想要把重点放在控制逻辑上,而不是坚持。 利用数据库进行适当融合测试的试验领域。

http://grails.org/doc/latest/"rel=“nofollow”

问题回答

暂无回答




相关问题
Groovy - how to exit each loop?

I m new to Grails/Groovy and am trying to find a node in a an xml file; I ve figured out how to iterate over all of them, but I want to exit the loop when the target node is found. I ve read that ...

Eclipse Spring Builder set properties with Groovy beans

I typically use groovy to construct simple bean but the Spring IDE plugin to eclipse fails to build when I try to set a property that is generated by groovy without an explicit setter. For example, ...

How can I get this snippet to work?

I d like to port a little piece of code from Ruby to Groovy, and I m stuck at this: def given(array,closure) { closure.delegate = array closure() } given([1,2,3,4]) { findAll { it > 4} ...

Changing the value in a map in Groovy

This is about a very basic program I m writing in Groovy. I have defined a map inside a method: def addItem() { print("Enter the item name: ") def itemName = reader.readLine() print(...

Is functional Clojure or imperative Groovy more readable?

OK, no cheating now. No, really, take a minute or two and try this out. What does "positions" do? Edit: simplified according to cgrand s suggestion. (defn redux [[current next] flag] [(if flag ...

热门标签