[seam-commits] Seam SVN: r11384 - in branches/enterprise/JBPAPP_5_0/src/test/ftest: examples/remoting and 10 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Aug 14 11:43:25 EDT 2009


Author: mgencur at redhat.com
Date: 2009-08-14 11:43:25 -0400 (Fri, 14 Aug 2009)
New Revision: 11384

Added:
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/build.xml
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/jboss5.xml
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java
Modified:
   branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
Log:
JBPAPP-2497 Added a functional test for helloworld example

Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml	2009-08-14 15:37:55 UTC (rev 11383)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml	2009-08-14 15:43:25 UTC (rev 11384)
@@ -42,71 +42,149 @@
 		</fileset>
 	</path>
 
-	<target name="testall.1" description="Run functional testsuite for JBoss 5">
-		<property name="container" value="jboss5" />
+	<!-- TODO : should the libs be in seam/lib and managed with mvn? -->
+	<taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="../../../lib/groovy-all.jar"/>
+
+	<target name="testall" description="Run functional testsuite based on container property">
+		<fail unless="container">Please set container property.</fail>
+		<antcall target="testall.${container}" />
+	</target>
+
+	<target name="testall.jboss4" description="Run functional testsuite for JBoss 4">
+		<property name="container" value="jboss4" />
+		<antcall target="start.container" />
 		<antcall target="start.selenium.server" />
+		<!-- Execute tests for all examples jboss-->
 		<testexample name="blog" />
 		<testexample name="booking" />
 		<testexample name="drools" />
 		<testexample name="dvdstore" />
 		<testexample name="contactlist" />
+		<testexample name="excel" />
+		<testexample name="groovybooking" />
+		<testexample name="hibernate" />
+		<testexample name="icefaces" />
+		<testexample name="itext" />
+		<testexample name="jpa" />
+		<testexample name="mail" />
+		<testexample name="messages" />
+		<testexample name="nestedbooking" />
+		<testexample name="numberguess" />
+		<testexample name="openid" />
+		<testexample name="quartz" />
+		<testexample name="registration" />
+		<testexample name="remoting/chatroom" />
+		<testexample name="rss" />
+		<testexample name="seambay" />
+		<testexample name="seamdiscs" />
+		<testexample name="seampay" />
+		<testexample name="seamspace" />
+		<testexample name="spring" />
+		<testexample name="todo" />
+		<testexample name="ui" />
+		<testexample name="wicket" />
+		<testexample name="wicket-runtime" />
 		<antcall target="stop.selenium.server" />
+		<antcall target="stop.container" />
 	</target>
 	
-	<target name="testall.2" description="Run functional testsuite for JBoss 5">
+	<target name="testall.jboss5" description="Run functional testsuite for JBoss 5">
 		<property name="container" value="jboss5" />
+		<antcall target="start.container" />
 		<antcall target="start.selenium.server" />
+		<!-- Execute tests for all examples jboss-->
+		<testexample name="blog" />
+		<testexample name="booking" />
+		<testexample name="drools" />
+		<testexample name="dvdstore" />
+		<testexample name="contactlist" />
 		<testexample name="excel" />
+		<testexample name="guice" />
 		<testexample name="groovybooking" />
 		<testexample name="hibernate" />
+		<testexample name="icefaces" />
 		<testexample name="itext" />
 		<testexample name="jee5/booking" />
-		<antcall target="stop.selenium.server" />
-	</target>
-	
-	<target name="testall.3" description="Run functional testsuite for JBoss 5">
-		<property name="container" value="jboss5" />
-		<antcall target="start.selenium.server" />
 		<testexample name="jpa" />
 		<testexample name="mail" />
 		<testexample name="messages" />
+		<testexample name="metawidget/booking" />
+		<testexample name="metawidget/dvdstore" />
+		<testexample name="metawidget/groovybooking" />
 		<testexample name="nestedbooking" />
 		<testexample name="numberguess" />
