CxxTest is a type of unit testing framework used for c++. We have started to implement unit testing in our semester long project. Although it is wise to start unit testing before code writing, we kind of did it the other away around because not many students have used cxxTesting and we had to get the project started.
There are a lot of people who are unsure whether to write code first or write the test cases first. Like I mentioned above, the ideal method is to write your test cases first. I'm sure there are special cases where you should write your test cases after you are done coding but for the most part writing the test cases should come first. One reason for this is because it makes the coding process a lot easier. It is necessary for big projects to have test cases, otherwise your material are never really verified and people might find your program not trustworthy. Because of this you are going to have to write test cases no matter what. Each time you write code you should be constantly fixing it so that it does what its supposed to do. If you have your test cases built in already you can always run your code to check if it is outputting the correct results. This way you are constantly checking if your are going in the right direction, unlike if you just keep coding away and the errors start building up. Once you have a big program with a lot of errors, it'll take a lot of time to go back and figure out what went wrong.
CxxTesting is what we're using in our Csci 3081 class. Some people may think that unit testing is the same thing as debugging but it's a lot different. Debugging is more like checking if you are doing something legal in your code and unit testing is kind of like checking if that legal part of your code is doing what it's supposed to be doing and has the correct results in it. Just because your code is able to compile does not mean that it is doing it correctly. After debugging you must also use the test cases you created to check if your program is running the way it's supposed to. One way to do this with cxxTest is to check the return values of any function. When you write a function you should expect something out of that function and you can test whether the return value is something that you expected. CxxTest has assertion methods like "TS_ASSERT", "TS_ASSERT_EQUALS", etc.. The ts_assert basically lets you claim something. Ts_assert takes in one one expression and you can claim that the expression is supposed to be greater than 0, less than 0, equal to NULL, etc. Ts_assert_equals takes in two parameters and then compares those parameters. There are many other assertion methods that let you check whether your program is doing what it's supposed to be doing.
Just like subversion, I think unit testing is very important. If you have a good abundance of test cases you'll be able to follow your program easier and know that it's doing what it's supposed to be doing. In fact, the more the test cases probably the better; as long as your test cases are correct. There are also times when you might put in a faulty test case that tells your program its doing something wrong when it is actually doing something right so you have to be careful about that. Basically, test cases make life easier. I'm sure you can write a huge program that works perfectly without having any test cases, but that's insane and probably not very likely.

I do believe that doing proper test is quite useful. And cxxtest is really a good tool, it helps a lot.
Oh, my name is Yanjie Zhang
I agree that it is very important to write tests and check your code as you're writing it. I have run into many problems waiting until I finished and attempting to debug the whole thing.
Brett Bedeaux
Yeah testing is important first, but i believe you should be writing tests as you code is better. Because most of the time while you are coding standards are going to change which will cause your test cases to change. after that it will cause you to do more work to change the test cases.
Kengkue Vang
Test should be written before we start coding. That is what we learn in class. But it is almost impossible to me since I don't feel I have any progress by just writing some tests. Many of you do have the same feeling right?