Usually we have builds against the master branch. It is good but now and then builds fail and we have to fix the code. Better way would be to find errors before that. Pull request builds help with that. That way the build pipeline will be one of the "reviewer" in the pull request and doesn't pass the pull request if the build fails. In this blog post I will demontstrate how this can be done in Azure DevOps with Azure Repos.
Category: Programming
C# Code Coverage with Azure DevOps
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.
Summary of 2019 – What Did I Learn?
Even if it is already the end of January I still want to summary my past year. After one year at the latest, it is nice to read for yourself how 2019 went and compare it to 2020. Keywords about what I did and learned most in 2019 are Azure, Azure DevOps, and scrum master.
Mock Object Vocabulary
We often talk about mocks, even if should use more precise terms like stub, fake and mock. Correct term for these is test double. In this blog post I introduce these different test doubles with code examples.
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.
Write Good Code From the First Commit
Did you know that most of the smelly/bad code is written when code files are created, not gradually upon code updates? I didn't but I found research about it and wrote this blog post. Is it because we think "we will fix this later"?
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.
Comments Lie!
Ron Jeffries has said "code never lies, comments sometimes do". What makes comments sometimes lie? Usually the reason is that we don't keep them up to date. In this blog post I have written about few commenting anti-patterns and how to avoid lying comments.