Allure 2报告:当Gradle中同时存在JUnit和CucumberJvm时,如何指定结果框架

fhg3lkii  于 2023-01-09  发布在  其他
关注(0)|答案(1)|浏览(212)

Allure报告是使用同一测试用例的2个结果生成的,一个用于 cucumber ,另一个用于JUnit。
如何仅生成Cucumber报告?
使用以下命令执行测试:

gradelw test -Ptags=@Test -Dcucumber.options="--plugin io.qameta.allure.cucumber6jvm.AllureCucumber6Jvm"
构建版本分级

(stackoverflow不允许我复制整个build.gradle,所以只复制似乎与此问题相关的部分)

plugins {
    id 'io.qameta.allure' version '2.9.6'
    id 'base'
    id 'java'
}

allure {
    version = '2.17.2'  // Latest Allure Version
    useJUnit5 {
        version = '2.17.2' // Latest Allure Version
    }
}

sourceCompatibility = 14
targetCompatibility = JavaVersion.VERSION_14

group 'org.test'
version '0.1'

repositories {
    jcenter()
    mavenCentral()
    mavenLocal()
}

dependencies {
    // Cucumber
    testImplementation 'io.cucumber:cucumber-junit-platform-engine:6.11.0'
    testImplementation 'io.cucumber:cucumber-java:6.11.0'
    testImplementation 'io.cucumber:cucumber-core:6.11.0'
    testImplementation 'io.cucumber:cucumber-junit:6.11.0'

    // Allure
    testImplementation 'io.qameta.allure:allure-junit5:2.17.2'
    testImplementation 'io.qameta.allure:allure-cucumber6-jvm:2.17.2'
    runtimeOnly 'org.aspectj:aspectjweaver:1.9.7'

    // Junit
    testImplementation(platform('org.junit:junit-bom:5.8.2'))
    testImplementation 'org.junit.jupiter:junit-jupiter'
    testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}

test {
    useJUnitPlatform{
        includeEngines 'junit-vintage'
    }
    testLogging {
        events "passed", "skipped", "failed"
    }
    systemProperty("cucumber.junit-platform.naming-strategy", "long")
}

configurations {
    testCompile
}
诱惑报告

uqxowvwt

uqxowvwt1#

也有同样的问题。你需要删除对allure-junit的依赖。因为allure-cubber生成报告,而allure-junit也会向这个报告添加结果。

相关问题