微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 TRX 文件中添加日志文件或失败截图

如何解决在 TRX 文件中添加日志文件或失败截图

我是 Jest 的新手,我正在尝试使用 jest-trx-results-processor 为 Jest 生成 trx 文件(以在 azure ADO 中发布结果)。

我能够生成 trx,但在将结果文件添加到测试失败时遇到困难。

现在它只创建没有 ResultFile 的 UnitTest 节点,例如下面:

<UnitTestResult executionId="df9fd2e3-5889-4c60-9019-583cd48bf821" testId="3a7d9eab-0d0a-02bc-d094-3409dbb19e06" testName="TestMethod3" computerName="name-Z2" duration="00:00:00.0277049" startTime="2021-03-12T12:21:45.2193871+05:30" endTime="2021-03-12T12:21:45.2473877+05:30" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="df9fd2e3-5889-4c60-9019-583cd48bf821">
  <Output>
    <StdOut>TestContext.TestName='TestMethod3'  static _testContext.TestName='TestMethod1'</StdOut>
    <ErrorInfo>
      <Message>Assert.IsTrue Failed. </Message>
      <StackTrace>   at UnitTestProject1.UnitTest1.TestMethod3() in C:\Users\name\source\repos\UnitTestProject1\UnitTestProject1\UnitTest1.cs:line 33</StackTrace>
    </ErrorInfo>
  </Output>
  
</UnitTestResult>

但我想要如下内容

<UnitTestResult executionId="df9fd2e3-5889-4c60-9019-583cd48bf821" testId="3a7d9eab-0d0a-02bc-d094-3409dbb19e06" testName="TestMethod3" computerName="name-Z2" duration="00:00:00.0277049" startTime="2021-03-12T12:21:45.2193871+05:30" endTime="2021-03-12T12:21:45.2473877+05:30" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="df9fd2e3-5889-4c60-9019-583cd48bf821">
  <Output>
    <StdOut>TestContext.TestName='TestMethod3'  static _testContext.TestName='TestMethod1'</StdOut>
    <ErrorInfo>
      <Message>Assert.IsTrue Failed. </Message>
      <StackTrace>   at UnitTestProject1.UnitTest1.TestMethod3() in C:\Users\name\source\repos\UnitTestProject1\UnitTestProject1\UnitTest1.cs:line 33&#xD;</StackTrace>
    </ErrorInfo>
  </Output>
  **<ResultFiles>
    <ResultFile path="MachineName-Z2\IMG-20210309-WA0002.jpg" />
  </ResultFiles>**
</UnitTestResult>

谁能帮助我如何使用 jest-trx-results-processor 在 trx 中获取 ResultFiles 节点?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 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”。这是什么意思?