continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r795295 - in /continuum/branches/continuum-selenium-parallel-carlos: pom.xml src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java src/test/testng/org/apache/continuum/web/test/listener/SeleniumListener.java
Date Sat, 18 Jul 2009 01:28:37 GMT
Author: carlos
Date: Sat Jul 18 01:28:36 2009
New Revision: 795295

URL: http://svn.apache.org/viewvc?rev=795295&view=rev
Log:
Use slf4j for logging

Modified:
    continuum/branches/continuum-selenium-parallel-carlos/pom.xml
    continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java
    continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/SeleniumListener.java

Modified: continuum/branches/continuum-selenium-parallel-carlos/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-selenium-parallel-carlos/pom.xml?rev=795295&r1=795294&r2=795295&view=diff
==============================================================================
--- continuum/branches/continuum-selenium-parallel-carlos/pom.xml (original)
+++ continuum/branches/continuum-selenium-parallel-carlos/pom.xml Sat Jul 18 01:28:36 2009
@@ -121,6 +121,15 @@
       <artifactId>commons-io</artifactId>
       <version>1.4</version>
     </dependency>  
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
+    </dependency>
     
     <!-- deployables -->
     <dependency>

Modified: continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java?rev=795295&r1=795294&r2=795295&view=diff
==============================================================================
--- continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java
(original)
+++ continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java
Sat Jul 18 01:28:36 2009
@@ -28,6 +28,8 @@
 import java.util.regex.Pattern;
 
 import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.testng.ITestResult;
 import org.testng.TestListenerAdapter;
 
@@ -36,6 +38,8 @@
 {
     private static final String FS = File.separator;
 
+    private final Logger logger = LoggerFactory.getLogger( this.getClass() );
+
     @Override
     public void onTestFailure( ITestResult tr )
     {
@@ -55,9 +59,8 @@
             /* ignore errors related to captureEntirePageScreenshot not implemented in some
browsers */
             if ( !e.getMessage().contains( "captureEntirePageScreenshot is only implemented
for Firefox" ) )
             {
-                System.out.println( "Error when taking screenshot for test " + tr.getName()
+ " ["
-                    + getSession().getBrowser() + "]" );
-                e.printStackTrace();
+                logger.error( "Error when taking screenshot for test " + tr.getName() + "
["
+                    + getSession().getBrowser() + "]", e );
             }
         }
         try
@@ -66,9 +69,7 @@
         }
         catch ( IOException e )
         {
-            System.out.println( "Error capturing HTML for test " + tr.getName() + " [" +
getSession().getBrowser()
-                + "]" );
-            e.printStackTrace();
+            logger.error( "Error capturing HTML for test " + tr.getName() + " [" + getSession().getBrowser()
+ "]", e );
         }
     }
 

Modified: continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/SeleniumListener.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/SeleniumListener.java?rev=795295&r1=795294&r2=795295&view=diff
==============================================================================
--- continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/SeleniumListener.java
(original)
+++ continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/SeleniumListener.java
Sat Jul 18 01:28:36 2009
@@ -26,6 +26,8 @@
 import java.util.Collections;
 
 import org.apache.continuum.web.test.parent.SeleniumSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.ITestContext;
 import org.testng.ITestResult;
@@ -44,6 +46,8 @@
     private static final Collection<SeleniumSession> SELENIUM_SESSIONS =
         Collections.synchronizedCollection( new ArrayList<SeleniumSession>() );
 
+    private final Logger logger = LoggerFactory.getLogger( this.getClass() );
+
     @Override
     public void onTestStart( ITestResult result )
     {
@@ -58,11 +62,11 @@
             Assert.assertNotNull( seleniumHost, "seleniumHost parameter is not defined" );
             Assert.assertNotNull( seleniumPort, "seleniumPort parameter is not defined" );
             Assert.assertNotNull( baseUrl, "baseUrl parameter is not defined" );
-            System.out.println( "Starting Selenium session: " + "[" + seleniumHost + ", "
+ seleniumPort + ", "
-                + baseUrl + ", " + browser + "]" );
+            logger.info( "Starting Selenium session: [" + seleniumHost + ", " + seleniumPort
+ ", " + baseUrl + ", "
+                + browser + "]" );
             getSession().start( seleniumHost, Integer.parseInt( seleniumPort ), browser,
baseUrl );
             SELENIUM_SESSIONS.add( getSession() );
-            System.out.println( "Started Selenium session: " + getSession().configurationString()
);
+            logger.info( "Started Selenium session: {}", getSession().configurationString()
);
         }
         super.onTestStart( result );
     }
@@ -78,12 +82,12 @@
                 if ( session.isStarted() )
                 {
                     session.stop();
+                    SELENIUM_SESSIONS.remove( session );
                 }
             }
             catch ( RuntimeException e )
             {
-                System.err.println( "Error stoping selenium server: " + session.configurationString()
);
-                e.printStackTrace();
+                logger.error( "Error stoping selenium server: " + session.configurationString(),
e );
             }
         }
         super.onFinish( testContext );
@@ -106,7 +110,7 @@
         {
             getSession().stop();
         }
-        System.out.println( "Test " + tr.getName() + " " + getSession().configurationString()
+ " -> Failed" );
+        logger.error( "Test {} -> Failed", tr.getName(), getSession().configurationString()
);
         super.onTestFailure( tr );
     }
 



Mime
View raw message