2017-07-11 5 views
1

私のbuild.gradleは以下のとおりです。アリュールレポートは空になったときに使用Allure2 + Junit5 +の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 

テストが正常に終了すると、3つのフォルダが自動的に作成され :

.jsonファイルを使用した{projectDir} \ allure-results

{projectDir} \ build \ test-results \ junit-platform with TEST-junit- jupiter.xmlファイル

{PROJECTDIR} \ \を構築するには、私が魅力のコマンドライン(CLI)を介してローカルに.jsonおよび.xml結果を開こうとしたの\アリュール・レポートに

を報告します。魅力レポートは開かれていますが空白です: this is a report view

私は間違いがあると思います。私はJUnit5 + Allure2 + Gradle + Selenide + Java8のためにどのライブラリとバージョンを使用すべきかをかなり混乱させましたか?

+0

レポートを表示するためにどのようなAllureコマンドラインコマンドを使用していますか? –

答えて

1

JUnit Platform Gradleプラグインは現在、testタスクを使用していません(これを行うには、Gradleコアを変更する必要があります)。したがって、test.doFirst {...}のようなものは動作しません。

プラグインを使用する代わりに、ConsoleLauncherを実行してそこにJVMエージェントを追加する独自のタスクを作成することができます。例については、https://stackoverflow.com/a/43512503/6327046を参照してください。

+0

最初の文章ではどのGradleプラグインを参照していますか? –

+0

それは私のために働く。どうもありがとうございました。私はこれを書いた:tasks.withType(JavaExec){ 場合(it.name == 'junitPlatformTest'){ doFirst { JVMARGS "-javaagent:$ {configurations.agent.singleFile}" } finalizedBy 'allureReport' } –

関連する問題