DB CI: Getting Test Results in VSTS

One of the things I struggled with a bit was getting test results to appear in VSTS from my builds.

Here’s my original Build flow:

2016-10-07 10_50_32-Microsoft Visual Studio Team Services

However, when I’d run a build, I got this in the Build summary:

2016-10-07 10_51_43-Microsoft Visual Studio Team Services

That’s not great, and I knew this could work better, so I started to look at where my test results were. Here’s what I did to get the results to appear.

I added a Publish Test Results task to the end. This is in the “Test” section of the Task catalog.

2016-10-07 10_39_11-Microsoft Visual Studio Team Services

When I looked in the output of the build tasks, I found these files:

2016-10-07 10_31_41-s

I kept thinking I needed to get the .trx file to load, but that wasn’t correct. I really wanted the “*reports.junit.xml” file. After a little experimenting, I configured the task like this:

2016-10-07 10_40_33-Microsoft Visual Studio Team Services

Once I saved this (with a comment), and ran a new build, I could see test results.

2016-10-07 10_31_50-Microsoft Visual Studio Team Services

I could have just read the XML file in my build result folder, but that’s a pain. Typically we don’t care unless there is a failed test, but when there is, it’s nice to see what actually failed.

Plus, having the results in the console means I can show the other developers and management that tests are being run and are checking code.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , , . Bookmark the permalink.