1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.jameleon.reporting;
20
21 /***
22 * Keeps track of the test cases run and test case number in a given test run:
23 * <ul>
24 * <li>Tests Run</li>
25 * <li>Tests Failed</li>
26 * <li>Tests Passed</li>
27 * <li>Curent Test Script Number</li>
28 * </ul>
29 */
30 public class TestCaseCounter {
31 private int testCaseNum = 1;
32 private int numPassed;
33 private int numFailed;
34
35 /***
36 * Increment the number of tests passed.
37 * @param numPassed The number to increment by
38 */
39 public void incrementPassed(int numPassed) {
40 this.numPassed += numPassed;
41 }
42
43 /***
44 * Increment the number of tests failed.
45 * @param numFailed The number to increment by
46 */
47 public void incrementFailed(int numFailed) {
48 this.numFailed += numFailed;
49 }
50
51 /***
52 * Increment the test script number
53 * @param testCaseNum The number to increment by
54 */
55 public void incrementTestCaseNum(int testCaseNum) {
56 this.testCaseNum += testCaseNum;
57 }
58
59 /***
60 * Gest the total passed test cases
61 * @return the total passed test cases
62 */
63 public int getNumPassed() {
64 return numPassed;
65 }
66
67 /***
68 * Gets the total failed tests cases
69 * @return the total failed tests cases
70 */
71 public int getNumFailed() {
72 return numFailed;
73 }
74
75 /***
76 * Gets the current test script number
77 * @return the current test script number
78 */
79 public int getTestCaseNum() {
80 return testCaseNum;
81 }
82
83 public int getNumRun(){
84 return getNumFailed() + getNumPassed();
85 }
86 }