So the test that I am going to do is to write some more code into my program and make it crash but still get 100% code coverage with Emma. An excellent idea created by Professor Philip Johnson is to have a static Array List of ten elements. Using that array list and “break” the array list by going over the limit (which is 10). So I done that went over the limit by 1000000. When I run the program it contains the bug, but Emma still gives my program 100% code coverage.
In my program, Emma stated that it have 100% coverage, but there is a bug in it that it does not know unless the program is run. The best solution is to know what inputs are going to use and what outputs that are going to be generated. Knowing those then you will have a program that satisfy what you want it to do and no bugs.
Like I said in my previous blog “Using Emma for code coverage,” using Emma is great; it saves time in debugging. What I learn from using a code coverage tool like Emma is that it does not show all the bugs in the code. For example input and output of results, Emma say the program have 100% coverage, but the program can crash if it is not correctly use. What I like to say is that code coverage tool is like a thin protection, but it does not expose all the flaws in a program.
Here is the .ZIP containing the source and build files: http://sites.google.com/site/phillipkhlau/files/stack-JUnit-Lab-klau4-6.0.1001.zip
No comments:
Post a Comment