Wednesday, October 1, 2008

Reflections on Coverage and Testing

I will explore more into using testing tools; Emma 2.0.5312 and JUnit 4.5, both are quality assurance tools as well. The main tool I will be using is Emma, to see how well each classes, methods, blocks, and lines of code is covered and tested in a Stack program. Then from the results of Emma, I will then use JUnit to test any of errors I received from the Emma tool.

Initially I ran the same Stack implementation through other quality assurance tools; checkstyle, pmd, junit, and findbugs. From those tools I have repaired any errors I received. Now using the Emma tool, I see from the console screen that not all the methods, lines, and blocks were covered to a 100%. So I further went to the coverage.html file to see precisely what was not covered. A few methods from the original build were not tested, which caused the coverage to be about 78%. After writing some proper Junit test cases on untested methods, I got the coverage to 100%.

Using JUnit and Emma is a new experience for me; I’ve been use to writing generic print out statements as my test cases in the past. Seeing the results from Emma, I observe how easy it is to find out what methods were not tested and covered. I also noticed that, it is helpful running tests with JUnit. It was very helpful for me in examining the use of these two tools; for future use in projects, especially large scale projects.

Here is my copy of the Stack implementation with proper test cases.

No comments: