allure命令行参数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了allure命令行参数相关的知识,希望对你有一定的参考价值。

参考技术A allure命令语法格式

options列表

command列表:
1、generate
2、serve
3、open
4、plugin
generate命令行参数,主要用-c,-o两个参数

serve命令行参数
启动allure服务,打开allure报告

open命令行参数

浏览器打开allure报告的两种方式:

参考:
allure 命令行参数 - 太白之魔童降世 - 博客园 (cnblogs.com)

与 Jenkins 的错误集成 Allure 报告。找不到 allure 命令行 <null>

【中文标题】与 Jenkins 的错误集成 Allure 报告。找不到 allure 命令行 <null>【英文标题】:Error integration Allure reporting with Jenkins. Can't find allure commandline <null> 【发布时间】:2022-01-03 22:45:54 【问题描述】:

请帮忙,我只是不知道出了什么问题,我什么都试过了……这是一个 QA 测试项目,基于 java17、maven、testng。 Jenkins 和 Allure 之间的集成不起作用,出了什么问题?

我在 Jenkins 文件中有发布条件:

         post 
          always 
             allure includeProperties: false, jdk: '', reportBuildPolicy: 'ALWAYS', results: [[path: 'target/allure-results']]
            deleteDir()

当我在 Jenkins 端运行管道时,控制台输出出现以下错误

管道魅力 执行总是后置条件时出错: 另外:hudson.remoting.Channel$CallSiteStackTrace:远程调用 ubuntu-20.04 在 hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1797) 在 hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356) 在 hudson.remoting.Channel.call(Channel.java:1001) 在 ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation.getMajorVersion(AllureCommandlineInstallation.java:63) 在 ru.yandex.qatools.allure.jenkins.ReportBuilder.build(ReportBuilder.java:52) 在 ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:312) 在 ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:231) 在 jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123) 在 org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:100) 在 org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:70) 在 org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) 在 java.util.concurrent.Executors$RunnableAdapter.call(未知来源) 在 java.util.concurrent.FutureTask.run(未知来源) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(未知来源) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(未知来源) 在 java.lang.Thread.run(未知来源) java.io.IOException:找不到 allure 命令行 在 ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation$GetMajorVersion.call(AllureCommandlineInstallation.java:74) 在 ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation$GetMajorVersion.call(AllureCommandlineInstallation.java:65) 在 hudson.remoting.UserRequest.perform(UserRequest.java:211) 在 hudson.remoting.UserRequest.perform(UserRequest.java:54) 在 hudson.remoting.Request$2.run(Request.java:376) 在 hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78) 在 java.util.concurrent.FutureTask.run(FutureTask.java:264) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) 在 java.lang.Thread.run(Thread.java:833)