-		<antcall target="stop.selenium.server" />
-	</target>
-	
-	<target name="testall.4" description="Run functional testsuite for JBoss 5">
-		<property name="container" value="jboss5" />
-		<antcall target="start.selenium.server" />
 		<testexample name="openid" />
 		<testexample name="quartz" />
 		<testexample name="registration" />
 		<testexample name="remoting/chatroom" />
+		<testexample name="remoting/helloworld" />
+		<testexample name="rss" />
 		<testexample name="seambay" />
-		<antcall target="stop.selenium.server" />
-	</target>
-	
-	<target name="testall.5" description="Run functional testsuite for JBoss 5">
-		<property name="container" value="jboss5" />
-		<antcall target="start.selenium.server" />
 		<testexample name="seampay" />
 		<testexample name="seamspace" />
 		<testexample name="spring" />
 		<testexample name="todo" />
 		<testexample name="ui" />
+		<testexample name="wicket" />
+		<testexample name="wicket-runtime" />
 		<antcall target="stop.selenium.server" />
+		<antcall target="stop.container" />
 	</target>
 
+	<target name="testall.jboss-embedded" description="Run functional testsuite for JBoss Embedded">
+		<property name="container" value="jboss-embedded" />
+		<antcall target="start.selenium.server" />
+		<!-- Execute tests for all examples on jboss-embedded -->
+		<testexample name="blog" />
+		<testexample name="dvdstore" />
+		<testexample name="messages" />
+		<testexample name="numberguess" />
+		<testexample name="registration" />
+		<testexample name="seambay" />
+		<testexample name="seampay" />
+		<testexample name="todo" />
+		<testexample name="booking" />
+		<testexample name="jpa" />
+		<testexample name="hibernate" />
+		<antcall target="stop.selenium.server" />
+	</target>
+
+	<target name="testall.tomcat6" description="Run functional testsuite for Tomcat 6">
+
+		<property name="container" value="tomcat6" />
+		<antcall target="start.selenium.server" />
+
+		<testexample name="jpa" />
+		<testexample name="hibernate" />
+
+		<antcall target="stop.selenium.server" />
+	</target>
+
 	<target name="test" description="Run tests for single example. Container selection is based on the value of container property">
 		<fail unless="container">Please set container property.</fail>
 		<antcall target="test.${container}" />
 	</target>
-	
+
+	<target name="test.jboss4" description="Run tests for single example on JBoss 4">
+		<property name="container" value="jboss4" />
+		<antcall target="test.single.example" />
+	</target>
+
 	<target name="test.jboss5" description="Run tests for single example on JBoss 5">
 		<property name="container" value="jboss5" />
 		<antcall target="test.single.example" />
 	</target>
 
+	<target name="test.tomcat6" description="Run tests for single example on Tomcat 6">
+		<property name="container" value="tomcat6" />
+		<antcall target="test.single.example" />
+	</target>
+
+	<target name="test.jboss-embedded" description="Run tests for single example on JBoss Embedded">
+		<property name="container" value="jboss-embedded" />
+		<antcall target="test.single.example" />
+	</target>
+
 	<target name="test.single.example">
 		<antcall target="start.selenium.server" />
 
@@ -123,19 +201,26 @@
 		<cleanexample name="dvdstore" />
 		<cleanexample name="contactlist" />
 		<cleanexample name="excel" />
+		<cleanexample name="guice" />
 		<cleanexample name="groovybooking" />
 		<cleanexample name="hibernate" />
+		<cleanexample name="icefaces" />
 		<cleanexample name="itext" />
 		<cleanexample name="jee5/booking" />
 		<cleanexample name="jpa" />
 		<cleanexample name="mail" />
 		<cleanexample name="messages" />
+		<cleanexample name="metawidget/booking" />
+		<cleanexample name="metawidget/dvdstore" />
+		<cleanexample name="metawidget/groovybooking" />
 		<cleanexample name="nestedbooking" />
 		<cleanexample name="numberguess" />
 		<cleanexample name="openid" />
 		<cleanexample name="quartz" />
 		<cleanexample name="registration" />
 		<cleanexample name="remoting/chatroom" />
