0

testFx はすでに Eclipse で動作しており、GUI テストは正常に実行されます。しかし、それはgradleでは機能しません。ボタンに NoNodeFoundException が表示されます。そのコード行を取り除くと、TextField を指す次の行に対してまったく同じ例外が表示されます。

開発者以外に、testfx を gradle と組み合わせて使用​​しようとした人は誰もいなかったようです。

それを解決する方法はありますか?

gradle.build

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'checkstyle'
apply plugin: 'application'
apply plugin: 'jacoco'


group = 'TodoManager'
version = '0.0.1'
description = """Aufgabenplanung"""

//プライバシー保護 mainClassName = "*********.todomanager.model.ReadAndWrite"

defaultTasks 'clean', 'test', 'build', 'jacocoTestReport','distZip','javadoc','wrapper'


repositories {

   maven { url "http://repo.maven.apache.org/maven2" }
     jcenter()
     mavenCentral()
}


jar {
    baseName = 'TodoManager'
    version =  '0.5.0'
}

dependencies {

/*
    testCompile group: "org.loadui", name: "testFx", version: "3.1.2"
    testCompile "org.testfx:testfx-core:4.0.+"
    testCompile "org.testfx:testfx-junit:4.0.+"
    compile files('lib/TodoManagerLibrary-1.1.jar')
    testCompile 'junit:junit:4.+'
   */
   testCompile group: "org.loadui", name: "testFx", version: "3.1.2"
    testCompile "junit:junit:4.10"
    testCompile "org.testfx:testfx-core:4.0.+"
    testCompile "org.testfx:testfx-legacy:4.0.+", {
        exclude group: "junit", module: "junit"
    }
}

checkstyle {
    sourceSets = [sourceSets.main]
}

jacoco {
    toolVersion = "0.7.1.201405082137"
    reportsDir = file("$buildDir/reports/jacoco")
}

jacocoTestReport {
    reports {
        xml.enabled false
        csv.enabled false
        html.destination "$buildDir/reports/jacoco/html"
    }
        classDirectories = files('build/classes/')
}

test {

    jacoco {
        append = false
        destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
        classDumpFile = file("$buildDir/jacoco/classpathdumps")
    }
}

それが役立つかどうかはわかりませんが、これが私のプロジェクト構造です。 ここに画像の説明を入力

4

1 に答える 1

0

最近、gradle で testfx を使い始めました。

これが私のものbuild.gradleです:

plugins{
    id 'application'
    id 'com.github.johnrengelman.shadow' version '1.2.3'
}

mainClassName = "dialogio.Dialogio"
repositories {
    mavenCentral()
}
dependencies{
    compile 'com.google.guava:guava:19.0'
    compile 'org.controlsfx:controlsfx:8.40.10'
    testCompile 'org.loadui:testFx:3.1.0'
}
test {
  testLogging.showStandardStreams = true
}

何らかの理由でButton loginButton = find("#loginButton");、fx:id を設定しても、あなたが言及した例外が発生します。CSS IDを設定した後にのみ機能しました:

ここに画像の説明を入力

于 2016-04-19T15:46:43.347 に答える