














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!















junit and jcoverage
Implementation of the SimpleStack class import java.util.Vector; class SimpleStack { private Vector s = null; public SimpleStack (int initSize) { s = new Vector(initSize); } public void push (Object o) { s.addElement(o); } public Object pop () { Object top = null; if (s != null && s.size() != 0) { top = s.elementAt(s.size()-1); s.removeElementAt(s.size()-1); } return top; } public Object top () { Object o = null; if (s != null && s.size() != 0) o = s.elementAt(s.size()-1); return o; } }
Testing the SimpleStack class using a junit StackTest class _import junit.framework.; import java.util.Vector; public class StackTest extends TestCase { private SimpleStack s; public static void main (String args[]) { junit.textui.TestRunner.run (suite()); } public static Test suite() { return new TestSuite(StackTest.class); } protected void setUp() { s = new SimpleStack(100); } public void testPushOne() { s = new SimpleStack(100); String hiString = new String("Hi"); s.push(hiString); assertTrue(s.top() == hiString); System.out.println(hiString); } public void testPopEmpty () { s = new SimpleStack(0); Object o = s.pop(); assertTrue(o == null); } public void testTopEmpty () { s = new SimpleStack(0); assertTrue(s.top() == null); } }_*
Run the StackTest class test cases in GUI mode
Coverage Tools
jcoverage byte code instrumentation
jcoverage byte code instrumentation
jcoverage HTML Report Generation
jcoverage HTML Report Generation
HTML Coverage Report Source Code Annotations
Example invoking the jcoverage HTML Report Generation program
java com.jcoverage.coverage.reporting.Main -i “%SERFILE%” -o “%OUTFILE” – s “%SRCFILES%”
jcoverage Merge Instrumentation program
jcoverage Merge Instrumentation program