Showing posts with the label Unit Test

Unit tests and private functions: A real life dilemma

Always Test! There is no argument whatsoever that unit tests are essential to every software nowadays. Beyond their initial use they serve as regression tests during code changes. They are also used in build environments and CI/CD to ensure merges do not negatively affect your code. And sometimes they are considered as an alternative to QA on server side code. TL;DR "It depends"

This is where I currently live, server side code, and unit tests are an essential part of every feature in every sprint.  I will not go into the textbook "what are unit tests" Q and A. I assume dear reader that you know it by heart. However in case you don't know this Wikipedia entry should get you started.
Opinions on unit tests in OO languages In general unit tests are used to verify the correct behavior of a module, hence in C# only the public methods of a class should be tested.

Some consider testing protected or private methods unacceptable. And then there is this quote from a Sta…