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:
However, when I’d run a build, I got this in the Build summary:
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.
When I looked in the output of the build tasks, I found these files:
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:
Once I saved this (with a comment), and ran a new build, I could see test results.
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.