When developing large programs it can often be difficult to tell whether or not your program is doing exactly what you want it to do. CXX is a testing framework, which can be used to write test cases for your code. We have used CXX both in lab and in our class project. It is a good way to test all possible cases of input. One way that we have used CXX testing is to make sure that our input reader is working as we would like it to. One way we went about doing this was we called the input reader function and asserted that the result was not null. This way we knew that the function was returning something. Most of our test cases use assertions. Assertions are a type of test where you make some logical comparison of the result of some function and assert whether or not the output is what you wanted. So far it seems as though we could do these same tests simply using print statements, however, the CXX tests are put into a separate file and do not clutter up our code. Also I have a feeling that further down the line we will go more in depth with framework testing and we will no longer be able to do the same things with print statements. Writing test cases is something that is very important in the field of computer science, and is not something that comes all that easily. When writing test cases we want to be as thorough as possible and test all possible ranges of input and assert that the output given is what we expected. Overall CXX seems to be a useful tool, and I would recommend it to other programmers.
Blog 4: CXX Framework Testing
TrackBack URL: http://blog.lib.umn.edu/cgi-bin/mt-tb.cgi/166706