Gradle 使用Allure 2+时,Allure报告为空;Junit5+;格拉德尔+;硒化物

Gradle 使用Allure 2+时,Allure报告为空;Junit5+;格拉德尔+;硒化物,gradle,allure,junit5,Gradle,Allure,Junit5,我的build.gradle是: apply plugin: 'java' apply plugin: 'idea' apply plugin: 'org.junit.platform.gradle.plugin' apply plugin: 'io.qameta.allure' defaultTasks 'clean', 'test' ext.junitJupiterVersion = '5.0.0-M4' ext.selenideVersion = '4.4.3' compileTes

我的build.gradle是:

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'io.qameta.allure'

defaultTasks 'clean', 'test'

ext.junitJupiterVersion = '5.0.0-M4'
ext.selenideVersion = '4.4.3'

compileTestJava {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
    options.encoding = 'UTF-8'
    options.compilerArgs += "-parameters"
}

compileJava.options.encoding = 'UTF-8'

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

repositories {
    jcenter()
    mavenCentral()
}

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M4'
        classpath 'io.qameta.allure:allure-gradle:2.3'
    }
}

  allure {
    aspectjweaver = true
    autoconfigure = true
    version = '2.1.1'
}

  configurations {
    agent
  }

  dependencies {
    // JUnit5
    compile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
    compile("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")

    // Selenide
    compile("com.codeborne:selenide:${selenideVersion}") {
        exclude group: 'junit'
    }

    // Allure
    agent 'org.aspectj:aspectjweaver:1.8.10'
    compile 'ru.yandex.qatools.allure:allure-junit-adaptor:1.4.23'
    compile 'io.qameta.allure:allure-junit5:2.0-BETA6'
}

    junitPlatform {
platformVersion = "1.0.0-M5"
enableStandardTestTask = true
}

task runJupiter(type: JavaExec) {
jvmArgs '-ea'
jvmArgs "-javaagent:${configurations.agent.singleFile}"
classpath = project.sourceSets.test.runtimeClasspath
main 'org.junit.platform.console.ConsoleLauncher'
args '--scan-class-path'
args "--reports-dir=${buildDir}/allure-results"

finalizedBy 'allureReport'
}

test.dependsOn runJupiter
测试成功完成,并自动创建三个文件夹:

{projectDir}\n使用.json文件引用结果

{projectDir}\build\test results\junit平台,带有test-junit-jupiter.xml文件

{projectDir}\build\reports\allure report

我试图通过allure命令行(CLI)在本地打开.json和.xml结果。诱惑报告已打开,但为空:


我想我在格拉德尔的依赖性上犯了错误。我很困惑JUnit5+Allure2+Gradle+Selenide+Java8应该使用哪些库和版本?

JUnit平台Gradle插件目前没有使用
测试任务(它需要更改Gradle核心才能这样做)。因此,像
test.doFirst{…}
这样的事情是行不通的


不使用插件,您应该能够创建自己的任务来运行
ConsoleLancher
,并在那里添加JVM代理。请参见示例。

您在第一句话中指的是哪个Gradle插件?它对我很有用。非常感谢你。我写了这个:tasks.withType(JavaExec){if(it.name='junitPlatformTest'){doFirst{jvmArgs”-javaagent:${configurations.agent.singleFile}}}}由'allureReport'完成}您使用什么Allure命令行命令查看报告?