Blog 4: CXX Framework Testing

| 3 Comments | No TrackBacks

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.

No TrackBacks

TrackBack URL: http://blog.lib.umn.edu/cgi-bin/mt-tb.cgi/166706

3 Comments

I agree with your opinions on cxx Test. It's important to use cxx Test for unit testing before building up to integration testing. This will help to isolate the bugs within smaller sections of code before implementing that code in a larger system.

Michael Jantscher

I like your explanation of how assertions verify that the output of a function matches what is expected. You might want to expand on why unit tests are important.

-Kevin Mehlhaff

You make an interesting point that you can also test your code using print statements. But there is a drawback having all that testing code cluttering up your source files. Another benefit of unit testing is that you don't have to look at the output to see if the test passed. You just get a summary of how the tests ran. Pass or fail is much easier to parse.

Jason Reiss

Leave a comment

About this Entry

This page contains a single entry by lexxx320 published on November 7, 2011 9:03 PM.

Blog 3: Subversion was the previous entry in this blog.

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