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

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Sep 21 07:48:11 EDT 2009


Author: mgencur at redhat.com
Date: 2009-09-21 07:48:11 -0400 (Mon, 21 Sep 2009)
New Revision: 11504

Added:
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/build.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java
Modified:
   branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
Log:
JBPAPP-2829 Backported a functional test of helloworld example

Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml	2009-09-21 11:20:12 UTC (rev 11503)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/build.xml	2009-09-21 11:48:11 UTC (rev 11504)
@@ -67,6 +67,7 @@
 		<testexample name="quartz" />
 		<testexample name="registration" />
 		<testexample name="remoting/chatroom" />
+		<testexample name="remoting/helloworld" />
 		<testexample name="remoting/gwt" />
 		<testexample name="seambay" />
 		<testexample name="seamdiscs" />
@@ -112,6 +113,7 @@
 		<cleanexample name="quartz" />
 		<cleanexample name="registration" />
 		<cleanexample name="remoting/chatroom" />
+		<cleanexample name="remoting/helloworld" />
 		<cleanexample name="remoting/gwt" />
 		<cleanexample name="seambay" />
 		<cleanexample name="seamdiscs" />
@@ -141,6 +143,7 @@
 		<undeployexample name="quartz" />
 		<undeployexample name="registration" />
 		<undeployexample name="remoting/chatroom" />
+		<undeployexample name="remoting/helloworld" />
 		<undeployexample name="remoting/gwt" />
 		<undeployexample name="seambay" />
 		<undeployexample name="seamdiscs" />

Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/build.xml	                        (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/build.xml	2009-09-21 11:48:11 UTC (rev 11504)
@@ -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="jboss.example.ready.check.url" value="seam-helloworld" />
+	
+	<import file="../../build.xml" />
+</project>

Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml	                        (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/jboss.xml	2009-09-21 11:48:11 UTC (rev 11504)
@@ -0,0 +1,28 @@
+
+	<!--
+		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="" />
+		<parameter name="CONTEXT_PATH" value="/seam-helloworld" />
+		<classes>
+			<class
+				name="org.jboss.seam.example.remoting.helloworld.test.selenium.HelloworldTest" />
+		</classes>
+	</test>
+</suite>


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

Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java	                        (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/remoting/helloworld/src/org/jboss/seam/example/remoting/helloworld/test/selenium/HelloworldTest.java	2009-09-21 11:48:11 UTC (rev 11504)
@@ -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 = 10000L; //10 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