在 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.JdbcOdbc...