Allure在本地计算机上生成空报告页面

时间:2017-05-23 09:55:42

标签: gradle automated-tests testng allure

正如标题所说,我无法强制Allure 2在本地计算机上为我生成报告。 我从谷歌尝试过很多东西,但没有任何帮助。我使用Kotlin + Selenide + TestNG来编写测试,如果它有所帮助:) 我对Allure有点困惑,因为它有testNG的版本和Gradle的版本 - 应该使用哪一个?都? 这是我的build.gradle文件:

group 'RegisteredUserFlow'
version '1.0-SNAPSHOT'

buildscript {
    ext.kotlin_version = "1.1.2-2"

    repositories {
        jcenter()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "ru.d10xa:gradle-allure-plugin:0.5.5"
    }
}

apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'ru.d10xa.allure'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

allure {
    aspectjweaver = true
    testNG = true
}

repositories {
    jcenter()
}

configurations {
    agent
}

dependencies {
    agent "org.aspectj:aspectjweaver:1.8.10"
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-2"
    testCompile "com.codeborne:selenide:4.4.3"
    testCompile "org.testng:testng:6.10"
    testCompile "io.qameta.allure:allure-testng:2.0-BETA6"
    testCompile "io.github.bonigarcia:webdrivermanager:1.6.2"
}

test.doFirst {
    jvmArgs "-javaagent:${configurations.agent.singleFile}"
}

test {
    useTestNG(){
        suites 'src/test/kotlin/testng.xml'
    }
    systemProperty 'allure.results.directory', 'build/allure-results'
    systemProperty 'allure.link.issue.pattern', 'https://github.com/allure-framework/allure-docs/issues/{}'
    systemProperty 'allure.link.tms.pattern', 'https://github.com/allure-framework/allure-docs/issues/{}'
}

tasks.withType(Test)*.finalizedBy allureReport

我使用的命令是:allure serve build/allure-resultsgradlew clean test allureReport

另外,我需要Java插件吗?

感谢任何帮助! 谢谢!

P.S。这是我在gradlew clean test allureReport命令后在控制台中得到的错误:

Execution failed for task ':allureReport'.
> Could not resolve all dependencies for configuration ':allureReport'.
   > Could not resolve org.slf4j:slf4j-api:1.7.12.
     Required by:
         project : > ru.yandex.qatools.allure:allure-bundle:1.4.24.RC3 > org.slf4j:slf4j-simple:1.7.12
         project : > ru.yandex.qatools.allure:allure-bundle:1.4.24.RC3 > ru.yandex.qatools.allure:allure-report-data:1.4.24.RC3 > ru.yandex.qatools.allure:allure-report-plugin-api:1.4.24.RC3 > ru.yandex.qatools.allure:allure-model:1.4.24.RC3

1 个答案:

答案 0 :(得分:2)

问题在于ru.d10xa:gradle-allure-plugin:0.5.5不支持Allure 2.我们正在开发全新的Allure Gradle插件https://github.com/allure-framework/allure-gradle

目前,您可以使用allure-commandline在本地计算机和Allure Jenkins / Teamcity插件中生成报告,以生成有关CI的报告。

更新

支持Allure 2的新Allure Gradle插件现已上市。有关详细信息,请参阅文档https://docs.qameta.io/allure/2.0/#_gradle_3