Vivian River
Vivian River

Reputation: 32380

How to list all unit tests with their output in Visual Studio 2015?

Visual Studio 2015 provides a "Test Explorer" window. From here, you can click to run tests. After the tests run, it shows a table with the green/red pass/fail indicator, the name of each test, and the amount of time it took to run.

After running my tests, I can click on a test and the output from that test will appear in a panel below.

What if I want to see a table showing all tests and their outputs so that I don't have to click thru them one-by-one? It seems like there ought to be a sensible way to do this, as well as export them into a flatfile.

Upvotes: 0

Views: 2263

Answers (1)

Steve Kennedy
Steve Kennedy

Reputation: 5402

There is currently no way to export your results out from the IDE in VS2015. However you can achieve this via the command line.

  1. Open a command prompt and browse to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE.
  2. Type the follwoing command: mstest /testcontainer:[Unit test project dll file path] /resultsfile:[Output Folder Path]\result.trx

I've attached an example: enter image description here

You can evaluate that flat-file (XML) any way you'd want. It is verbose. But, basically you're searching for any instance of outcome="Failed" in the <Results> nodes. You'll see what I'm saying when you see the actual file.

Upvotes: 1

Related Questions