User forums > Using Code::Blocks
Doing unit tests (cppunit)
nofaber:
Hi all,
I have just discovered code::blocks and I find it very powerful. Nevertheless, I want to do unit test (under windows). So I wonder if a cppunit plugin is available ? Or if not, how can I do unit tests with code::blocks under windows
Thanks
nofaber
thomas:
There is no such plugin available at this time.
Neither have I ever done unit testing or intend to myself, so my knowledge is somewhat limited in that matter, too. However, I found a project at Sourceforge which may be helpful: http://sourceforge.net/projects/cppunit
If you get this to work (I haven't tried, but it looks promising), then you should not have too much difficulties to make a plugin for Code::Blocks from it.
killerbot:
I haven't used those thing either, but I am looking around to start using them, I already read some comparisons articles, and cpp unit seems not to be that good, there was more positive acceptance on : cpptest : http://cpptest.sourceforge.net/
Game_Ender:
--- Quote from: thomas on February 25, 2006, 03:02:09 pm ---Neither have I ever done unit testing or intend to myself, so my knowledge is somewhat limited in that matter, too. However, I found a project at Sourceforge which may be helpful: http://sourceforge.net/projects/cppunit
--- End quote ---
*Says silent prayer for future of CB stability*
Unit tests are really helpful. At first there is some overhead for writing the test but they help you in numerous ways. If you write a piece of code don't you want to know that it works? Wouldn't it be amazing if you felt complete freedom to completely rewrite the code from class and be able to tell in seconds in whether it performs just as it did? Once you have something written and tested you get a sense of freedom. Freedom from the fear that ever touching that piece of code again is going to break it into pieces. It also means you are no longer responsible for that code, the unit tests are. As long as whoever maintains the code in future keeps the code passing the unit tests everything is fine. They don't have to try and figure what a class does, because the unit tests define this.
Numerous plugins and parts of codeblocks would benefit from unit testing. Things the like the new code completetion should have a test suite written for it. Here is one of my favorite examples of agile development and unit testing. See the obligatory wikipedia article on unit testing and extreme programming explanation of unit tests. As for the XP link, I know we aren't developing like that but it does do a good explanation of the benefits of testing.
Besides, how can you argue against validating your code without looking lazy ;).
About frameworks, I currently use the xUnit testing framework (CPPUnit, JUnit, NUnit...). Here is a good comparison of the different unit testing frameworks, but it doesn't have cpptest. So I will have a look at that right now.
EDIT- From a popularity standpoint CppUnit is about 10 times as used as cpptest, and Cppunit is more active.
killerbot:
Check out C/C++ Users Journal : Edition December 2005
"Unit Testing & CxxTest"
So it's CxxTest and not cppTest, my mistake.
Comparison article :
http://www.gamesfromwithin.com/articles/0412/000061.html
Navigation
[0] Message Index
[#] Next page
Go to full version