Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving unit test results after running tests

In Visual Studio 2013, running all my Visual Studio unit tests shows the test results, together with callstack, exception information and a stack trace of failing tests. Is there any way of saving the test results, after test execution, such that I can open up previously run tests?

I have read posts that explain that failing test results are kept, in the TestResults folder, while successful tests are deleted. Unfortunately neither failing nor successful test results remain, in my TestResults folder, after running the tests.

I tried creating and using a .runsettings file and setting the element to false, but this didn't change anything.

Anyone know how to keep the test results, for later inspection?

like image 742
Mort Avatar asked Jan 30 '15 11:01

Mort


2 Answers

Hi I have the same problem, the solution for me was use command console.

You need to use VSTest.console.exe located at : C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow

You should go to that location using visual studio command prompt. After that type: VSTest.console yourFullProjectPath\YourTestProject\bin\reléase\YourTest.dll /logger:trx

After completed you can find results in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\TestResults

Regards

like image 103
blinchi Avatar answered Oct 13 '22 12:10

blinchi


In Visual Studio 2019, the closest I can get to a 'report' using just the GUI and no command lines is to select the tests you want to export (you can use CTRL+A to select all) and then using CTRL+C to copy.

Just select them all like this

Afterwards, you can paste to any text editor or Excel spreadsheet, it will look a bit funky like this:

Result after pasting to Excel

As you can see, the first column has the test name and result. But with a bit of manipulation in Excel then you probably can get some nicer looking result :)

like image 44
Nik A. Avatar answered Oct 13 '22 11:10

Nik A.