You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ca...@apache.org on 2009/07/18 05:15:02 UTC
svn commit: r795303 -
/continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java
Author: carlos
Date: Sat Jul 18 03:15:01 2009
New Revision: 795303
URL: http://svn.apache.org/viewvc?rev=795303&view=rev
Log:
Prevent errors when session was not started
Modified:
continuum/branches/continuum-selenium-parallel-carlos/src/test/testng/org/apache/continuum/web/test/listener/CaptureScreenShotsListener.java
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=795303&r1=795302&r2=795303&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 03:15:01 2009
@@ -49,6 +49,13 @@
private void captureError( ITestResult tr )
{
+ if ( !getSession().isStarted() )
+ {
+ /* the test failed before the session was started */
+ logger.warn( "Unable to take screenshot, selenium session is not started" );
+ return;
+ }
+
String baseFileName = getBaseFileName( tr );
try
{
@@ -102,16 +109,8 @@
*/
private void captureScreenshot( String baseFileName )
{
- if ( getSession().isStarted() )
- {
- getSession().getSelenium().windowMaximize();
- getSession().getSelenium().captureEntirePageScreenshot( baseFileName + ".png", "" );
- }
- else
- {
- /* the test failed before the session was started */
- logger.warn( "Unable to take screenshot, seelenium session is not started" );
- }
+ getSession().getSelenium().windowMaximize();
+ getSession().getSelenium().captureEntirePageScreenshot( baseFileName + ".png", "" );
}
private void captureHtmlSource( String baseFileName )