jakarta-watchdog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rlu...@apache.org
Subject cvs commit: jakarta-watchdog-4.0/src/tools/org/apache/tomcat/task GTest.java
Date Thu, 24 Jan 2002 17:49:10 GMT
rlubke      02/01/24 09:49:10

  Modified:    src/tools/org/apache/tomcat/task GTest.java
  Log:
  - Fixed potential issue with result reporting if test actions were nested more
    than two levels deep.
  
  Revision  Changes    Path
  1.17      +17 -10    jakarta-watchdog-4.0/src/tools/org/apache/tomcat/task/GTest.java
  
  Index: GTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-watchdog-4.0/src/tools/org/apache/tomcat/task/GTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- GTest.java	23 Jan 2002 22:52:36 -0000	1.16
  +++ GTest.java	24 Jan 2002 17:49:10 -0000	1.17
  @@ -27,7 +27,7 @@
   
       private static int failureCount = 0;
       private static int passCount = 0;
  -    private static boolean result = false;
  +    private static boolean hasFailed = false;
   
       String prefix = "http";
       String host = "localhost";
  @@ -447,17 +447,21 @@
   
               dispatch( request, requestHeaders );
   
  -            result = checkResponse( magnitude );
  +            boolean result = checkResponse( magnitude );
  +
  +            if ( !result ) {
  +                hasFailed = true;
  +            }
   
               if ( !children.isEmpty() ) {
                   Iterator iter = children.iterator();
                   while (iter.hasNext()) {
                       Task task = (Task) iter.next();
  -                    task.execute();
  +                    task.perform();
                   }
               }
   
  -            if ( result && !nested ) {
  +            if ( !hasFailed && !nested ) {
   		        passCount++;
                   if ( resultOut != null ) {
                       resultOut.write( "<result>PASS</result>\n".getBytes() );
  @@ -467,7 +471,7 @@
                   } else {
                       System.out.println( " PASSED " + request );
                   }
  -            } else if ( !result && !nested ){
  +            } else if ( hasFailed && !nested ){
   		        failureCount++;
                   if ( resultOut != null ) {
                       resultOut.write( "<result>FAIL</result>\n".getBytes() );
  @@ -487,22 +491,25 @@
                       resultOut.close();
                   }
               }
  -	    if ( lastTask ) {
  +	        if ( lastTask ) {
                   System.out.println( "\n\n------- TEST SUMMARY -------\n" );
  -		System.out.println( "*** " + passCount + " TEST(S) PASSED! ***" );
  -		System.out.println( "*** " + failureCount + " TEST(S) FAILED! ***" );
  +		        System.out.println( "*** " + passCount + " TEST(S) PASSED! ***" );
  +		        System.out.println( "*** " + failureCount + " TEST(S) FAILED! ***" );
               }
   
           } catch ( Exception ex ) {
  -	    failureCount++;
  +	        failureCount++;
               if ( "No description".equals( description ) ) {
                   System.out.println( " FAIL " + request );
               } else
                   System.out.println( " FAIL " + description + " (" + request + ")" );
   
               ex.printStackTrace();
  +        } finally {
  +            if ( !nested ) {
  +                hasFailed = false;
  +            }
           }
  -
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:watchdog-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:watchdog-dev-help@jakarta.apache.org>


Mime
View raw message