You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by cu...@locus.apache.org on 2000/12/01 23:19:26 UTC

cvs commit: xml-xalan/test/java/src/org/apache/qetest Reporter.java

curcuru     00/12/01 14:19:26

  Modified:    test/java/src/org/apache/qetest Reporter.java
  Log:
  Add duplicate check*() methods with optional 'String id' param
  Add extra getCurrent*() accessors
  
  Revision  Changes    Path
  1.3       +96 -14    xml-xalan/test/java/src/org/apache/qetest/Reporter.java
  
  Index: Reporter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/Reporter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Reporter.java	2000/11/09 22:14:28	1.2
  +++ Reporter.java	2000/12/01 22:19:24	1.3
  @@ -89,7 +89,7 @@
    * @todo explain better how results are rolled up and calculated
    * @author Shane_Curcuru@lotus.com
    * @author Jo_Grant@lotus.com
  - * @version $Id: Reporter.java,v 1.2 2000/11/09 22:14:28 curcuru Exp $
  + * @version $Id: Reporter.java,v 1.3 2000/12/01 22:19:24 curcuru Exp $
    */
   public class Reporter implements Logger
   {
  @@ -1114,8 +1114,56 @@
       //-----------------------------------------------------
       // There is no public void checkIncp(String comment) method
   
  +    /* EXPERIMENTAL: have duplicate set of check*() methods 
  +       that all output some form of ID as well as comment. 
  +       Leave the non-ID taking forms for both simplicity to the 
  +       end user who doesn't care about IDs as well as for 
  +       backwards compatibility.
  +    */
  +
       /**
        * Writes out a Pass record with comment.
  +     * @author Shane_Curcuru@lotus.com
  +     * @param comment comment to log with the pass record.
  +     */
  +    public void checkPass(String comment)
  +    {
  +        checkPass(comment, null);
  +    }
  +
  +    /**
  +     * Writes out an ambiguous record with comment.
  +     * @author Shane_Curcuru@lotus.com
  +     * @param comment to log with the ambg record.
  +     */
  +    public void checkAmbiguous(String comment)
  +    {
  +        checkAmbiguous(comment, null);
  +    }
  +
  +    /**
  +     * Writes out a Fail record with comment.
  +     * @author Shane_Curcuru@lotus.com
  +     * @param comment comment to log with the fail record.
  +     */
  +    public void checkFail(String comment)
  +    {
  +        checkFail(comment, null);
  +    }
  +    
  +
  +    /**
  +     * Writes out an Error record with comment.
  +     * @author Shane_Curcuru@lotus.com
  +     * @param comment comment to log with the error record.
  +     */
  +    public void checkErr(String comment)
  +    {
  +        checkErr(comment, null);
  +    }
  +
  +    /**
  +     * Writes out a Pass record with comment.
        * A Pass signifies that an individual test point has completed and has
        * been verified to have behaved correctly.
        * <p>If you need to do your own specific comparisons, you can
  @@ -1126,8 +1174,9 @@
        * that if a test never calls check*(), it will have an incomplete result.</p>
        * @author Shane_Curcuru@lotus.com
        * @param comment to log with the pass record.
  +     * @param ID token to log with the pass record.
        */
  -    public void checkPass(String comment)
  +    public void checkPass(String comment, String id)
       {
   
           // Increment our results counters 
  @@ -1138,7 +1187,7 @@
           {
               for (int i = 0; i < numLoggers; i++)
               {
  -                loggers[i].checkPass(comment);
  +                loggers[i].checkPass(comment, id);
               }
           }
   
  @@ -1157,8 +1206,9 @@
        * 'gold' result to compare it to.</p>
        * @author Shane_Curcuru@lotus.com
        * @param comment to log with the ambg record.
  +     * @param ID token to log with the pass record.
        */
  -    public void checkAmbiguous(String comment)
  +    public void checkAmbiguous(String comment, String id)
       {
   
           // Increment our results counters 
  @@ -1166,7 +1216,7 @@
   
           for (int i = 0; i < numLoggers; i++)
           {
  -            loggers[i].checkAmbiguous(comment);
  +            loggers[i].checkAmbiguous(comment, id);
           }
   
           caseResult = java.lang.Math.max(AMBG_RESULT, caseResult);
  @@ -1183,8 +1233,9 @@
        * been verified to have behaved <B>in</B>correctly.</p>
        * @author Shane_Curcuru@lotus.com
        * @param comment to log with the fail record.
  +     * @param ID token to log with the pass record.
        */
  -    public void checkFail(String comment)
  +    public void checkFail(String comment, String id)
       {
   
           // Increment our results counters 
  @@ -1192,7 +1243,7 @@
   
           for (int i = 0; i < numLoggers; i++)
           {
  -            loggers[i].checkFail(comment);
  +            loggers[i].checkFail(comment, id);
           }
   
           caseResult = java.lang.Math.max(FAIL_RESULT, caseResult);
  @@ -1209,8 +1260,9 @@
        * debug to see what really happened.</p>
        * @author Shane_Curcuru@lotus.com
        * @param comment to log with the error record.
  +     * @param ID token to log with the pass record.
        */
  -    public void checkErr(String comment)
  +    public void checkErr(String comment, String id)
       {
   
           // Increment our results counters 
  @@ -1218,7 +1270,7 @@
   
           for (int i = 0; i < numLoggers; i++)
           {
  -            loggers[i].checkErr(comment);
  +            loggers[i].checkErr(comment, id);
           }
   
           caseResult = java.lang.Math.max(ERRR_RESULT, caseResult);
  @@ -1381,6 +1433,15 @@
       }
   
       /**
  +     * Accessor for current test case's description, read-only.
  +     * @return current test case result.
  +     */
  +    public String getCurrentCaseComment()
  +    {
  +        return caseComment;
  +    }
  +
  +    /**
        * Accessor for overall test file result, read-only.
        * @return test file's overall result.
        */
  @@ -1392,8 +1453,8 @@
       /**
        * Utility method to log out overall result counters.  
        *
  -     * NEEDSDOC @param count
  -     * NEEDSDOC @param desc
  +     * @param count number of this kind of result
  +     * @param desc description of this kind of result
        */
       protected void logResultsCounter(int count, String desc)
       {
  @@ -1897,15 +1958,15 @@
        * @author Shane_Curcuru@lotus.com
        * @param CheckService implementation to use
        *
  -     * NEEDSDOC @param service
  +     * @param service a non-null CheckService implementation for 
  +     * this type of actual and expected object
        * @param actual Object returned from your test code.
        * @param expected Object that test should return to pass.
        * @param comment to log out with result.
  +     * @return status true if PASS_RESULT, false otherwise
        * @see #checkPass
        * @see #checkFail
        * @see #check
  -     *
  -     * NEEDSDOC ($objectName$) @return
        */
       public boolean check(CheckService service, Object actual,
                            Object expected, String comment)
  @@ -1919,6 +1980,27 @@
           }
   
           if (service.check(this, actual, expected, comment) == PASS_RESULT)
  +            return true;
  +        else
  +            return false;
  +    }
  +
  +    /**
  +     * Uses an external CheckService to Compares actual and expected,
  +     * and logs the result, pass/fail.
  +     */
  +    public boolean check(CheckService service, Object actual,
  +                         Object expected, String comment, String id)
  +    {
  +
  +        if (service == null)
  +        {
  +            checkErr("CheckService null for: " + comment);
  +
  +            return false;
  +        }
  +
  +        if (service.check(this, actual, expected, comment, id) == PASS_RESULT)
               return true;
           else
               return false;