Google Test and Google Mock -frameworks

Main development forum.

Google Test and Google Mock -frameworks

Postby kimmov » Tue Jan 13, 2009 2:13 pm

Seems Google has recently published their C++ unit testing tools:

Yes, we have CppUnit in our source tree. And even few tests using it. But I've been disappointed that almost nobody other than me have added any tests. I kind of understand it though, CppUnit is very hard to use and creating tests is a lot of work. And requires quite an amount of learning. So no wonder busy people don't want to use time to learn it.

Google's tools look a lot more promising. They don't seem to be so hard to use. I got Google Test compiled with VS2005 within couple of minutes. Whereareas even compiling CppUnit might be a challenge...

Google Mock is a huge bonus. Mocking is concept we really need for testing WinMerge code. Its practically the only way to code in compare engine level. Read Google Mock wiki to get more info and examples about mocking.

So I think it is time to switch our test framework.

As a first step I'll remove CppUnit code from our source tree from External/ -folder. Its a lot of code we have been keeping in tree for almost no use. Then I'll create some tests with Google Test and submit them as patches to apply to Testing-folder.
kimmov
 
Posts: 562
Joined: Thu Sep 11, 2008 8:51 pm
Location: Finland

Re: Google Test and Google Mock -frameworks

Postby kimmov » Tue Jan 13, 2009 7:49 pm

I went and did my first Google Test testing for WinMerge. I submitted the testing project as patch item:
#2505287 First GoogleTest tests

GoogleTest seems to be a pretty easy to get started. And writing tests is easy and fast too.
kimmov
 
Posts: 562
Joined: Thu Sep 11, 2008 8:51 pm
Location: Finland

Re: Google Test and Google Mock -frameworks

Postby kimmov » Mon Jan 19, 2009 9:17 pm

And those first simple tests are now in SVN trunk. I also wrote a quick instructions to Readme.txt.
kimmov
 
Posts: 562
Joined: Thu Sep 11, 2008 8:51 pm
Location: Finland

Re: Google Test and Google Mock -frameworks

Postby kimmov » Thu Jul 02, 2009 9:32 am

I've added solution/project file to run all unit test projects. Earlier every unit test project needed to be compiled and run separately.

I still like to have unit tests divided into projects by component/class tested. It makes it easier to run just tests for that particular component/class instead of whole suite.
kimmov
 
Posts: 562
Joined: Thu Sep 11, 2008 8:51 pm
Location: Finland

Re: Google Test and Google Mock -frameworks

Postby gerundt » Thu Jul 02, 2009 1:15 pm

Btw: What is with the old testing sources like "selftests"? Use this still somebody? Maybe we can drop it to save some kilobytes in the source packages? ;)
gerundt
Site Admin
 
Posts: 193
Joined: Wed Sep 24, 2008 8:47 am
Location: Germany

Re: Google Test and Google Mock -frameworks

Postby kimmov » Sun Jul 05, 2009 2:32 pm

I don't know if anybody really never used those selftests. They were a pretty nice idea from Perry but using command line just limits things too much. So we probably could remove them without loosing anything.
kimmov
 
Posts: 562
Joined: Thu Sep 11, 2008 8:51 pm
Location: Finland


Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests