Coder Social home page Coder Social logo

gfoidl / trx2junit Goto Github PK

View Code? Open in Web Editor NEW
69.0 6.0 17.0 404 KB

Transforms XML from trx-Testresults to JUnit-Testresults / trx to JUnit XML and the other way round

License: MIT License

C# 92.43% Shell 7.57%
trx xml trx-testresults ci-scenarios junit unit-testing dotnet-global-tool junit-xml junit2trx trx2junit

trx2junit's Introduction

CI NuGet
Build Status NuGet

trx2junit (.NET Core global tool)

Helper for converting trx-Testresults (dotnet test --logger "trx") to a JUnit-based XML file.

Can be used for CI-scenarios, like CircleCi or GitLab, where as test results JUnit is expected.

Usage

trx to junit

When installed as .NET Core Global Tool: trx2junit {trxFile} where trxFile is the path to the trx-file.

You can pass more than one trx file, each will create it's own junit xml file.

# handle two files
$ trx2junit a.trx b.trx
Converting 2 trx file(s) to JUnit-xml...
Converting 'a.trx' to 'a.xml'
Converting 'b.trx' to 'b.xml'
done in 0.1234567 seconds. bye.

# for shells that handle wildcard expansion:
$ trx2junit results/*.trx
Converting 1 trx file(s) to JUnit-xml...
Converting 'example.trx' to 'example.xml'
done in 0.1234567 seconds. bye.

If the shell won't handle wildcard expansion, trx2junit handles the expansion of files in the same directory.

A different location for the JUnit-output can be specified:

# specify different output location
$ trx2junit a.trx --output ../results

# or
$ trx2junit --output results a.trx ../tests/b.trx

Jenkins JUnit

For Jenkins JUnit on the testcase the status-attribute is set. By default 1 is set for success, and 0 for failure. This can be configured via environment varialbes (note: if omitted, the default values will be used):

Status Variable default value
success TRX2JUNIT_JENKINS_TESTCASE_STATUS_SUCCESS 1
failure TRX2JUNIT_JENKINS_TESTCASE_STATUS_FAILURE 0
skipped TRX2JUNIT_JENKINS_TESTCASE_STATUS_SKIPPED not set

With environment variable TRX2JUNIT_JUNIT_ERROR_MESSAGE_IN_CDATA set, the error message from a failing test will be repeated in the CDATA-content of the <failure> element. See this comment for further info.

junit to trx

With option --junit2trx a conversion from junit to trx can be performed.

If a given xml-file is not a junit-file, a message will be logged to stderr and the exit-code is set to 1. A junit-file is considered valid if it either conforms to junit.xsd or jenkins-junit.xsd.

Installation

dotnet tool install -g trx2junit

For CI-scenarios execute before usage:

export PATH="$PATH:/root/.dotnet/tools"

Check also the documentation of your CI-system on how to persist the PATH between steps, etc. E.g. in CircleCI you need to run

echo 'export PATH="$PATH:/root/.dotnet/tools"' >> "$BASH_ENV"

Prequisites / Supported SDKs

In order to install this tool a .NET SDK must be present. Supported SDKs are:

  • .NET 8.0
  • .NET 7.0
  • .NET 6.0

Core functionality as standalone package trx2junit.Core

Starting with v2.0.0 it's possible to use the core functionality as standalone package trx2junit.Core.
The tool (see above) itself is a consumer of that package.

After adding a reference to trx2junit.Core one can use it in "commandline-mode" like

Worker worker         = new();
WorkerOptions options = WorkerOptions.Parse(args);
await worker.RunAsync(options);

or create the WorkerOptions via the constructor, and pass that instance into RunAsync of the worker.

Development channel

To get packages from the development channel use a nuget.config similar to this one:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="gfoidl-public" value="https://pkgs.dev.azure.com/gh-gfoidl/github-Projects/_packaging/gfoidl-public/nuget/v3/index.json" />
    </packageSources>
</configuration>

trx2junit's People

Contributors

cheng93 avatar gfoidl avatar gmo-gfoidl avatar itzalive avatar ne4to avatar ryepup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

trx2junit's Issues

Full path to trx2junit necessary in Circle CI

This is not really a bug report, but more of an information: I had to write the full path to trx2junit (/root/.dotnet/tools/trx2junit) to get it to work in Circle CI.

Would it be worth mentioning this in the readme? It might also be nice to add a bit more info about configuring Circle CI. Here are the steps related to the tests in my config.yml.

version: 2
jobs:
  build_and_deploy:
    docker:
      - image: microsoft/dotnet:2.2-sdk

      # ...

      - run:
          name: Run tests
          command: |
            dotnet test --logger trx --results-directory "..\TestResults"

      # ...

      - run:
          name: Install TRX 2 JUnit converter
          command: |
            export PATH="$PATH:/root/.dotnet/tools"
            dotnet tool install -g trx2junit
          when: always

      - run:
          name: Convert TRX test results to JUnit format
          command: |
            /root/.dotnet/tools/trx2junit TestResults/*.trx
          when: always

      - store_test_results:
          path: TestResults

Timezone from timestamp should be taken into account

Cf. #104 (comment) point 1.

Would it be possible to convert the time zone of the timestamp? In the source file it's, e.g., 2022-07-08T11:59:02.3117362+02:00 but the converted one is 2022-07-08T11:59:03. The expected result could be 2022-07-08T09:59:03;

Maybe provide a switch for UTC / local timezone in the results.

Jenkins-Junit not finding tests in test results history

Problem

Jenkins show empty build history list for tests.

Trx2Junit creates tag <testcase/> with attributes name=FullyQualifiedTestName and classname=FullyQualifiedClassName. This leads to double usage of namespace in test result name and somehow breaks Jenkins from finding build with given test in history.

image

Solution I found

Do not use fully qualified name in <testcase> name attribute.

Expected

Trx2Junit creates tag <testcase/> with attributes name=TestName and classname=FullyQualifiedClassName.

Object reference not set to an instance of an object.

I have a test file generated by this command:
dotnet test --logger trx

However, when I try to convert the file on jrx2unit version 1.4.0 using this command:
trx2junit .\failing.trx

I get this error:
Object reference not set to an instance of an object.

And the conversion fails. I've attached an anonymized file that reproduces the issue (note: file was renamed from trx to txt so that I could attach it to the issue).
failing.txt

If it changes anything, the tests were done in F# originally, although other trx files from F# tests that I have convert successfully.

Edit: The original file had 12 tests, I've edited them out for a smaller file.
Edit2: Please ignore the reference to the PR. I didn't expect this to show up as "mentioned" here and now I can't remove it. Error on my part.

NUnit trx-output with no / empty tests results in exception

Object reference not set to an instance of an object.
<?xml version="1.0" encoding="utf-8"?>
<TestRun id="ebd14c86-c0ed-4e77-936f-455116621735" name="@db218a987583 2018-11-13 22:40:12" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Times creation="2018-11-13T22:40:12.4876192+00:00" queuing="2018-11-13T22:40:12.4876194+00:00" start="2018-11-13T22:40:11.7576546+00:00" finish="2018-11-13T22:40:12.5000059+00:00" />
  <TestSettings name="default" id="072fbc10-f1f2-4da2-8594-ddd4a4ac2c50">
    <Deployment runDeploymentRoot="_db218a987583_2018-11-13_22_40_12" />
  </TestSettings>
  <TestLists>
    <TestList name="Results Not in a List" id="8c84fa94-04c1-424b-9868-57a2d4851a1d" />
    <TestList name="All Loaded Results" id="19431567-8539-422a-85d7-44ee4e166bda" />
  </TestLists>
  <ResultSummary outcome="Completed">
    <Counters total="0" executed="0" passed="0" failed="0" error="0" timeout="0" aborted="0" inconclusive="0" passedButRunAborted="0" notRunnable="0" notExecuted="0" disconnected="0" warning="0" completed="0" inProgress="0" pending="0" />
    <Output>
      <StdOut>NUnit Adapter 3.11.0.0: Test execution startedRunning all tests in /root/repo/tests/my/bin/Release/netcoreapp2.1/my.dll   NUnit couldn't find any tests in /root/repo/tests/my/bin/Release/netcoreapp2.1/my.dll NUnit Adapter 3.11.0.0: Test execution complete</StdOut>
    </Output>
    <RunInfos>
      <RunInfo computerName="db218a987583" outcome="Warning" timestamp="2018-11-13T22:40:12.4156993+00:00">
        <Text>No test is available in /root/repo/tests/my/bin/Release/netcoreapp2.1/my.dll. Make sure that test discoverer &amp; executors are registered and platform &amp; framework version settings are appropriate and try again.</Text>
      </RunInfo>
    </RunInfos>
  </ResultSummary>
</TestRun>

Release main library separately?

Hello and thank you so much for this project!

I was wondering if you had any interest in releasing the main code as a separate nuget package / library that could be integrated into other tools such as Nuke.Build? The separate tool requires one extra step to set up / maintain a build server. However, it works so well I don't mind doing it :)

My use case was that I wanted to simplify my unit test running so I have dotnet-vstest output a TRX file (so I don't need a custom logger). But Jenkins was taking 10+ minutes to ingest the TRX file. Converting it to Junit reduced the file size and the import time to a few seconds. Thanks again.

Test count for separate test suites are being combined

Summary

When a test result file contains multiple test stuites the count of tests in each test suite is not reset each time and is a cumulative total.

Steps to reproduce

  • xUnit project with tests in separate namespaces
  • Run dotnet test
  • Make trx report

What is the current bug behavior?

  • Each test-suite has a cumulative total of the number of tests.

What is the expected correct behavior?

  • Each test-suite has an individual total of the number of tests

Relevant logs and/or screenshots

test-results.txt

Further technical details

trx2junit-version: v1.2.2
Operating system: Windows 10

trx2junit generates invalid output (field time) (according to surefire schema)

Summary

trx2junit generates output like:

  <testsuite name="MyTest" hostname="XXX" package=".NET Core" id="0" tests="1" failures="0" errors="0" skipped="0" time="77.541159" timestamp="2019-08-22T16:23:13">

The time field uses lots of decimal places.

SUREFIRE_TIME allows at most 3.

It would be awesome to comply with the surefire definition for compatibility reasons. The needed change is easy and the loss of accuracy is neglectable. Do you agree?

xTestSuite.Add(new XAttribute("time"    , (decimal)_counters.Time.TotalSeconds));

would be to become

xTestSuite.Add(new XAttribute("time"    , ((decimal)_counters.Time.TotalSeconds).ToString("0.000")));

Further technical details

trx2junit-version: v1.2.2
Operating system: Windows 10

Run trx2junit with file parameter returns "Path cannot be empty string or whitespaces"

Summary

After install the trx2junit as global tool I've try it on the console with an trx report. It fails with the Output
"Path cannot be the empty string or all whitespace. Parameter name: path"

Steps to reproduce

  • Make trx report

What is the current bug behavior?

  • The trx2junit tool returns "Path cannot be the empty string or all whitespace.
    Parameter name: path"

What is the expected correct behavior?

  • The trx2junit tool returns an xml file

Relevant logs and/or screenshots

grafik

Further technical details

Operating system: Windows 10
IDE: Visual Studio 2017

Cannot process multipul files (Windows CMD)

Summary

When trying to process multiple files in a Windows CMD (which can handle wild cards) it will not process

Steps to reproduce

  • Make trx reports
  • Open CMD
  • Run Cmd:

"C:\Users\USER\source\repos\folder\myproject\TestResults*.trx"

What is the current bug behavior?

  • The trx2junit tool returns "The filename, directory name, or volume label syntax is incorrect : trx2junit "C:\Users\USER\source\repos\folder\myproject\TestResults*.trx"
    "

What is the expected correct behavior?

  • The trx2junit tool returns an ,many xml file

trx2junit-version: v1.2.2
Operating system: Windows 10

make internal types (like Trx2JunitTestResultXmlConverter) public

Summary

I wanted to adjust the behavior slightly. (Write the message attribute in system-out, because gitlab ignores message attribute).
It was not possible, because the Trx2JunitTestResultXmlConverter and xml Models are internal.
That's a pitty, because the rest of this little tool is great.

Support for dotnet 6

Using the mapper for our dot net builds and works great. Only issue is that we need to include .net 5 in our docker images as well as .net 6 which is what our applications require. This results in a bulkier than necessary docker image. Would be nice if the trx2junit had support for the later dotnet 6 SDK.

Timestamp and error message conversion

Hello,

I am currently converting the attached "test.trx" file to the attached "test.xml" file.
test.zip

I have two requests:

  1. Would it be possible to convert the time zone of the timestamp? In the source file it's, e.g., 2022-07-08T11:59:02.3117362+02:00 but the converted one is 2022-07-08T11:59:03. The expected result could be 2022-07-08T09:59:03;
  2. You can see that the error message is repeated in the converted file:
<failure message="Assert.AreEqual failed. Expected:&lt;1&gt;. Actual:&lt;2&gt;. " type="not specified"><![CDATA[Assert.AreEqual failed. Expected:<1>. Actual:<2>. 
   at UnitTestProject1.UnitTest1.TestMethod1() in C:\Users\massimiliano.piatto\source\repos\UnitTestProject1\UnitTestProject1\UnitTest1.cs:line 12]]></failure>

Would it be possible to indicate only the entire CDATA string in the "message" attribute without providing other strings?

Thank you so much for your work!

Further technical details

trx2junit-version: v2.0.1
Operating system: Windows 11
Visual Studio version: v17.2.5

Remove Console usage from Worker

#93 was more or less a huge refactoring to create the standalone-package, but the console usage from the Worker wasn't removed. E.g.

Console.WriteLine($"done in {(DateTime.Now - start).TotalSeconds} seconds. bye.");

The Worker shouldn't write to console instead it could send notifications (maybe events) that the tool can listen and write itself to the console.


For now I'm going to leave it as is, if there's any feedback in order to address this issue it will be done (I'm just busy enough otherwise).

The term 'trx2junit' is not recognized as the name of a cmdlet, function, script file, or operable program

I'm trying to setup the trx2junit in circleci but can't get it to work, so far my relevant code is:

# ...

- run:
     name: "Run Application Tests"
     command: dotnet test --no-build --logger "trx" --results-directory tests/output
 - run:
    name: "Collect Test Results"
     when: always
     command: |
        dotnet tool install -g trx2junit
        echo 'export PATH="$PATH:/root/.dotnet/tools"' >> "$BASH_ENV"
        trx2junit tests/output/*.trx --output tests/TestResults

Error from circleci:

 Since you just installed the .NET SDK, you will need to reopen the Command Prompt window before running the tool       you installed.
 You can invoke the tool using the following command: trx2junit
 Tool 'trx2junit' (version '2.0.0') was successfully installed.
 trx2junit : The term 'trx2junit' is not recognized as the name of a cmdlet, function, script file, or operable 
 program. Check the spelling of the name, or if a path was included, verify that the path is correct and try  again.
 At line:3 char:1

Any ideas on how I can overcome this?
Also this started as we're setting up .NET 6 in our build pipelines, until then the following code worked without a problem:

 - run:
     name: "Collect Test Results"
     when: always
     command: |
        dotnet tool install -g trx2junit
        trx2junit tests/output/*.trx --output tests/TestResults

.NET 6 compatibility

Summary

trx2junit doesn't work with .NET 6.0 SDK.

Steps to reproduce

Install .NET SDK 6.0 (no other versions), install trx2junit and run it.

What is the current bug behavior?

trx2junit returns:

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (x64) was not found.
  - The following frameworks were found:
      6.0.0 at [/nix/store/ik02f65i5nkiy0qfpn0wz6dskgdqc16j-dotnet-core-combined/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64

What is the expected correct behavior?

trx2junit should work normally.

Further technical details

trx2junit-version: v1.5.0
Operating system: NixOS 21.11 (unstable)

"Cannot get required symbol SSL_set_alpn_protos from libssl" when installing trx2junit (.NET 7)

Summary

We have a build script running on Bitbucket Pipelines that has been running just fine. Today we updated to .NET 7, and we get this message when attempting to run this command: '/usr/share/dotnet/dotnet tool install -g trx2junit': "Cannot get required symbol SSL_set_alpn_protos from libssl"

Steps to reproduce

wget https://dot.net/v1/dotnet-install.sh
chmod a+x dotnet-install.sh
export PATH="$PATH:/root/.dotnet/tools"
./dotnet-install.sh -c 7.0 --install-dir /usr/share/dotnet
apt-get update && apt-get install -y icu-devtools
cd test/Project.UnitTests
# Run tests
docker-compose up --detach
/usr/share/dotnet/dotnet tool install -g trx2junit

What is the current bug behavior?

  • We get the error message "Cannot get required symbol SSL_set_alpn_protos from libssl" when attempting to install trx2junit with .NET 7 SDK installed

What is the expected correct behavior?

  • trx2junit is installed as a global tool

Relevant logs and/or screenshots

image

Tried to update libssl by adding "libssl-dev" to the line starting with apt-get, but this had no effect, the error message stayed the same

Further technical details

trx2junit-version: v2.0.4
Operating system: Ubuntu 14.04.5 LTS

Productize v1.2.5

v1.2.5 will add support for .NET Core 3.0, which is currently in preview (and that's the problem 😉).

Check if trx2junit runs correclty on

  • .NET Core 2.1
  • .NET Core 2.2
  • .NET Core 3.0 (preview)

Implement as custom logger

It would be great if you could implement this as a custom logger or something:

dotnet test mysrc --logger:trx;trx2junit

The bummer with this with some CI implementations is that if the test fails, the build fails immediately before I get a chance to convert the output

Can not use this tool after installed by suggestion way

Summary

Using dotnet tool install -g trx2junit in Centos7 by the recommend way, but it doesn't work.

Steps to reproduce

  1. First, use CLI to install this tool: dotnet tool install -g trx2junit
  2. Add this tool the Path: export PATH="$PATH:/root/.dotnet/tools"
  3. Then use this tool to convert my report: trx2junit _99d190d23823_2019-11-07_07_23_00.trx
  • Make trx report

What is the current bug behavior?

A fatal error occurred, the required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/root/.dotnet/tools/.store/trx2junit/1.2.6/trx2junit/1.2.6/tools/netcoreapp2.1/any/].
If this is a framework-dependent application, install the runtime in the default location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location.

What is the expected correct behavior?

The above command should work. And there should be a file with same name under the TestResults folder.

Relevant logs and/or screenshots

A fatal error occurred, the required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/root/.dotnet/tools/.store/trx2junit/1.2.6/trx2junit/1.2.6/tools/netcoreapp2.1/any/].
If this is a framework-dependent application, install the runtime in the default location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location.

Further technical details

trx2junit-version: v1.2.6
Operating system: docker image Linux-dotnetcore-sdk-2.1

Deploy as "global tool"

.net core 2.1 allows the use of "global tools", so this tiny helper should be provided as global tool and not be shipped as xcopy.

JUnit2Trx

Is there a tool that converts test results in the opposite way? It would be valuable for Azure DevOps, where some functionality only works with trx results

Can your tool be extended to do this conversion?

Explicit-Test throws Nullreference-Exception

When a test is marked as Explicit a Nullreference-Exception is thrown, because there is no attribute duration

Example-XML-fragment:

<UnitTestResult executionId="3b314f8f-273c-43e6-aa10-88b05fc769fe" testId="2fa84286-9440-49c7-b50e-c9702a57ae61" testName="Id_given___correct_Id" computerName="11ba2763d1e5" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="NotExecuted" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="3b314f8f-273c-43e6-aa10-88b05fc769fe" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Output>
    <ErrorInfo>
      <Message>OneTimeSetUp: DB-Access</Message>
    </ErrorInfo>
  </Output>
</UnitTestResult>

This case should be handeled correctly.

xml file doesn't have all the details which it suppose to be, it looks quite empty

@gfoidl
I too noticed that the converted file is quite empty.
And my need is to convert the file of trx and import it to QMetry (addon to Jira). They provided some sample xml which they are supporting.
Now, I need to make sure the converted file should be quite similar to QMetry file else it would not get imported. So, i shared it with you as the converted xml file was looking empty.

Originally posted by @jsingh-qualitrol in #69 (comment)

Standard output per testcase

Hey there! First and foremost, thank you for this tool. It's being really helpful on the project i'm working on.

I have a question regarding the program output when parsing a TRX file that contains StdOut tags.

Here is the thing, if i open a TRX file where something was logged to the standard output, i get the following contents:

<UnitTestResult executionId="cceebcd2-10e0-4686-9d39-967f741560b8" testId="bd714b51-519d-8e5e-17f4-3146b90f62cf" testName="Test1" computerName="whatever" duration="00:00:00.0407230" startTime="2020-06-09T14:47:46.0000000-03:00" endTime="2020-06-09T14:47:46.0000000-03:00" testType="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b" outcome="Failed" testListId="8c84fa94-04c1-424b-9868-57a2d4851a1d" relativeResultsDirectory="cceebcd2-10e0-4686-9d39-967f741560b8">
      <Output>
        <StdOut>Hello, world!</StdOut>
        <ErrorInfo>
          <Message>  Expected is &lt;System.Int32[2]&gt;, actual is &lt;System.Int32[5]&gt;
               Values differ at index [0]
               Expected: 4
               But was:  0
          </Message>
          <StackTrace>   at Tests.Test1() in /home/fabio/workspace/sample/Tests.cs:line 16
          </StackTrace>
        </ErrorInfo>
      </Output>
</UnitTestResult>

Notice that there is a StdOut tag with the contents that were logged for a specific unit test.

I was looking at the xml generated by JUnit in a Java project, and i noticed that it behaves similarly. Take a look at this example:

<testcase name="test1" classname="Tests" time="0.006">
    <failure message="array lengths differed, expected.length=2 actual.length=5" type="java.lang.AssertionError">java.lang.AssertionError: array lengths differed, expected.length=2 actual.length=5
	at Tests.test1(Tests.java:10)
    </failure>
    <system-out><![CDATA[Hello World!]]></system-out>
</testcase>

There is a system-out tag with the contents logged at a specific test case.

If i attempt to run trx2junit on the first file i mentioned, the output will group all the standard outputs in a generic system-out tag.

Is this the correct behavior? When looking at the code, it seems that this behavior is on purpose, but it seems to me that mapping the contents in UnitTestResult -> StdOut tag to testcase -> system-out would make more sense. Am I right?

Thank you for your time!

dotnet install tool issue

So I had to dotnet install tool -g --version '1.0.2' trx2junit to get it to work. Kept saying / complaining about being in preview mode. Just a FYI if anyone has the issue.

Feature request: handle multiple trx files

Some of our repositories have multiple test projects that create multiple trx files. I'd like to be able to run a command like:

$ trx2junit projectCore.trx projectClient.trx projectServer.trx

and produce one junit.xml file that covers all three. I figure set of command-line options leaves trx2junit backwards compatible.

Would you be open to this feature? I'd be open to contributing it.

Incorrect testcase names in xml

Summary

When converting trx results to xml testcase name field in xml shows incorrect data

Steps to reproduce

  1. Create trx files with dotnet test --logger "trx;LogFilePrefix=UnitTestResult" -r /reports
  2. Run trx2junit /reports/*

What is the current bug behavior?

When there's a dot/dots in a testcase name, only the part after the last dot ends up in xml testcase name field.
For example I get this value:
testcase name="5 TB&quot;)"
instead of
testcase name="SomeText(&quot;1.5 TB&quot;)"

What is the expected correct behavior?

Unchanged testcase name is in xml

Relevant logs and/or screenshots

Further technical details

trx2junit-version: v2.0.3
Operating system: docker

P.S.

Tried switching to v1.6.0, this version creates xml files with correct testcase names

TestDefinitions with multiple UnitTestResults not recognized correclty

Summary

When the TRX TestDefinitions output does not match the number of TestEntries and Results.

The JUnit file is a bit dodgy.

Read more here microsoft/vstest#1989

https://circleci.com/gh/cheng93/TripleTriad/29#tests/containers/0
Is an example

Steps to reproduce

  • Follow the steps in associated issue
  • Create junit file from trx

What is the current bug behavior?

  • Counts are wrong in junit

What is the expected correct behavior?

  • Counts are correct in junit

Relevant logs and/or screenshots

Further technical details

trx2junit-version: v1.2.2
Operating system: linux


I will try to get

  • Unit test
  • trx
  • junit xml
    when I get home/time

Jenkins-JUnit: set status attribute on testcase

Could you please include additional junit parameters corresponding to each test case like ‘failure=“false” error=“false” success=“true”. I need these values in my junit XML so I can upload results to Microfocus ALM through Jenkins plugin. Awesome job by the way.

Or if you can include status attribut alone that will also solve my problems. Below screen shot from Jenkins-junit.SDF which has status attribute corresponding to test caseimage

Investigate AOT compilation (for .NET 7)

Output is just the binary, so

  • "curl"-install possible instead of installing the .NET tool
  • independence of installed .NET SDKs (cf. #88, #113)
  • maybe a deb-package can be created, so installation is just apt install trx2junit

Just did a quick try to see if it works. For win-x64 the binary has ~10 MB and tests pass.

Change Status Atribute values to True/False instead of 1/0

Hi Gunther,

I made mistake while testing. Could you change Status Atribute values to True/False instead of 1/0. Sorry for causing you rework. Appreciate if you can fix it. Thanks in advance.

True: if test case is passed
False: if test case is failed

support mstest `Warning` outcomes

In some circumstances mstest can generate XML like:

<TestRun ...>
  <ResultSummary outcome="Warning" ...>   <!-- lots of other stuff --> </ResultSummary>
  <!-- lots of other stuff -->
</TestRun>

Expected behavior:

trx2junit parses the file and writes a junit-formatted xml file

Actual behavior

trx2junit fails with Requested value 'Warning' was not found. when parsing XML

PR coming shortly.

Unhandled Exception with MsTest

I got a message via NuGet (that's the reason for #7):

trx2junit : At line:1 char:1 + trx2junit "C:\files\result.trx" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError

Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an object. at trx2junit.Program.ReadResults(XElement trx) in /root/repo/source/trx2junit/Program.cs:line 73 at trx2junit.Program.ReadTrx(String trxFileName) in /root/repo/source/trx2junit/Program.cs:line 50 at trx2junit.Program.Main(String[] args) in /root/repo/source/trx2junit/Program.cs:line 36

It can be confirmed that this is a bug -- cf. https://circleci.com/gh/gfoidl/trx2junit/49

Neted TestResultAggregation/InnerResults elements

I the test report that I get when running tests grouped in the test suits there are nested TestResultAggregation/InnerResults tags as presented below. When I try to parse such file I get error related to time offset but deeper investigation shows that this case is not handled by trx2junit.

<Results>
    <TestResultAggregation >
      <Counters  />
      <InnerResults>
        <TestResultAggregation >
          <Counters  />
          <InnerResults>
            <UnitTestResult  relativeResultsDirectory="dfee6613-9ad7-4afc-b7e6-4db871687da7">
              
            </UnitTestResult>
          </InnerResults>
        </TestResultAggregation>
      </InnerResults>
    </TestResultAggregation>
 </Results>

The UTC time represented when the offset is applied must be between year 0 and 10,000. (Parameter 'offset')

Summary

The tools fails on computers with a timezone other than UTC due to the error The UTC time represented when the offset is applied must be between year 0 and 10,000. (Parameter 'offset')

Steps to reproduce

  • Make trx report
  • Set computer timezone to anything other than UTC
  • Use the tool to convert the trx report

What is the current bug behavior?

  • The trx2junit tool returns The UTC time represented when the offset is applied must be between year 0 and 10,000. (Parameter 'offset')

What is the expected correct behavior?

  • The trx2junit tool returns an xml file

Relevant logs and/or screenshots

Changing the timezone to UTC fixed the problem. See this thread.

Further technical details

trx2junit-version: v2.1.0
Operating system: Windows 11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.