来自 wdio 黄瓜 json 报告器的 Jira Xray 测试结果错误

如何解决来自 wdio 黄瓜 json 报告器的 Jira Xray 测试结果错误

我们有一个与 Cucumber 测试相关联的故事,我们在测试执行中执行此测试。来自测试执行的功能文件如下所示:

@ABC-164
@ABC-163
Feature: Homepage test
    @ABC-162
    Scenario: Homepage test
        Feature: Go to homepage
            Scenario: Homepage
                Given I open the url "https://example.com/"
                Then I expect that the url is "https://google.com"

一个总是通过,第二个失败。 我们正在从 wdio 黄瓜 json 报告器生成 JSON 报告,您可以在下面看到:

[
  {
    "keyword": "Feature","type": "feature","description": "","line": 3,"name": "Homepage test","uri": "Can not be determined","tags": [
      {
        "type": "Tag","location": { "line": 1,"column": 1 },"name": "@ABC-164"
      },{
        "type": "Tag","location": { "line": 2,"name": "@ABC-163"
      }
    ],"elements": [
      {
        "keyword": "Scenario","type": "scenario","description": "\t\tFeature: Go to homepage","tags": [
          { "name": "@ABC-164","column": 1 } },{ "name": "@ABC-163",{ "name": "@ABC-162","location": { "line": 6,"column": 2 } }
        ],"id": "homepage-test;homepage-test","steps": [
          {
            "arguments": [],"keyword": "Before","name": "Hook","result": { "status": "passed","duration": 2000000 },"line": "","match": { "location": "can not be determined with webdriver.io" }
          },{
            "arguments": [],"duration": 0 },"match": { "location": "can not be determined with webdriver.io" }
          }
        ]
      },{
        "keyword": "Scenario","name": "Homepage","column": 1 } }
        ],"id": "homepage-test;homepage","keyword": "Given","name": "I open the url \"https://example.com/\"","duration": 587000000 },"line": 12,"keyword": "Then","name": "I expect that the url is \"https://google.com\"","result": {
              "status": "Failed","duration": 11000000,"error_message": "Error: expect(received).toEqual(expected)"
            },"line": 13,"keyword": "After","match": { "location": "can not be determined with webdriver.io" }
          }
        ]
      }
    ],"id": "homepage-test","Metadata": {
      "browser": { "name": "chrome","version": "88.0.4324.150" },"device": "Device name not kNown","platform": { "name": "osx","version": "Version not kNown" }
    }
  }
]

Xray 仅从第一个对象的 Before Hooks 读取状态,完全忽略其余状态。

当我们使用 Jenkins 插件以及通过 curl 直接发送时会出现问题:curl -k -H "Content-Type: application/json" -X POST -u login:pass --data @result.json https://jira/rest/...

任何帮助将不胜感激。

解决方法

您不能在场景下拥有功能。尽管 Cucumber 可能无法正确报告,但这是一个语法错误。

,

Aslak 在评论中提到,.feature 文件语法不正确。 正确的 .feature 文件类似于前面的示例。 另请记住,您拥有的标签 (@ABC-xxx) 可能需要有一些前缀,例如 REQ 或 TEST,具体取决于您的 settings

顺便说一句,目前还不清楚您是否从 Xray 导出测试执行以生成 .feature 文件,但我不认为是这种情况。只是强调一下,为了根据现有测试(Cucumber Scenario/Scenario Outlines)报告结果,它们必须事先存在于 Xray 中。

@ABC-164
@ABC-163
Feature: Homepage test
    @ABC-162
    Scenario: Homepage
      Given I open the url "https://example.com/"
      Then I expect that the url is "https://google.com"*
,

对于那些有同样问题的人。 我们设法找到了解决方案。非常感谢您的回答!

看起来我们在 Jira 中有一个旧的特征文件结构(当时我们没有故事和先决条件)。当我们开始正确使用它时:将 Stories 链接到 Tests 并添加 Pre-condition 然后 Xray 创建了双倍的场景部分。所以我们从 Cucumber Tests 中删除了多余的部分,创建了适当的 Pre-condition,现在特征文件就这样正确地创建了:

@ABC-169
@ABC-131
Feature: Main feature title

    Background:
        #@ABC-166
        Given I open the url "https://example.com/"
        Then I expect that the url is "https://google.com"

    @ABC-132 @ABC-168 @ABC-141
    Scenario: Main scenario
        Given Lorem ipsum
        Then Et sit amet

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?