DEV Community

Andrew Tassone
Andrew Tassone

Posted on

Adding Google Test - The Great Site Generator

This week I focused on adding a tester to my project. I chose to use Google Test as I have read it is a very popular tester for C++. Google Test cam be used easily with CMake which was also being used in this project.
I setup the tester by changing the CMakeLists.txt which can download the Google Test folder to the root directory by only using FetchContent_Declare.

While writing the test cases, I learned that it was more difficult than I had expected. I made sure my tests checked that the HTML output files were correct by reading the file and comparing it to the correct lines. I got stuck trying to get CMake to compile correctly. I eventually figured out that I did not have the correct executable files listed.

I have used a tester before, when contributing to other projects on GitHub. They are a great way for developers to check their own code and for others to contribute without breaking any parts of the project. I will continue to try to incorporate testers like Google Test in my projects.

Top comments (0)