+		<cleanexample name="remoting/helloworld" />
+		<cleanexample name="rss" />
 		<cleanexample name="seambay" />
 		<cleanexample name="seamdiscs" />
 		<cleanexample name="seampay" />
@@ -143,6 +228,8 @@
 		<cleanexample name="spring" />
 		<cleanexample name="todo" />
 		<cleanexample name="ui" />
+		<cleanexample name="wicket" />
+		<cleanexample name="wicket-runtime" />
 	</target>
 
 	<target name="undeployall">
@@ -154,18 +241,25 @@
 		<undeployexample name="contactlist" />
 		<undeployexample name="excel" />
 		<undeployexample name="groovybooking" />
+		<undeployexample name="guice" />
 		<undeployexample name="hibernate" />
+		<undeployexample name="icefaces" />
 		<undeployexample name="itext" />
 		<undeployexample name="jee5/booking" />
 		<undeployexample name="jpa" />
 		<undeployexample name="mail" />
 		<undeployexample name="messages" />
+		<undeployexample name="metawidget/booking" />
+		<undeployexample name="metawidget/dvdstore" />
+		<undeployexample name="metawidget/groovybooking" />
 		<undeployexample name="nestedbooking" />
 		<undeployexample name="numberguess" />
 		<undeployexample name="openid" />
 		<undeployexample name="quartz" />
 		<undeployexample name="registration" />
+		<undeployexample name="rss" />
 		<undeployexample name="remoting/chatroom" />
+		<undeployexample name="remoting/helloworld" />
 		<undeployexample name="seambay" />
 		<undeployexample name="seamdiscs" />
 		<undeployexample name="seampay" />
@@ -173,6 +267,7 @@
 		<undeployexample name="spring" />
 		<undeployexample name="todo" />
 		<undeployexample name="ui" />
+		<undeployexample name="wicket" />
 	</target>
 
 
@@ -204,6 +299,17 @@
 		<attribute name="path" default="examples/@{name}" />
 		<attribute name="message" default="Running functional tests on @{name} example" />
 		<sequential>
+			<groovy>
+				<![CDATA[
+				def testExamplesRunSoFar = properties['testExamplesRunSoFar'] == null ? 0 : Integer.valueOf(properties['testExamplesRunSoFar']);
+				def jbossDeploymentsRestart = properties['jboss.deployments.restart'] == null ? 0 : Integer.valueOf(properties['jboss.deployments.restart']);
+				if (jbossDeploymentsRestart > 0 && testExamplesRunSoFar > 0 && testExamplesRunSoFar % jbossDeploymentsRestart  == 0 ) {
+				ant.antcall(target:"restart.container");
+				}
+				testExamplesRunSoFar++;
+				properties['testExamplesRunSoFar'] = testExamplesRunSoFar;
+				]]>
+			</groovy>
 			<echo>@{message}</echo>
 			<callExample path="@{path}" target="test" />
 		</sequential>
@@ -237,8 +343,22 @@
 			</ant>
 		</sequential>
 	</macrodef>
+
+	<target name="restart.container" if="run.container.per.suite">
+		<echo>Restarting container</echo>
+		<antcall target="stop.container" >
+		</antcall>
+		<antcall target="start.container" >
+		</antcall>
+	</target>
 	
