Blog Post

Setting up Code coverage in VSTS

Thursday, November 17, 2016 2:31 PM

I wanted to know how to setup Code Coverage in VSTS. This helps the business how much code us covered by unit tests.


I have to however warn you, the code coverage does not mean all outputs of the code are tested, only that a test goes through the line. IE it is not absolute truth.


How to setup Code Coverage

I am starting from the point that you know how to setup build in VSTS.

build step

Build step configuration

I have started with adding Test step to my build. Check Code Coverage Enabled in your configuration. How ever running code coverage will increase your build time, so If you are running hosted build agent you might want to consider if you really need it.

Now may have noticed that I have checked, run tests in parallel. This option means that the tests cannot be dependent on each other.


The final configuration is below.