<div dir="ltr">Hi all,<div>   starting from a PR in a conversation with Alex about our current approach to unit testing being painful, I've checked what alternatives would we have and how practical would they be.</div><div><br></div><div>An easy first option would be googletest/googlemock.</div><div><br></div><div>On a lazy afternoon, I've tried seeing how useful/painful it would be to try it, by porting one test over - it's quite trivial and doesn't require mocking, so I'll try a more complicated one next - to start a conversation about the topic.</div><div><br></div><div>You can find the test branch at <a href="https://github.com/kinkie/squid/tree/gtest">https://github.com/kinkie/squid/tree/gtest</a> .</div><div>I've only touched two files, a newly-created src/tests/testMemGtest and src/Makefile.am .</div><div><br></div><div>The output from the test run is at <a href="https://paste.ubuntu.com/p/3sgTDN7rNm/" rel="nofollow" style="font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:13px;white-space:pre-wrap;box-sizing:border-box;background-color:initial;color:rgb(3,102,214);outline-width:0px">https://paste.ubuntu.com/p/3sgTDN7rNm/</a></div><div><br></div><div>What do you think?</div><div><br></div><div>My initial thoughts:</div><div>- it is somewhat simpler and more powerful than cppunit</div><div>- setting the test environment up is easy but at this time it can only be done from source. Adding it to the build farm images is straightforward<br></div><div>- the license is BSD 3-clause new (<a href="https://github.com/google/googletest/blob/master/LICENSE">https://github.com/google/googletest/blob/master/LICENSE</a>) </div><div>- googlemock promises to be vastly superior to our current approach</div><div>- porting memTest took me about one hour, mostly caused by us including cppunit headers from squid.h (WUT? A PR is coming up to unentangle that)</div><div><br></div><div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">    Francesco</div></div></div>