Unit testing with C/C++: What do you teach people who either did not do unit testing before or come from Java/Junit?
What is the single most important lesson / thing to remember/ practice from your point of view that saves a lot of time or stress (especially regarding C/C++)?
The most scalable way to write unit tests in C is using a unit testing framework, such as: CppUTest. Unity. Google Test.
Tightly coupled code is extremely hard to unit test (and probably shouldn't be unit tested - it should be re-factored first), because by definition unit tests can only test a specific unit of something. All calls to databases or other components of the system should be avoided from Unit Tests because they violate this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With