Thursday, June 9, 2016

Test Coverage In Go

In my previous post I showed how to write basic tests in Golang. In this post we will go through how to identify test coverage in Golang with it's inbuilt commands. I will continue with the source code from previous post.
First run following command. Output is about basic details of test coverage in our current code base.
Next add new function like below.
Again run command for test coverage. This time output is different.
If you need to get function wise output, then we need to run following command.
Further if you need to export those data into html, you can use following command. It will output the details into your default web browser.
The output is like below.

No comments:

Post a Comment