Author: craigmcc Date: Mon Jan 23 23:25:10 2006 New Revision: 371852 URL: http://svn.apache.org/viewcvs?rev=371852&view=rev Log: Add a simple system integration test, using the new support in the Shale Test Framework.
Added: struts/shale/trunk/blank/src/systest/ struts/shale/trunk/blank/src/systest/org/ struts/shale/trunk/blank/src/systest/org/apache/ struts/shale/trunk/blank/src/systest/org/apache/shale/ struts/shale/trunk/blank/src/systest/org/apache/shale/blank/ struts/shale/trunk/blank/src/systest/org/apache/shale/blank/systest/ struts/shale/trunk/blank/src/systest/org/apache/shale/blank/systest/WelcomeTestCase.java (with props) Modified: struts/shale/trunk/blank/build.xml struts/shale/trunk/blank/default.properties struts/shale/trunk/blank/src/web/WEB-INF/web.xml struts/shale/trunk/blank/src/web/welcome.jsp Modified: struts/shale/trunk/blank/build.xml URL: http://svn.apache.org/viewcvs/struts/shale/trunk/blank/build.xml?rev=371852&r1=371851&r2=371852&view=diff ============================================================================== --- struts/shale/trunk/blank/build.xml (original) +++ struts/shale/trunk/blank/build.xml Mon Jan 23 23:25:10 2006 @@ -100,6 +100,22 @@ </path> + <!-- System Integration Test Classpath --> + <path id="systest.classpath"> + <path refid="compile.classpath"/> + <fileset dir="${htmlunit.dir}/lib" + includes="*.jar"/> + <fileset dir="${lib.dir}" + includes="**/junit.jar"/> + <fileset dir="${ext.dir}" + includes="**/junit.jar"/> + <fileset dir="${shale.dir}/dist" + includes="shale-test.jar"/> + <pathelement location="${build.sys.dir}"/> + <pathelement location="${build.web.dir}/WEB-INF/classes"/> + </path> + + <!-- ==================== Maintenance Targets ============================ --> @@ -426,6 +442,58 @@ <fileset dir="${build.test.dir}" includes="**/*TestCase.class"/> </batchtest> + </junit> + + </target> + + + <!-- =============== System Integration Tests ============================ --> + + + <target name="systest.compile"> + + <mkdir dir="${build.sys.dir}"/> + + <!-- Compile Java Sources --> + <javac srcdir="${src.sys.dir}" + destdir="${build.sys.dir}" + debug="${compile.debug}" + deprecation="${compile.deprecation}" + optimize="${compile.optimize}" + source="${project.source}" + target="${project.target}"> + <classpath refid="systest.classpath" /> + </javac> + + <!-- Copy non-Java Sources --> + <copy todir="${build.sys.dir}"> + <fileset dir="${src.sys.dir}"> + <exclude name="**/*.java"/> + </fileset> + </copy> + + </target> + + + <target name="systest" depends="systest.compile" + description="Execute system integration tests"> + + <junit fork="yes" + printSummary="yes" + haltonerror="yes" + haltonfailure="yes"> + + <classpath refid="systest.classpath"/> + <formatter type="plain" + usefile="false"/> + <sysproperty key="url" + value="${htmlunit.url}"/> + + <batchtest> + <fileset dir="${build.sys.dir}" + includes="**/*TestCase.class"/> + </batchtest> + </junit> </target> Modified: struts/shale/trunk/blank/default.properties URL: http://svn.apache.org/viewcvs/struts/shale/trunk/blank/default.properties?rev=371852&r1=371851&r2=371852&view=diff ============================================================================== --- struts/shale/trunk/blank/default.properties (original) +++ struts/shale/trunk/blank/default.properties Mon Jan 23 23:25:10 2006 @@ -97,6 +97,7 @@ src.dir=${basedir}/src src.conf.dir=${src.dir}/conf src.java.dir=${src.dir}/java +src.sys.dir=${src.dir}/systest src.test.dir=${src.dir}/test src.web.dir=${src.dir}/web test.dir=${basedir}/test @@ -144,5 +145,19 @@ # The password of a Tomcat user that has the "manager" role catalina.password=tomcat + + +# ------------------------------------------------------------------------------ +# (Optional) System Integration Test Packages +# ------------------------------------------------------------------------------ + + +# The full pathname to the HtmlUnit (version 1.6 or later) binary distribution +# from http://sourceforge.net +htmlunit.dir=/usr/local/htmlunit-1.6 + + +# the full URL to the application to be tested +htmlunit.url=http://localhost:8080/${project.path} Added: struts/shale/trunk/blank/src/systest/org/apache/shale/blank/systest/WelcomeTestCase.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/blank/src/systest/org/apache/shale/blank/systest/WelcomeTestCase.java?rev=371852&view=auto ============================================================================== --- struts/shale/trunk/blank/src/systest/org/apache/shale/blank/systest/WelcomeTestCase.java (added) +++ struts/shale/trunk/blank/src/systest/org/apache/shale/blank/systest/WelcomeTestCase.java Mon Jan 23 23:25:10 2006 @@ -0,0 +1,100 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed 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. + * + * $Id$ + */ + +package org.apache.shale.blank.systest; + +import java.util.ResourceBundle; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.apache.shale.test.htmlunit.AbstractHtmlUnitTestCase; + +/** + * <p>System test case for the <code>/welcome.jsp</code> page.</p> + */ +public class WelcomeTestCase extends AbstractHtmlUnitTestCase { + + + // ------------------------------------------------------------ Constructors + + + /** + * <p>Construct a new instance of this test case.</p> + * + * @param name Name of the new test case + */ + public WelcomeTestCase(String name) { + + super(name); + + } + + + // ------------------------------------------------------ Instance Variables + + + private ResourceBundle bundle = + ResourceBundle.getBundle("org.apache.shale.blank.Bundle"); + + + // ------------------------------------------------------ Test Setup Methods + + + /** + * <p>Set up the instance variables required for this test case.</p> + */ + public void setUp() throws Exception { + + super.setUp(); + page("/"); + + } + + + /** + * <p>Return the set of tests included in this test suite.</p> + */ + public static Test suite() { + + return (new TestSuite(WelcomeTestCase.class)); + + } + + + /** + * <p>Tear down instance variables required by this test case.</p> + */ + public void tearDown() { + + super.tearDown(); + + } + + + + // ------------------------------------------------- Individual Test Methods + + + // Test a pristine instance of this page + public void testPristine() throws Exception { + + assertEquals(bundle.getString("welcome.title"), title()); + + } + + +} Propchange: struts/shale/trunk/blank/src/systest/org/apache/shale/blank/systest/WelcomeTestCase.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/shale/trunk/blank/src/systest/org/apache/shale/blank/systest/WelcomeTestCase.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Modified: struts/shale/trunk/blank/src/web/WEB-INF/web.xml URL: http://svn.apache.org/viewcvs/struts/shale/trunk/blank/src/web/WEB-INF/web.xml?rev=371852&r1=371851&r2=371852&view=diff ============================================================================== --- struts/shale/trunk/blank/src/web/WEB-INF/web.xml (original) +++ struts/shale/trunk/blank/src/web/WEB-INF/web.xml Mon Jan 23 23:25:10 2006 @@ -24,6 +24,9 @@ http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> + <!-- Display name for this application --> + <display-name>@projectName@</display-name> + <!-- Select JSF State Saving Mode --> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> Modified: struts/shale/trunk/blank/src/web/welcome.jsp URL: http://svn.apache.org/viewcvs/struts/shale/trunk/blank/src/web/welcome.jsp?rev=371852&r1=371851&r2=371852&view=diff ============================================================================== --- struts/shale/trunk/blank/src/web/welcome.jsp (original) +++ struts/shale/trunk/blank/src/web/welcome.jsp Mon Jan 23 23:25:10 2006 @@ -34,7 +34,7 @@ <p> <h:outputText value="#{messages['welcome.prompt']}"/> - <h:outputText value="#{welcome.timestamp}">. + <h:outputText value="#{welcome.timestamp}"> <f:convertDateTime type="both"/> </h:outputText> </p> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]