1

示例项目ioc-spring从 Maven 插件运行仪表集成测试,gauge-maven-plugin. 当加载到 IntelliJ 中时,它们在 IDE 中也可以正常运行。但是,当项目被移植到 Gradle 时,使用gauge-gradle-plugin测试无法在输出中加载到控制台:

$ gradle clean gauge
Exception in thread "main" org.reflections.ReflectionsException: Can't resolve member named failurePayment for class PaymentService
    at org.reflections.util.Utils.getMemberFromDescriptor(Utils.java:94)
    at org.reflections.util.Utils.getMethodsFromDescriptors(Utils.java:101)
    at org.reflections.Reflections.getMethodsAnnotatedWith(Reflections.java:482)
    at com.thoughtworks.gauge.scan.StepsScanner.scan(StepsScanner.java:38)
    at com.thoughtworks.gauge.scan.ClasspathScanner.scan(ClasspathScanner.java:39)
    at com.thoughtworks.gauge.GaugeRuntime.connectSynchronously(GaugeRuntime.java:82)
    at com.thoughtworks.gauge.GaugeRuntime.main(GaugeRuntime.java:54)
[ValidationError] /Users/temp/ioc-spring/specs/paymentService.spec:4 Connection closed [127.0.0.1:54806] cause: read tcp 127.0.0.1:54802->127.0.0.1:54806: read: connection reset by peer => 'Set debit card balance as "1000" rupees'
[ValidationError] /Users/temp/ioc-spring/specs/paymentService.spec:8 write tcp 127.0.0.1:54802->127.0.0.1:54806: use of closed network connection => 'Pay amount "500" rupees'
[ValidationError] /Users/temp/ioc-spring/specs/paymentService.spec:9 write tcp 127.0.0.1:54802->127.0.0.1:54806: use of closed network connection => 'Pay amount "500" rupees'
[ValidationError] /Users/temp/ioc-spring/specs/paymentService.spec:13 write tcp 127.0.0.1:54802->127.0.0.1:54806: use of closed network connection => 'Fail to pay "2000" rupees'
process /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/bin/java with pid 4910 quit unexpectedly. exit status 1
  Failed to initialize suite datastore. Error: write tcp 127.0.0.1:54802->127.0.0.1:54806: use of closed network connection
Successfully generated html-report to => /Users/temp/ioc-spring/reports/html-report/index.html
Specifications:     0 executed      0 passed        0 failed        0 skipped
Scenarios:      0 executed      0 passed        0 failed        0 skipped

Total time taken: 10ms

BUILD SUCCESSFUL in 2s
4 actionable tasks: 4 executed

这是我的build.gradle文件:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.thoughtworks.gauge.gradle:gauge-gradle-plugin:1.5.0'
        classpath files("$projectDir/libs")
    }
}

apply plugin: 'java'
apply plugin: 'gauge'
apply plugin: 'idea'

group = 'sample'
version = '1.0-SNAPSHOT'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    maven {
        url "https://localhost/repository/maven-public/"
    }
}

dependencies {
    testCompile group: 'org.springframework', name: 'spring', version:'2.5.6'
    testCompile group: 'com.thoughtworks.gauge', name: 'gauge-java', version:'0.6.6'
    testCompile group: 'junit', name: 'junit', version:'4.12'
}

gauge {
    specsDir = 'specs'
    additionalFlags = '--verbose'
}
4

0 回答 0