繁体   English   中英

Gradle 测试未与 javafx 项目一起运行

[英]Gradle tests not running with javafx project

build.gradle:

  plugins {
      id 'java'
      id 'application'
      id 'org.openjfx.javafxplugin' version '0.0.8'
  }

  mainClassName = 'mvc.Main'

  repositories {
      mavenCentral()
  }

  dependencies {
      testImplementation('org.junit.jupiter:junit-jupiter-api:5.6.0-M1')
      testRuntime('org.junit.jupiter:junit-jupiter-engine:5.6.0-M1')
      testCompile('org.mockito:mockito-core:3.1.0')
      testCompile('com.athaydes.automaton:Automaton:1.3.2')
      testCompile("org.testfx:testfx-core:4.0.16-alpha")
      testCompile("org.testfx:testfx-junit:4.0.15-alpha")
      testImplementation('org.hamcrest:hamcrest:2.2')
      implementation 'com.github.cliftonlabs:json-simple:3.1.0'
  }

  applicationDefaultJvmArgs = [ "-Djdk.gtk.version=2"]

  sourceCompatibility = 11
  targetCompatibility = 11

  test {
      useJUnitPlatform()

      dependsOn 'cleanTest'

      testLogging {
          events "passed", "skipped", "failed"
      }   
  }

  javafx {
      modules = ['javafx.controls', 'javafx.fxml']
      version = '11.0.2'
  }     

我的项目结构是通常的:

src/main/java/mvc/Main.java

src/test/java/mvc/MainTest.java

当我运行 gradle test 或 ./gradlew test tests 时,它没有执行任何测试,不确定出了什么问题。

testCompile 不再是受支持的命令,您应该改用 testImplementation。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM