I wrote this how-to blog post for myself to sort out how to get code coverage for C# in Azure DevOps' build pipelines. There are many blog posts about this but this one guides how to get reports even if there are many unit test projects in Visual Studio solution.
Tag: unit tests
Test Automation Pyramid
Unit tests are a powerful and crucial part of programming. But it isn't enough if we want to know better if our code works. Complementing unit tests with service-level/integration and UI/end-to-end tests will make us know that our code really works. The test automation pyramid tells what is the good ratio between different tests.
“Refactor Early, Refactor Often”
Refactoring is a key factor to get high code quality. Too often we end up in a situation when refactoring is already too difficult. By refactoring constantly we can avoid that trap and keep our code clean.
Create Objects With Test Data Builders (Unit Test Helper)
Anyone who has written unit tests have been fighting with object creations. Some times it is so difficult to create objects used in tests. Test data builders come to rescue! With them I write better tests with less time.
Better Unit Tests Without Setup Methods
Readability is key point in unit tests. One common antipattern with unit tests are setup methods, because they make unit tests more difficult to read. Here I have written how helper methods can be used instead of setup methods to make unit tests more readable.