Grails 3.0.x插件无法与数据库运行集成测试

时间:2015-08-05 16:17:34

标签: grails integration-testing grails-plugin

当我跑步时

grails create-app some-app

grails create-integration-test SomeTest

有一个非常复杂的测试:

expect:
1 == 1

它运作得很好。我更新build.gradle

时也一样
dependencies {
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.grails:grails-dependencies"
    compile "org.grails:grails-web-boot"

    compile "org.grails.plugins:hibernate"
    compile "org.grails.plugins:cache"
    compile "org.hibernate:hibernate-ehcache"
    compile "org.grails.plugins:scaffolding"

/**/compile  'org.postgresql:postgresql:9.4-1201-jdbc41' /**This is new**/

    runtime "org.grails.plugins:asset-pipeline"


    testCompile "org.grails:grails-plugin-testing"
    testCompile "org.grails.plugins:geb"

    // Note: It is recommended to update to a more robust driver (Chrome, Firefox etc.)
    testRuntime 'org.seleniumhq.selenium:selenium-htmlunit-driver:2.44.0'

    console "org.grails:grails-console"
}

和application.yml

dataSource: &pg_baseline ###Only the datasource is updated###
    driverClassName: org.postgresql.Driver
    dialect: org.hibernate.dialect.PostgreSQLDialect
    url: jdbc:postgresql://le-server:5432/LeDatabase
    username: ***le superuser***
    password: ***le password***

environments:
    development:
        dataSource:
            << : *pg_baseline
            url: le-server:5432/LeDatabase_Dev

    test:
        dataSource:
            << : *pg_baseline
            url: le-server:5432/LeDatabase_Test

使用PostgreSQL测试数据库。但是,如果我遵循相同的步骤,但使用create-plugin( - profile = plugin,或web-plugin,或未指定的配置文件)。为插件添加完全相同的build.gradle + applicatione.yml更改,然后运行集成测试会产生甜蜜的消息:

SomeTest > test something FAILED
    java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: org.springframework.beans.factory.BeanCreationException
                Caused by: org.springframework.beans.factory.BeanCreationExcepti
on
                    Caused by: java.lang.NullPointerException

1 test completed, 1 failed
:integrationTest FAILED

在所有情况下,这都使用以下命令来运行测试:

grails test-app -integration --stacktrace

插件是否无法针对实时数据库进行测试?我的测试运行时是否需要其他标志?

0 个答案:

没有答案
相关问题