在 Jenkins 端正确安装了与 Allure 的集成(我尝试从 Jenkins 代理配置中的 HOME 目录中删除“/bin”路径,但没有帮助。 项目使用java17,maven。

Pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>0</modelVersion>

    <groupId>lol</groupId>
    <artifactId>lol</artifactId>
    <version>1</version>

    <name>lol</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <aspectj.version>1.9.7</aspectj.version>
        <java.version>17</java.version>
        <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
        <maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
        <org.apache.logging.log4j.version>2.14.1</org.apache.logging.log4j.version>
        <org.slf4j.version>1.7.26</org.slf4j.version>
        <com.google.guava.version>27.1-jre</com.google.guava.version>
        <org.apache.commons-lang.version>3.9</org.apache.commons-lang.version>
        <org.apache.commons.version>4.3</org.apache.commons.version>
        <org.testng.version>7.4.0</org.testng.version>
        <io.rest-assured.version>4.3.1</io.rest-assured.version>
        <io.rest-assured.json-schema-validator.version>$io.rest-assured.version
        </io.rest-assured.json-schema-validator.version>
        <com.google.code.gson.version>2.8.5</com.google.code.gson.version>
        <com.googlecode.json-simple.version>1.1.1</com.googlecode.json-simple.version>
        <org.projectlombok.version>1.18.22</org.projectlombok.version>
        <io.jsonwebtoken.version>0.10.5</io.jsonwebtoken.version>
        <org.bouncycastle.version>1.66</org.bouncycastle.version>
        <io.qameta.allure.version>2.13.8</io.qameta.allure.version>
        <com.fasterxml.jackson.core.version>2.9.9</com.fasterxml.jackson.core.version>
        <org.sonarsource.scanner.maven.version>3.7.0.1746</org.sonarsource.scanner.maven.version>
        <software.amazon.awssdk.verison>2.8.7</software.amazon.awssdk.verison>
        <commons-io.verison>2.6</commons-io.verison>
        <codeborne.version>5.19.0</codeborne.version>
        <org.awaitility.version>4.0.2</org.awaitility.version>
        <jacoco.plugin.version>0.8.6</jacoco.plugin.version>
        <selenium.version>3.141.59</selenium.version>
        <bmp.version>2.1.5</bmp.version>
        <ashot-version>1.5.4</ashot-version>
        <extentreports-version>5.0.8</extentreports-version>
        <resources>src/test/resources/</resources>
        <pathToSuite>test-suites/cf/regression.xml</pathToSuite>
        <sonar.java.source>$java.version</sonar.java.source>
        <sonar.coverage.jacoco.xmlReportPaths>
            target/site/jacoco/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>
    </properties>

    <dependencies>

        <dependency>
            <groupId>com.aventstack</groupId>
            <artifactId>extentreports</artifactId>
            <version>$extentreports-version</version>
        </dependency>

        <dependency>
            <groupId>ru.yandex.qatools.ashot</groupId>
            <artifactId>ashot</artifactId>
            <version>$ashot-version</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>$org.apache.logging.log4j.version</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>$org.slf4j.version</version>
        </dependency>

        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>$org.awaitility.version</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>$com.google.guava.version</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>$org.apache.commons-lang.version</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>$org.apache.commons.version</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>$org.testng.version</version>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>$io.rest-assured.version</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-lang3</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>$io.rest-assured.json-schema-validator.version</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>$com.google.code.gson.version</version>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>$com.googlecode.json-simple.version</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>$org.projectlombok.version</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
            <version>$io.jsonwebtoken.version</version>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-impl</artifactId>
            <version>$io.jsonwebtoken.version</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-jackson</artifactId>
            <version>$io.jsonwebtoken.version</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <version>$org.bouncycastle.version</version>
        </dependency>

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>$io.qameta.allure.version</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>$com.fasterxml.jackson.core.version</version>
        </dependency>

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>aws-sdk-java</artifactId>
            <version>$software.amazon.awssdk.verison</version>
        </dependency>

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>cloudwatchlogs</artifactId>
            <version>$software.amazon.awssdk.verison</version>
        </dependency>

        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>url-connection-client</artifactId>
            <version>$software.amazon.awssdk.verison</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>$commons-io.verison</version>
        </dependency>

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-java-commons</artifactId>
            <version>$io.qameta.allure.version</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.codeborne</groupId>
            <artifactId>selenide</artifactId>
            <version>$codeborne.version</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-remote-driver</artifactId>
            <version>$selenium.version</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>net.lightbody.bmp</groupId>
            <artifactId>browsermob-core</artifactId>
            <version>$bmp.version</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>$maven.surefire.plugin.version</version>
                <configuration>
                    <argLine>
                        -javaagent:"$settings.localRepository/org/aspectj/aspectjweaver/$aspectj.version/aspectjweaver-$aspectj.version.jar"
                    </argLine>
                    <suiteXmlFiles>
                        <suiteXmlFile>$resources$pathToSuite</suiteXmlFile>
                    </suiteXmlFiles>
                    <systemPropertyVariables>
                        <testng.dtd.http>true</testng.dtd.http>
                    </systemPropertyVariables>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>$aspectj.version</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>$maven.compiler.plugin.version</version>
                <configuration>
                    <release>$java.version</release>
                    <encoding>$project.build.sourceEncoding</encoding>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>$org.sonarsource.scanner.maven.version</version>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>$jacoco.plugin.version</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>regression</id>
        </profile>
        <profile>
            <id>sanity</id>
        </profile>
    </profiles>

</project>

【问题讨论】:

【参考方案1】:

Allure jenkins install config

我自己找到了答案,这是新版本的 allure-commandline 中的某种问题,尝试:

    安装旧版本,例如 2.8.0 那么您可以安装任何新版本

似乎在旧版本中,在安装时,它正在以正确的方向创建路径(在我的情况下为 ubuntu),然后只需更新一个新的......或者您可以手动插入安装目录并最初安装一个新版本

【讨论】:

以上是关于allure命令行参数的主要内容,如果未能解决你的问题,请参考以下文章

24-pytest-allure命令行参数

与 Jenkins 的错误集成 Allure 报告。找不到 allure 命令行 <null>

什么是命令行参数?本人是c++菜鸟

如何在C++中解析命令行参数

Python笔记:命令行参数解析

命令行参数是啥?