2

I have the Enterprise edition of Visual Studio, but not everyone does.

How can I share the TRX so that other people can see the results? I've seen that there are several Trx to HTML convertors but they're all quite old and either don't work any more or don't show the details of the test.

BanksySan
  • 27,362
  • 33
  • 117
  • 216

2 Answers2

2

Most of the results of a load test are stored in a database. The TRX file has only a very small portion of the results - you can easily see what it actually contains by opening the file in Notepad, it is just XML.

Visual Studio trial versions have some support for load tests. (They only support a small number of virtual users and do not support plugins.) They might allow viewing and analysis of the results of runs done on other computers. This limited support of load tests might also be available on licenced Non-Enterprise versions.

The results of individual load test runs, or groups of runs, can be copioed from one computer to another by using the Export and Import commands in the "Open and manage load test results" window. These create and read LTRAR files. See here for more details.

The TRX file contains a connection string to the SQL database and so the file cannot normally be copied and then work properly on another computer. The encoded connection string is located within the resultsRepositoryConnectString=... attribute within the TRX file. Changing the value in a copied file to a value found in a working TRX file on the destination computer allows the copied file to work. See here for more details.

The only other options for viewing results on other computers would be by exporting the results in Excel by using the "Create Excel Report" command. (Access it via the icons on the "Summary - Graphs - Tables - Details - ..." line in the load test results viewer.)

AdrianHHH
  • 13,492
  • 16
  • 50
  • 87
1

For unit tests, but not load tests, I routinely export trx files from my unit tests, because they ARE shareable, can be placed as attachments into our launch control systems, and DO contain all of the data necessary for the downstream teams to verify the results, including test console output. I do this with a custom task added to the project that runs the vstest.console.exe, with the /logger:trx;logfilename="blah" command line switch. The full task line is:

<Exec Command="&quot;$(DevEnvDir)commonExtensions\Microsoft\TestWindow\vsTest.console.exe&quot; &quot;$(MSBuildProjectDirectory)\$(OutputPath)$(AssemblyName).dll&quot; /logger:trx;LogFileName=&quot;$(MSBuildProjectDirectory)\testResults.trx&quot;" />

You can also add ContinueOnError="true" if you don't want a test failure to stop the build.

MSTest still seems to ship with visual studio, supposedly does support load tests, and historically has exported TRX files, but I haven't tried it. Running pre-2019 unit test projects, that still have tasks pointed to mstest, in vs2019 tend to fail with assembly version errors, so I don't know if it even still works at all.

user34314
  • 153
  • 5
  • Thanks for clarifying. But note that the question was specifically about load tests and their TRX file has very little content, it is really just a link into the SQL database that holds the full results. – AdrianHHH Oct 14 '20 at 07:29
  • Sorry, I missed that. I always forget to look at the tags. – user34314 Oct 15 '20 at 14:56
  • I've modified my answer so it more accurately doesn't try to answer the specific question, but have left it in case it is useful in the future. A moderator can delete it if they wish. I also offer mstest as a possible solution, but I've never actually tried it for load tests. – user34314 Oct 15 '20 at 15:06