-	<target name="start.container.before.suite" if="run.container.per.suite">
+	<target name="stop.container" if="run.container.per.suite">
+		<echo>Stopping container</echo>
+		<ant antfile="examples/build.xml" target="stop.container.jboss" inheritall="false">
+			<property name="container" value="${container}" />
+		</ant>	
+	</target>
+	<target name="start.container" if="run.container.per.suite">
 		<echo>Starting container</echo>
 		<ant antfile="examples/build.xml" target="start.container.jboss" inheritall="false">
 			<property name="container" value="${container}" />

Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/build.xml	                        (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/build.xml	2009-08-14 15:43:25 UTC (rev 11384)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="remoting.helloworld.ftest.build" basedir="." default="build">
+	<property name="example.name" value="remoting/helloworld" />
+	<property name="context.path" value="/seam-helloworld" />
+	
+	<import file="../../build.xml" />
+</project>

Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/jboss5.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/jboss5.xml	                        (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/jboss5.xml	2009-08-14 15:43:25 UTC (rev 11384)
@@ -0,0 +1,27 @@
+
+	<!--
+		JBoss, Home of Professional Open Source Copyright 2008, Red Hat
+		Middleware LLC, and individual contributors by the @authors tag. See
+		the copyright.txt in the distribution for a full listing of individual
+		contributors. This is free software; you can redistribute it and/or
+		modify it under the terms of the GNU Lesser General Public License as
+		published by the Free Software Foundation; either version 2.1 of the
+		License, or (at your option) any later version. This software is
+		distributed in the hope that it will be useful, but WITHOUT ANY
+		WARRANTY; without even the implied warranty of MERCHANTABILITY or
+		FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+		License for more details. You should have received a copy of the GNU
+		Lesser General Public License along with this software; if not, write
+		to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+		Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+	--> 
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Helloworld example" verbose="2" parallel="false">
+	<test name="remoting_helloworld_jboss5">
+		<parameter name="PROPERTY_FILE" value="" />
+		<classes>
+			<class
+				name="org.jboss.seam.example.remoting.helloworld.test.selenium.HelloworldTest" />
+		</classes>
+	</test>
+</suite>


Property changes on: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/jboss5.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java	                        (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java	2009-08-14 15:43:25 UTC (rev 11384)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+
+package org.jboss.seam.example.remoting.helloworld.test.selenium;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.Wait;
+
+import static org.testng.AssertJUnit.*;
+
+/**
+ * This class tests a functionality of remoting/helloworld example.
+ * 
+ * @author Martin Gencur
+ * 
+ */
+public class HelloworldTest extends SeamSeleniumTest
+{
+   protected static final String HELLOWORLD_URL = "/helloworld.seam";
+   protected static final String HELLOWORLD_TITLE = "Seam Remoting - Hello World Example";
+   protected static final String SAYHELLO_BUTTON = "xpath=//button[contains(@onclick,\"sayHello\")]";
+   protected static final String PROMPT_ANSWER = "Martin";
+   protected static final String ALERT_MESSAGE = "Hello, Martin";
+   protected static final Long TIMEOUT = 2000L; //2 seconds         
+   
+   @Override
+   @BeforeMethod
+   public void setUp()
+   {
+      super.setUp();
+      browser.open(CONTEXT_PATH + HELLOWORLD_URL);
+   }
+
+   @Test
+   public void simplePageContentTest()
+   {
+      assertTrue("Home page of Remoting/Helloworld Example expected", browser.getLocation().contains(HELLOWORLD_URL));      
+      assertTrue("Different page title expected",browser.getTitle().contains(HELLOWORLD_TITLE)); 
+      assertTrue("Home page should contain Say Hello button", browser.isElementPresent(SAYHELLO_BUTTON));
+   }
+   
+   @Test(dependsOnMethods = {"simplePageContentTest"})
+   public void sayHelloButtonTest(){
+      String result = "";
+      browser.answerOnNextPrompt(PROMPT_ANSWER);
+      browser.click(SAYHELLO_BUTTON);
+      waitForAlertPresent(TIMEOUT);
+      result = browser.getAlert();
+      assertTrue("An alert message should show up and should contain \"Hello,\" and name.", result.contains(ALERT_MESSAGE));      
+   }   
+   
+   public void waitForAlertPresent(Long timeout){
+      new Wait()
+      {
+         @Override
+         public boolean until()
+         {
+            return browser.isAlertPresent();
+         }
+      }.wait("Timeout while waiting for alert window.", timeout);
+   }   
+}



More information about the seam-commits mailing list