I have started a personal project to rebuild some software libraries that to take advantage the knowledge I have gained over the years and one of the things I wanted to do this time around was incorporate a unit testing framework. I selected the Google Unit test framework, gtest, because of these primary factors:
- Can compile on multiple platforms
- Been around a while
- Good user community.
So I started building my unit test project following the simple examples and everything does go pretty smoothly at first. For the simple classes in the library I could easily create the test cases and to fully exercise all the calls for this class. However, as I continued to add more class I quickly realized the first drawback to my approach. The main file, the one that contains all the testing macros, gets large and unreadable very quickly with only a few classes added of the 100 or so I have planned. So clearly this will take some investigation on how to organize better. I will write about how I will solve this in future posts.
The gmock library addition to gtest was a nice find to help in working with abstract classes and template designs.