diff options
author | Olivier Lamy <olamy@apache.org> | 2012-03-02 18:39:27 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-03-02 18:39:27 +0000 |
commit | 532d780da5ac558c97594b11e7e098398cc6798a (patch) | |
tree | df4cd33ed0828f7a22aa620ace9e3f8255e9ad3d /archiva-modules/archiva-web/archiva-webapp-test-js/src | |
parent | 4e87cdb7c5feb2635acbcb3b19e2f9768d8b5a1c (diff) | |
download | archiva-532d780da5ac558c97594b11e7e098398cc6798a.tar.gz archiva-532d780da5ac558c97594b11e7e098398cc6798a.zip |
print screenshot path in the stack trace failure
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1296377 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webapp-test-js/src')
2 files changed, 11 insertions, 5 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index 25325b7d5..69bb0791f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -62,6 +62,7 @@ public abstract class AbstractSeleniumTest /** * this method is called by the Rule before executing a test + * * @throws Exception */ public void open() @@ -649,7 +650,7 @@ public abstract class AbstractSeleniumTest Assert.assertEquals( getSelenium().getValue( locator ), expectedValue ); } - public void captureScreenShotOnFailure( Throwable failure, String methodName, String className ) + public String captureScreenShotOnFailure( Throwable failure, String methodName, String className ) { SimpleDateFormat sdf = new SimpleDateFormat( "yyyy.MM.dd-HH_mm_ss" ); String time = sdf.format( new Date() ); @@ -673,8 +674,10 @@ public abstract class AbstractSeleniumTest selenium.windowMaximize(); File fileName = new File( targetPath, fileBaseName + ".png" ); + selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" ); + return fileName.getAbsolutePath(); } }
\ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java index f7a7eb681..b113ccf4e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java @@ -31,7 +31,7 @@ import org.junit.runners.model.Statement; public class ArchivaSeleniumExecutionRule implements MethodRule //TestRule { - + // FIXME cerate a separate TestRule for open and close calls ? public Selenium selenium; public Statement apply( Statement base, FrameworkMethod method, Object target ) @@ -43,8 +43,11 @@ public class ArchivaSeleniumExecutionRule } catch ( Throwable e ) { - ( (AbstractSeleniumTest) target ).captureScreenShotOnFailure( e, method.getMethod().getName(), - target.getClass().getName() ); + String fileName = + ( (AbstractSeleniumTest) target ).captureScreenShotOnFailure( e, method.getMethod().getName(), + target.getClass().getName() ); + + throw new RuntimeException( e.getMessage() + " see screenShot file:" + fileName, e ); } finally { @@ -63,6 +66,6 @@ public class ArchivaSeleniumExecutionRule public Statement apply( Statement base, Description description ) { - return base; //To change body of implemented methods use File | Settings | File Templates. + return base; } } |