Introduction
With unit testing you want to test the smallest unit possible, which means a single function. These units shall be tested without dependencies to other units. This makes it sometimes necessary to double these dependencies.
Framework setup
The used testing and mocking framework for this series is Google Test.
- Get and build the framework
~/Projects$ git clone https://github.com/google/googletest.git ~/Projects$ cd googletest && git tag -l ~/Projects/googletest$ git checkout <release> ~/Projects/googletest$ mkdir bin && cd bin ~/Projects/googletest/bin$ cmake .. && make
- Deploy the artifacts to ‘/usr/local’
~/Projects/googletest$ sudo cp -r googlemock/include/gmock /usr/local/include ~/Projects/googletest$ sudo cp -r googletest/include/gtest /usr/local/include ~/Projects/googletest$ sudo cp bin/googlemock/libgmock.a /usr/local/lib ~/Projects/googletest$ sudo cp bin/googlemock/libgmock_main.a /usr/local/lib ~/Projects/googletest$ sudo cp bin/googlemock/gtest/libgtest.a /usr/local/lib ~/Projects/googletest$ sudo cp bin/googlemock/gtest/libgtest_main.a /usr/local/lib