Xray-Maven 插件 - testPlanKey / fixVersion / testEnvironment 未填充在 Jira 中

问题描述 投票:0回答:1

使用 Serenity 4.0.1 生成 cucumber.json 报告,并使用 xray maven 插件发布到 Jira。

它大部分工作正常 - 在 Jira 中创建测试执行并填充结果。唯一的问题是它们没有链接到指定的测试计划,并且环境/修复版本字段也没有填充。

参考此文档:https://docs.getxray.app/display/XRAY/Integration+with+Maven#IntegrationwithMaven-Importingtestautomationresults

我尝试使用命令行参数(因为我用来提供 Jira 凭据)以及插件 pom 配置设置(我在其中提供 JiraBaseUrl 等)。所以我知道这两种方法都有效,只是似乎不适用于这 3 个领域。

这是我从插件获得的记录响应:

[INFO] response: {"testExecIssue":{"id":"16065764","key":"E2E-583","self":"https://jira.test.com/rest/api/2/issue/16065764"},"testIssues":{"success":[{"id":"16037818","key":"E2E-576","self":"https://jira.test.com/rest/api/2/issue/16037818","testVersionId":1433450}]},"infoMessages":[]}

这是我的插件配置:

    <plugin>
        <groupId>app.getxray</groupId>
        <artifactId>xray-maven-plugin</artifactId>
        <version>0.7.3</version>
        <configuration>
            <cloud>false</cloud>
            <jiraBaseUrl>https://jira.test.com</jiraBaseUrl>
            <projectKey>E2E</projectKey>
            <testEnvironment>UAT</testEnvironment>
            <fixVersion>1.0</fixVersion>
            <testPlanKey>E2E-577</testPlanKey>
            <reportFormat>cucumber</reportFormat>
            <reportFile>target/cucumber.json</reportFile>
        </configuration>
        <executions>
            <execution>
                <id>import-results</id>
                <phase>post-integration-test</phase>
                <goals>
                    <goal>import-results</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

这是我的 Maven 命令:

clean verify -e -X -Dcucumber.filter.tags="@E2E_Regression" -Dxray.testPlanKey="E2E-577" -Dxray.fixVersion=1.0 -Dxray.testPlanKey=E2E-577 -Dxray.testEnvironment=UAT -Dxray.jiraUsername=xxx -Dxray.jiraPassword=xxx

想知道为什么这些字段根本没有被填充?

maven cucumber jira-xray
1个回答
0
投票

“cucumber”格式在内部使用标准黄瓜 REST API 端点,该端点尚不支持传递Xray Maven 插件 GitHub 项目页面上提到的其他参数。

GitHub documentation highlighting current constraints on cucumber handling

解决此需求的方法是使用 cucumber 多部分端点;该文档提供了 API 请求的示例。

curl -u admin:admin -F [email protected] -F [email protected] http://yourserver/rest/raven/1.0/import/execution/cucumber/multipart

我们还可以使用 xray-maven-plugin 来实现这一点。 为此,您应该从 pom.xml 配置和相应的命令行参数中删除 projectKey、testEnvironment、fixVersion、testPlanKey。为什么?因为它们没有经过处理。 相反,您应该使用文件名(例如 testexec.json)和类似于以下内容的内容来指定

testExecInfoJson

{
    "fields": {
        "project": {
            "key": "PROJECT_KEY"
        },
        "summary": "Test Execution for cucumber execution",
        "issuetype": {
            "name": "Test Execution"
        },
        "customfield_CF_TEST_ENVIRONMENT" : [
            "TEST_ENVIRONMENT_NAME"
        ],
    "customfield_CF_TEST_PLAN" : [ "TESTPLAN_KEY" ]
    },
        "fixVersions" : 
                [
                 {
                        "name": "NAME_OF_RELEASE_IN_JIRA"
                 }
                ]

}

您需要在 Jira 实例设置中找到自定义字段“测试计划”和“测试环境”的 ID(或向 Jira 管理员询问)。

该内容的示例如下:

{
    "fields": {
        "project": {
            "key": "CALC"
        },
        "summary": "Test Execution for cucumber Execution",
        "issuetype": {
            "name": "Test Execution"
        },
        "customfield_11805" : [
            "iOS"
        ],
        "fixVersions" : 
                [
                 {
                        "name": "v3.0"
                 }
                ]

        
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.