![]() ![]() I take my simple demo application and generate a code coverage report for it. ExcludeFromCodeCoverage Attribute in Action The ExcludeFromCodeCoverage attribute works also on the class member level. The EditFormModel class shown above can be left out from code coverage by simply adding this attribute. This attribute tells tooling that a class or some of its members are not planned to be covered with the tests. The easiest way to exclude code from code coverage analysis is to use the ExcludeFromCodeCoverage attribute. Without any additional information, these classes will be part of code coverage calculations. One example is given below: public class EditFolderModel The usual candidates are primitive models and Data Transfer Objects (DTO). I think almost all applications have some classes we don't want to test. This blog post focuses on how to leave out all code that will not be covered with unit tests from code coverage and get numbers shown on code coverage reports correct. ![]() Recently I blogged about how to generate nice code coverage reports for ASP.NET Core and. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |