You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by id...@apache.org on 2009/04/16 14:55:48 UTC

svn commit: r765617 - in /myfaces/tobago/trunk: ./ example/test/ example/test/src/main/webapp/ example/test/src/test/ example/test/src/test/java/ example/test/src/test/java/org/ example/test/src/test/java/org/apache/ example/test/src/test/java/org/apac...

Author: idus
Date: Thu Apr 16 12:55:47 2009
New Revision: 765617

URL: http://svn.apache.org/viewvc?rev=765617&view=rev
Log:
added a first Selenium test

Added:
    myfaces/tobago/trunk/example/test/src/test/
    myfaces/tobago/trunk/example/test/src/test/java/
    myfaces/tobago/trunk/example/test/src/test/java/org/
    myfaces/tobago/trunk/example/test/src/test/java/org/apache/
    myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/
    myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/
    myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/
    myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/
    myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java
Modified:
    myfaces/tobago/trunk/example/test/pom.xml
    myfaces/tobago/trunk/example/test/src/main/webapp/simple.xhtml
    myfaces/tobago/trunk/pom.xml

Modified: myfaces/tobago/trunk/example/test/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/pom.xml?rev=765617&r1=765616&r2=765617&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/pom.xml (original)
+++ myfaces/tobago/trunk/example/test/pom.xml Thu Apr 16 12:55:47 2009
@@ -15,7 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.myfaces.tobago</groupId>
@@ -56,13 +57,13 @@
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>tomcat-maven-plugin</artifactId>
-<!--
-        <configuration>
-          <server>asari</server>
-          <update>true</update>
-          <url>http://10.0.0.4:8080/manager</url>
-        </configuration>
--->
+        <!--
+                <configuration>
+                  <server>asari</server>
+                  <update>true</update>
+                  <url>http://10.0.0.4:8080/manager</url>
+                </configuration>
+        -->
         <configuration>
           <server>tomcat</server>
           <update>true</update>
@@ -90,6 +91,128 @@
           <fileNameReplacement>$1.jspx</fileNameReplacement>
         </configuration>
       </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <skip>false</skip>
