English 中文(简体)
采用注射方式的集成测试
原标题:Integration testing Grails services with injection

我遇到一体化问题,测试我的铁路服务,因为测试中的服务没有注入我的测试。 我从答复中听到了在Stackover流程上其它问题的意见,但迄今未能得到我的服务。 以下类别列于<代码>/<project_root>/test/integration/com/example:

package com.example

import grails.test.GrailsUnitTestCase

class MyServiceIntegrationTest extends GroovyTestCase {

    MyService service;

    public void testService() {
        assert service != null
    }
}

我曾尝试从指挥线(grails test-app)和从民主选举学会内部执行这两项文书,但两者都导致同样的失败,即service:null。

这是1.3.6英亩。

任何关于如何使我的融合测试发挥作用的建议?

最佳回答

自动电线在一体化测试中与框架其他部分一样发挥作用,因此,除非有适当的不CamelCase,否则,你需要确保财产被称作服务。

class MyServiceIntegrationTest extends GroovyTestCase {
    def myService

}

假设你的工作,就是一个叫我的服务对象。

问题回答

暂无回答




相关问题
Cucumber Cleanup

SO Folk, Anyone around these parts know if you can keep Cucumber from cleansing test data at the end of a run? I ve a few tests that continue to fail and I d like to have a look at the data backing ...

Integration Testing for a Web App

I want to do full integration testing for a web application. I want to test many things like AJAX, positioning and presence of certain phrases and HTML elements using several browsers. I m seeking a ...

Unit Testing CodeIgniter with Simpletest - very few tests

On our development team, we decided to give Unit Testing a try. We use Simpletest. However, it s been a tough road. After a week, I only have created 1 unit test that tests a certain helper file. That ...

热门标签