首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Gradle和Junit5启用诱饵历史?

如何使用Gradle和Junit5启用诱饵历史?
EN

Stack Overflow用户
提问于 2020-03-28 08:05:20
回答 1查看 516关注 0票数 0

我知道我可以将历史目录从诱惑性报告复制到生成的诱惑性结果中,然后执行诱惑性生成来显示历史记录,但我正在寻找一种方法来实现这一点,使用诱惑性gradle中的内置功能。

目前,我先运行./gradlew clean test,然后运行./gradlew allureReport,这会给我一个新的html报告,没有历史记录或重新运行。我注意到,测试任务删除了整个allure-report目录,然后重新生成并重新填充它。

这是我的build.gradle:

代码语言:javascript
复制
buildscript {
    repositories {
        mavenLocal()
        jcenter()
    }
}

plugins {
    // Apply the java-library plugin to add support for Java Library
    id 'java-library'
    id 'java'
    id 'eclipse'
    // Allure reporter
    id 'io.qameta.allure' version '2.8.1'
}

repositories {
    mavenCentral()
    jcenter()
}

def allureVersion = "2.13.1"

allure {
    autoconfigure = true
    version = allureVersion
    useJUnit5 {
       version = '2.0-BETA10'
    }
    downloadLink = "https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.13.1/allure-commandline-2.13.1.zip"
}

test {
    useJUnitPlatform() {
        includeEngines 'junit-jupiter'
    }
    ignoreFailures = true
}

dependencies {       
    compile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.6.0'
    compile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.6.0'
    compile group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.6.0'
    // Needed as a workaround for JUnit 5 not failing tests that stopped due to an error message. The fix is in eclipse 4.10
    compile group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.6.0'

    compile group: 'io.qameta.allure', name: 'allure-junit5', version: '2.13.1'
    compile group: 'io.qameta.allure', name: 'allure-java-commons', version: '2.13.1'

    // https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
    compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.141.59'

}

我还尝试将结果和报告目录指定为build目录之外的目录,如下所示:

代码语言:javascript
复制
allure {
    autoconfigure = true
    version = allureVersion
    resultsDir = file('../../allure-results')
    reportDir = file('../../allure-report')
       ...
}

这允许诱饵-结果文件夹保留以前的报告,这些报告显示为重试(不完全正确),但历史记录仍然不起作用。

EN

回答 1

Stack Overflow用户

发布于 2021-02-26 16:23:57

我已经通过在运行的测试脚本中添加这些行解决了这个问题(我有一些测试scuites)

代码语言:javascript
复制
 call gradlew test -PsuiteFile=YOUR_TEST_SUITE.xml
 mkdir allure-results\history
 xcopy build\allure-results\* allure-results\history
 allure serve allure-results\history

所以我添加了文件夹allure-results\history来保存所有的结果

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60895749

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档