From: Martin Stockhammer Date: Fri, 30 Mar 2018 15:32:16 +0000 (+0200) Subject: Adding Null checks for selenium X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=32acbe20f3be17af2e3ec02dee40345ecd5c61e9;p=archiva.git Adding Null checks for selenium --- diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index 082c4b373..48a1361c0 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -88,16 +88,20 @@ public abstract class AbstractSeleniumTest baseUrl = WebdriverUtility.getBaseUrl()+"/index.html?request_lang=en"; open( baseUrl, browser, seleniumHost, seleniumPort, maxWaitTimeInMs, remoteSelenium ); + Assert.assertNotNull( getWebDriver() ); getWebDriver().manage().window().maximize(); assertAdminCreated(); } /** - * this method is called by the Rule after executing a tests + * this method is called by the Rule after executing a test */ public void close() { - getWebDriver().close(); + if (getWebDriver()!=null) + { + getWebDriver( ).close( ); + } } /** diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java index f8c107f51..b44b918ba 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/java/org/apache/archiva/web/test/tools/ArchivaSeleniumExecutionRule.java @@ -52,7 +52,7 @@ public class ArchivaSeleniumExecutionRule String fileName = ( (AbstractSeleniumTest) target ).captureScreenShotOnFailure( e, method.getMethod().getName(), target.getClass().getName() ); - + log.info("Screenshot: "+fileName); throw new RuntimeException( e.getMessage() + " see screenShot file:" + fileName, e ); } finally