You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2012/02/22 15:17:41 UTC

svn commit: r1292301 - /myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java

Author: lofwyr
Date: Wed Feb 22 14:17:41 2012
New Revision: 1292301

URL: http://svn.apache.org/viewvc?rev=1292301&view=rev
Log:
using the static versions

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java?rev=1292301&r1=1292300&r2=1292301&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TestTheAutomaticSeleniumTest.java Wed Feb 22 14:17:41 2012
@@ -17,7 +17,10 @@ package org.apache.myfaces.tobago.exampl
  * limitations under the License.
  */
 
+import com.thoughtworks.selenium.SeleniumException;
+import org.junit.AfterClass;
 import org.junit.Assert;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,6 +34,16 @@ public class TestTheAutomaticSeleniumTes
 
   private static final Logger LOG = LoggerFactory.getLogger(TestTheAutomaticSeleniumTest.class);
 
+  @BeforeClass
+  public static void setUp() throws Exception {
+    AutomaticSeleniumTest.setUp();
+  }
+
+  @AfterClass
+  public static void tearDown() throws Exception {
+    AutomaticSeleniumTest.tearDown();
+  }
+
   @Test
   public void areTheCorrectFilesTested() {
 
@@ -63,12 +76,14 @@ public class TestTheAutomaticSeleniumTes
       String url = AutomaticSeleniumTest.createUrl("/meta-test/meta-404-not-existing.xhtml");
       LOG.info("Testing page: '" + url + "'");
       AutomaticSeleniumTest test = new AutomaticSeleniumTest(url, url);
-      test.setUp();
+
       test.testPageConsistency();
-      test.tearDown();
+
       Assert.fail("The test should fail, but wasn't.");
-    } catch (AssertionError e) {
+    } catch (AssertionError e) { // from IDE
       Assert.assertTrue(e.getMessage().contains("404 - page not found"));
+    } catch (SeleniumException e) { // from mvn -Pintegration-test
+      Assert.assertTrue(e.getMessage().contains("Response_Code = 404"));
     }
   }
 
@@ -78,9 +93,9 @@ public class TestTheAutomaticSeleniumTes
       String url = AutomaticSeleniumTest.createUrl("/meta-test/meta-1-fail.xhtml");
       LOG.info("Testing page: '" + url + "'");
       AutomaticSeleniumTest test = new AutomaticSeleniumTest(url, url);
-      test.setUp();
+
       test.testPageConsistency();
-      test.tearDown();
+
       Assert.fail("The test should fail, but wasn't.");
     } catch (AssertionError e) {
       if (e.getMessage().contains(AutomaticSeleniumTest.HAS_ERROR_SEVERITY)) {
@@ -97,9 +112,9 @@ public class TestTheAutomaticSeleniumTes
       String url = AutomaticSeleniumTest.createUrl("/meta-test/meta-4-not-tobago.xhtml");
       LOG.info("Testing page: '" + url + "'");
       AutomaticSeleniumTest test = new AutomaticSeleniumTest(url, url);
-      test.setUp();
+
       test.testPageConsistency();
-      test.tearDown();
+
       Assert.fail("The test should fail, but wasn't.");
     } catch (AssertionError e) {
       if (e.getMessage().contains(AutomaticSeleniumTest.IS_BROKEN)) {