Define code coverage? (C# unit testing interview questions with answers)

This question is taken from the book .NET interview question by Shivprasad koirala , we are thankful to the author to allow us to publish this question on this site.

Code coverage is a measure used during software testing which describes how much part of your source code has been tested.  So if you see that critical part of your code is not tested by your test case probably you need to update the test case accordingly to get a better coverage result.

To see  how much code coverage has been done by test cases.

Click on Test menu → Analyze code coverage → All tests.

Once the coverage runs its shows a detail report as shown below stating which section do not have coverage. For instance in the below report it stating that the “Calculate” method of maths has 25% code which is not covered by the test cases.

Also read this article What is Cyclomatic complexity ? ( c# unit testing interview question with answers)

Watch the below video What is test driven development ( TDD) ?

We are thankful to to provide this c# unit testing interview question.

This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply