【问题标题】:jvmArgs settings for Allure reportsAllure 报告的 jvmArgs 设置
【发布时间】:2023-03-30 09:52:01
【问题描述】:

我正在尝试通过使用生成报告

gradlew clean test 

命令。它失败并出现错误:

Error occured during intialization of VM
Error opening zip file or JAR nanifest missing : ${configurations.agent.singleFile}

这是我的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"
    }
}

apply plugin: 'kotlin'

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/resources/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/{}'
}

我一直认为问题出在aspectJ,但我不确定。 我错过了 gradle 文件中的某些内容吗?或者它在我的测试文件中的某个地方?或者最新的Allure 版本可能有问题?我看到jvmArgs 以灰色突出显示(从未使用过) - 也许有问题?

对于我从未与Allure 和aspectJ 处理过的许多问题,我深表歉意。

感谢您的帮助!

【问题讨论】:

  • 这是answer 我的问题吗?

标签: gradle automated-tests kotlin aspectj allure


【解决方案1】:

你的问题是你使用了String,而你应该使用GString。

jvmArgs '-javaagent:${configurations.agent.singleFile}'

这行字面意思。应该是的

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

替换占位符。 (单引号与双引号)。

【讨论】:

    猜你喜欢
    • 2017-05-02
    • 2021-08-04
    • 1970-01-01
    • 2016-05-17
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多