【问题标题】:AzureDevops : Allure Report Failed to publish test run data: System.ArgumentException: Unknown test runnerAzureDevops:Allure 报告无法发布测试运行数据:System.ArgumentException:未知测试运行器
【发布时间】:2023-01-10 09:58:49
【问题描述】:

我无法生成报告。下面是我的实现

我正在使用 Azure 自托管代理 + Appium + Maven + Cucumber + Java

**1。文件:pom.xml **

<groupId>org.demo.samle</groupId>
<artifactId>mycard</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <timestamp>${maven.build.timestamp}</timestamp>
    <maven.build.timestamp.format>MMM_dd_yyyy_hh_mm</maven.build.timestamp.format>
    <cucumber.version>7.7.0</cucumber.version>
    <assertj-core.version>3.23.1</assertj-core.version>
    <jdk.source.version>15</jdk.source.version>
    <jdk.target.version>15</jdk.target.version>
    <aspectj.version>1.9.9.1</aspectj.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>15</source>
                <target>15</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.3.0</version>
            <executions>
                <execution>
                    <id>copy-resources</id>
                    <!-- here the phase you need -->
                    <phase>validate</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${pom.basedir}/target/allure-results</outputDirectory>
                        <resources>
                            <resource>
                                <directory>src/test/resources</directory>
                                <includes>
                                    <include>environment.xml</include>
                                    <include>categories.json</include>
                                </includes>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M5</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
                <argLine>
                    -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                    -Dcucumber.options="--plugin io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm"
                </argLine>
                <suiteXmlFiles>
                    <suiteXmlFile>${project.basedir}/TestSuite/MainSuite.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
            <dependencies>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjweaver</artifactId>
                <version>${aspectj.version}</version>
            </dependency>
        </dependencies>
        </plugin>
    </plugins>

</build>

<dependencies>

    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>8.2.0</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>gherkin</artifactId>
        <version>24.0.0</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-core</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>${cucumber.version}</version>
    </dependency>

    <dependency>
        <groupId>com.ibm.icu</groupId>
        <artifactId>icu4j</artifactId>
        <version>71.1</version>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.6.1</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20220320</version>
    </dependency>
    
    <dependency>
        <groupId>net.masterthought</groupId>
        <artifactId>cucumber-reporting</artifactId>
        <version>5.7.2</version>
    </dependency>

    <dependency>
        <groupId>net.masterthought</groupId>
        <artifactId>maven-cucumber-reporting</artifactId>
        <version>5.7.1</version>
    </dependency>

    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.15</version>
    </dependency>

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

    <dependency>
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.15.3</version>
    </dependency>

    <dependency>
        <groupId>org.aeonbits.owner</groupId>
        <artifactId>owner</artifactId>
        <version>1.0.12</version>
    </dependency>

    <dependency>
        <groupId>com.mashape.unirest</groupId>
        <artifactId>unirest-java</artifactId>
        <version>1.4.9</version>
    </dependency>

    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj-core.version}</version>
        <scope>test</scope>
    </dependency>
    
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-cucumber7-jvm</artifactId>
        <version>2.19.0</version>
    </dependency>

</dependencies>

<reporting>
    <excludeDefaults>true</excludeDefaults>
    <plugins>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.11.2</version>
        </plugin>
    </plugins>
</reporting>

2. 在 Cucumber Runner 文件中添加了 Allure 插件。在这里我还指定了 junit xml 文件

@CucumberOptions(
        glue = {"stepDefinitions"},
        monochrome = true,
        snippets = CucumberOptions.SnippetType.CAMELCASE,
        plugin = {"pretty"
                , "summary"
                , "utilities.cucumber.listener.CucumberListener"
                , "io.qameta.allure.cucumber7jvm.AllureCucumber7Jvm"
                , "junit:target/allure-results/MotoEdge20Fusion.xml"
                , "html:target/cucumber-reports/Motorola Edge 20 Fusion/MotoEdge20Fusion_advanced-reports.html"
                , "json:target/cucumber-reports/Motorola Edge 20 Fusion/MotoEdge20Fusion.json"
        },
        features = {
                "classpath:features/01_Permission.feature",
        }
)
public class MotorolaEdge20TestNGRunnerTest extends TestRunnerBase {
}

3.流水线设置:

4.附上倾城原始日志:

##[debug]Report successfully generated to D:\Software_Installed\Agent\_work\2\s\target\allure-report\133

##[debug]
##[debug]TestManagement.Server.UsePublishTestResultsLibInAgent is on
##[debug]Object of TestLogStore created.
Result Attachments will be stored in LogStore
##[debug]Object of TestResultsPublisher created.
##[debug]Object of TestLogStore created.
Run Attachments will be stored in LogStore
##[debug]Object of TestRunPublisher created.
##[debug]Object of TestLogStore created.
##[warning]Failed to publish test run data: System.ArgumentException: Unknown test runner
   at Microsoft.VisualStudio.Services.Agent.Worker.TestResults.TestDataPublisher.ParseTestResultsFile(TestRunContext runContext, List`1 testResultFiles)
   at Microsoft.VisualStudio.Services.Agent.Worker.TestResults.TestDataPublisher.PublishAsync(TestRunContext runContext, List`1 testResultFiles, PublishOptions publishOptions, CancellationToken cancellationToken)
##[debug]Processed: ##vso[results.publish type=Allure;mergeResults=true;publishRunAttachments=true;resultFiles=D:\Software_Installed\Agent\_work\2\s\target\allure-report\133;]
(node:17216) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:17216) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:17216) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:17216) Warning: Use Cipheriv for counter mode of aes-256-ctr
(node:17216) Warning: Use Cipheriv for counter mode of aes-256-ctr
##[debug]task result: Succeeded
##[debug]Processed: ##vso[task.complete result=Succeeded;]Return code: 0
Async Command Start: Publish test results
##[debug]TestManagement.Server.TriggerCoverageMergeJob is on
##[debug]Exception in Method:Access to the path 'D:\Software_Installed\Agent\_work\2\s\target\allure-report\133' is denied.
Async Command End: Publish test results
Finishing: Generate Allure Report

请帮助修复此错误。

【问题讨论】:

  • 我还尝试使用 allure 命令生成报告
  • 手动我可以查看报告,但是 azurepipe 行不起作用 allure generate --clean --output D:\Software_Installed\Agent_work\2\s\target\allure-report D:\Software_Installed\Agent_work\2\s\ target\allure-results allure 打开 D:\Software_Installed\Agent_work\2\s\target\allure-report

标签: azure-devops cucumber-jvm allure


【解决方案1】:

面临同样的问题。这似乎是将 Allure 报告与 Azure DevOPS 结合使用的障碍。 Allure Test ReportsHtml Viewer Azure 插件实际上都无法发布 Allure Reports

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多