1 /***
2 * CoverageSegment
3 *
4 * A coverage segment, is one unit which
5 * is measured by a metric.
6 *
7 * For instance, in Statement Coverage,
8 * a coverage segment would be a basic block.
9 *
10 * For Branch Coverage, a coverage segment
11 * would be a branch, and for Path coverage
12 * a segment would be a path.
13 */
14
15 package junit.quilt.framework;
16
17 import java.util.List;
18
19 public interface CoverageSegment
20 {
21 /***
22 * getNumVisits
23 *
24 * This returns the number of times
25 * that this segment has been executed
26 * by the code.
27 *
28 * This value may be either 0 or 1 if
29 * the algorithm cannot collect the
30 * number of visits, but can only collect
31 * whether it has been visited or not.
32 */
33 public int getNumVisits();
34
35 /***
36 * toXML
37 *
38 * All Coverage Segments are required to
39 * output whatever data they have in XML
40 * format.
41 *
42 * The top element should be what type of
43 * segment this is.
44 *
45 * It should include custom information to
46 * allow a machine to recreate the segment.
47 *
48 * It needs to include these elements:
49 * NumVisits = Number of Visits
50 * Times = Collection of running times (if supported)
51 * Advice = Advice on meeting coverage (if supported)
52 * Description = Human readable description of this segment.
53 *<PRE>
54 * <Statement>
55 * <LineFrom>14</LineFrom>
56 * <LineTo>20</LineTo>
57 * <NumVisits>65</NumVisits>
58 * <Times>
59 * <Time>0.065</Time>
60 * <Time>0.085</Time>
61 * ...
62 * </Times>
63 * <Advice>Execute FooBar.runStuff(a) with a != 1</Advice>
64 * <Description>Lines 14 - 20 of FooBar.java</Description>
65 * </Statement>
66 *</PRE>
67 */
68 public String toXML();
69
70 /***
71 * getTimes()
72 *
73 * This method may return NULL if no timing is done.
74 *
75 * It may return an empty list if timing is done, but
76 * the segment has not been covered.
77 *
78 * The list returned will have java.lang.Float values.
79 */
80 public List getTimes();
81
82 /***
83 * getAdvice()
84 *
85 * This method returns a human readable string
86 * containing advice on how to cover this segment.
87 *
88 * If good advice is not available, then this should
89 * return the description.
90 *
91 * I hope it can be something like:
92 * Run method foo.bar(int a) with a < 0
93 *
94 */
95 public String getAdvice();
96
97 /***
98 * getDescription
99 *
100 * This method returns a description of the segment
101 * which is defined by this class.
102 *
103 * This should be similar to:
104 * Lines 14 - 20 of FooBar.java
105 */
106 public String getDescription();
107 }
This page was automatically generated by Maven