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

时间:2019-12-09 05:19:41

标签: java gradle

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测试时,它不执行任何测试,不知道出了什么问题。

0 个答案:

没有答案