View Javadoc

1   /*
2       Jameleon - An automation testing tool..
3       Copyright (C) 2007 Christian W. Hargraves (engrean@hotmail.com)
4   
5       This library is free software; you can redistribute it and/or
6       modify it under the terms of the GNU Lesser General Public
7       License as published by the Free Software Foundation; either
8       version 2.1 of the License, or (at your option) any later version.
9   
10      This library is distributed in the hope that it will be useful,
11      but WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13      Lesser General Public License for more details.
14  
15      You should have received a copy of the GNU Lesser General Public
16      License along with this library; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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  }