1

I am new to Jest, I am trying to generate trx file (to publish result in azure ADO) for Jest using jest-trx-results-processor.

I am able to generate the trx but I am facing difficulties in adding result file to the test failure.

Right now its only create UnitTest Node withouth ResultFile e.g. below:

<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>

But I want something like below:

<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>

Can anyone help how i can get ResultFiles Node in the trx using jest-trx-results-processor.?

user1
  • 121
  • 1
  • 1
  • 6

0 Answers0