1

I am using Coded UI in VSTS 2013 for creating automated tests using Coded UI Test Builder. I am able to create tests successfully but not able to view their result files. I found that there is a folder TestResults at the project location but it contains only images. I am not able to find the .trx files for the test results.

Also, I tried using the below settings for saving the result files to a different location, this works but as soon as the test case execution is over, test result folders created at this location disappears. In addition to it I am not able to find anything related to this execution in the Test Results window, only Test Explorer window shows the progress and execution result.

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <RunConfiguration>
    <ResultsDirectory>C:\Dhiman\CUITTestResults</ResultsDirectory>
  </RunConfiguration>
</RunSettings>

I have used the following links for the reference

https://msdn.microsoft.com/library/jj635153.aspx

https://stackoverflow.com/questions/14754354/vs2012-unit-tests-how-to-change-the-location-of-the-testresults-folder

I need the .trx files so that I can create HTML report from them using the trx2html application.

2

2 Answers 2

1
+50

I run my Coded UI tests from the commandline with /Logger:trx this generates a .trx file

vstest.console.exe "MyApp\Debug\MyApp.CodedUI.Test.dll" /tests:TestCase1,TestCase2 /Logger:trx

You find the vstest.console.exe in your VS directory: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\

4
  • I tried the same and getting this error "Error: An exception occurred while invoking executor 'executor://mstestadapter/v 1': Access to the path 'C:\Program Files\Microsoft Visual Studio 12.0\Common7\ID E\CommonExtensions\Microsoft\TestWindow\TestResults\Deploy_adhiman 2015-11-23 11 _59_39' is denied.". I don't have administrators right, Do I need to have those for running it?
    – Dhiman
    Nov 23, 2015 at 17:07
  • Not really just add the TestWindow directory to your path and run the vstest.console.exe from the source directory or any other directory you have write access in Nov 23, 2015 at 18:42
  • 1
    It worked for me but I changed your solution a bit, I used .runsettings file and provided the path of the test results in that file. This path was the one where I have write permissions. But at last your solution solved my issue.
    – Dhiman
    Nov 30, 2015 at 15:53
  • So there's no way to generate the .TRX programmaticaly? Man...
    – FDM
    May 17, 2016 at 12:57
0

As far as I know, we couldn’t get the .trx file when we run the coded UI test in the VS 2012 IDE now, one solution is that you could run it in command line eg.

MSTest /testmetadata:Bank.vsmdi /resultsfile:BanktestResults.trx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.