November 2011 Archives



It is undeniable that testing is one of the most important parts of constructing a program, and unit testing is quite important among all kinds of testing. In my opinion, unit testing is the most fundamental test after writing the code, it guarantees that you do not do anything waste of time. Only if each part of the program works well, it is possible they function well after merging them together. It can be a disaster to suddenly realize that basic functions do not give correct outputs and it may be impossible to fix them when all things come together. And I think it is worth putting many efforts into unit testing. It seems to be a waste of time, it actually saves lots of time.
CxxTest is a good tool to finish the task. It provides a platform to do unit testing and make sure everything gets proper outputs before the programmer goes to the next step. When I first come across CxxTest, I got really confused how to use it. After reading some instructions and the examples, I found it quite easy to use. The most important thing during testing is thinking about the test cases. They should cover all the possible cases and some of them should fail, because there are no perfect codes. If every test case successes, it makes no sense because it doesn't help the programmer at all to fix the bugs. I believe that if this is done before really stating writing codes, it helps the programmer to build their program.
For our project, because the output of each file can be very long, it is hard to examine whether it is correct or not. And the unit test gives me a way to know whether I have done everything right, especially when I add something new into the existing code. This is the time that has the highest possibility to introduce some new bugs into the program. So after I add something new into the code, I do the unit test again to make sure no new bugs are imported. This is quite useful.
To sum up, I believe that testing, not only unit testing is essential when building a program and it is worth putting some time and efforts on it.

About this Archive

This page is an archive of entries from November 2011 listed from newest to oldest.

October 2011 is the previous archive.

Find recent content on the main index or look in the archives to find all content.