+          <excludes>
+            <exclude>**/*SeleniumTest.java</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-tests</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <skip>false</skip>
+              <excludes>
+                <exclude>none</exclude>
+              </excludes>
+              <includes>
+                <include>**/*SeleniumTest.java</include>
+              </includes>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <!--
+            <plugin>
+              <groupId>org.codehaus.cargo</groupId>
+              <artifactId>cargo-maven2-plugin</artifactId>
+              <version>1.0-beta-2</version>
+              <configuration>
+                <wait>false</wait>
+                <container>
+                  <containerId>tomcat5x</containerId>
+                  <zipUrlInstaller>
+                    <url>http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.zip</url>
+                  </zipUrlInstaller>
+                </container>
+              </configuration>
+
+              <executions>
+                <execution>
+                  <id>start-container</id>
+                  <phase>pre-integration-test</phase>
+                  <goals>
+                    <goal>start</goal>
+                    <goal>deploy</goal>
+                  </goals>
+                </execution>
+
+                <execution>
+                  <id>stop-container</id>
+                  <phase>post-integration-test</phase>
+                  <goals>
+                    <goal>stop</goal>
+                  </goals>
+                </execution>
+              </executions>
+            </plugin>
+      -->
+      <plugin>
+        <groupId>org.mortbay.jetty</groupId>
+        <artifactId>maven-jetty-plugin</artifactId>
+        <configuration>
+          <connectors>
+            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+              <port>8080</port>
+            </connector>
+          </connectors>
+        </configuration>
+        <executions>
+          <execution>
+            <id>start-jetty</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <daemon>true</daemon>
+            </configuration>
+          </execution>
+          <execution>
+            <id>stop-jetty</id>
+            <phase>post-integration-test</phase>
+            <goals>
+              <goal>stop</goal>
+            </goals>
+          </execution>
+        </executions>
+
+      </plugin>
+
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>selenium-maven-plugin</artifactId>
+        <version>1.0-rc-1</version>
+        <executions>
+          <execution>
+            <id>start</id>
+            <phase>pre-integration-test</phase>
+            <goals>
+              <goal>start-server</goal>
+            </goals>
+            <configuration>
+              <background>true</background>
+              <logOutput>true</logOutput>
+              <!--multiWindow>true</multiWindow-->
+            </configuration>
+          </execution>
+
+          <execution>
+            <id>stop</id>
+            <phase>post-integration-test</phase>
+            <goals>
+              <goal>stop-server</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   <scm>
@@ -186,6 +309,12 @@
       <artifactId>jsf-facelets</artifactId>
       <version>${facelets.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.openqa.selenium.client-drivers</groupId>
+      <artifactId>selenium-java-client-driver</artifactId>
+      <version>0.9.2</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <profiles>
     <profile>
@@ -245,7 +374,7 @@
         <dependency>
           <groupId>org.apache.myfaces.core</groupId>
           <artifactId>myfaces-impl</artifactId>
-          <version>${myfaces12.version}</version>          
+          <version>${myfaces12.version}</version>
         </dependency>
       </dependencies>
     </profile>
@@ -356,4 +485,18 @@
       </build>
     </profile>
   </profiles>
+
+  <repositories>
+    <repository>
+      <id>openqa</id>
+      <name>OpenQA Repository</name>
+      <url>http://nexus.openqa.org/content/repositories/releases/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+      <releases>
+        <enabled>true</enabled>
+      </releases>
+    </repository>
+  </repositories>
 </project>
\ No newline at end of file

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/simple.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/simple.xhtml?rev=765617&r1=765616&r2=765617&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/simple.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/simple.xhtml Thu Apr 16 12:55:47 2009
@@ -7,9 +7,9 @@
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:f="http://java.sun.com/jsf/core">
-  <tc:page>
+  <tc:page id="page">
 
-    <tc:out value="Simple Test"/>
+    <tc:in readonly="true" id="in" value="Simple Test"/>
 
   </tc:page>
 </f:view>

Added: myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java?rev=765617&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java (added)
+++ myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SimpleSeleniumTest.java Thu Apr 16 12:55:47 2009
@@ -0,0 +1,49 @@
+package org.apache.myfaces.tobago.example.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import junit.framework.TestCase;
+
+public class SimpleSeleniumTest extends TestCase {
+
+  private DefaultSelenium selenium;
+
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    selenium = createSeleniumClient("http://localhost:8080/");
+    selenium.start();
+  }
+
+  @Override
+  public void tearDown() throws Exception {
+    selenium.stop();
+    super.tearDown();
+  }
+
+  protected DefaultSelenium createSeleniumClient(String url) throws Exception {
+    return new DefaultSelenium("localhost", 4444, "*firefox", url);
+  }
+
+  public void testHelloWorld() {
+      selenium.open("http://localhost:8080/tobago-example-test/faces/simple.xhtml");
+      assertEquals("Simple Test", selenium.getValue("page:in"));
+  }
+
+}

Modified: myfaces/tobago/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/pom.xml?rev=765617&r1=765616&r2=765617&view=diff
==============================================================================
--- myfaces/tobago/trunk/pom.xml (original)
+++ myfaces/tobago/trunk/pom.xml Thu Apr 16 12:55:47 2009
@@ -1220,7 +1220,7 @@
     <sunjsf.version>1.1_02</sunjsf.version>
     <sunjsf12.version>1.2_12</sunjsf12.version>
     <facelets.version>1.1.14</facelets.version>
-    <jetty.version>6.1.11</jetty.version>
+    <jetty.version>6.1.14</jetty.version>
     <common-io.version>1.1</common-io.version>
     <common-lang.version>2.1</common-lang.version>
     <commons-logging.version>1.1</commons-logging.version>