<target name="test" depends="buildorder">
<subant buildpathref="build-path" target="test" />
</target>
+
<target name="test-all" depends="buildorder">
<property name="war.file" location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
+
<parallel>
- <sequential>
- <!-- Sleep before running integration tests so testbench
- tests have time to compile and start -->
- <sleep minutes="4" />
- <ant antfile="uitest/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
- <property name="demo.war" value="${war.file}" />
- </ant>
- </sequential>
+ <!-- JUnit tests, can be run without a server -->
<subant buildpathref="build-path" target="test" />
- <ant antfile="uitest/test.xml" target="test-package">
+
+ <!-- Server deployment + TestBench tests -->
+ <ant antfile="uitest/build.xml" target="test-testbench">
<property name="war.file" location="${war.file}" />
</ant>
</parallel>
<!-- global properties -->
<property name="module.name" value="vaadin-uitest" />
+ <property name="uitest.dir" location="${vaadin.basedir}/uitest" />
<property name="result.dir" value="result" />
<property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />
<echo>WHAT? No JUnit tests for ${module.name}!</echo>
</target>
+ <target name="test-testbench" depends="clean-testbench-errors" description="Run all TestBench based tests, including server tests">
+ <parallel>
+ <daemons>
+ <!-- Start server -->
+ <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
+ </daemons>
+ <sequential>
+ <!-- Server tests -->
+
+ <!-- Sleep before running integration tests so testbench 2
+ tests have time to compile and start -->
+ <sleep minutes="4" />
+ <ant antfile="${uitest.dir}/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
+ <property name="demo.war" value="${war.file}" />
+ </ant>
+ </sequential>
+ <sequential>
+ <!-- Wait for server to start -->
+ <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
+
+ <!-- Run all different kinds of TestBench tests in parallel -->
+ <parallel>
+
+ <!-- Legacy TestBench 2 tests -->
+ <sequential>
+ <ant antfile="${uitest.dir}/test.xml" target="tb2-tests" />
+ <echo message="TestBench 2 tests complete" />
+ </sequential>
+
+ <!-- TestBench 3 tests -->
+ <sequential>
+ <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests" inheritall="true" />
+ <echo message="TestBench 3 tests complete" />
+ </sequential>
+ </parallel>
+ </sequential>
+
+ </parallel>
+ </target>
+
+ <target name="clean-testbench-errors">
+ <fail unless="com.vaadin.testbench.screenshot.directory" message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
+ <mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" />
+ <delete>
+ <fileset dir="${com.vaadin.testbench.screenshot.directory}/errors">
+ <include name="**/**.*" />
+ </fileset>
+ </delete>
+ </target>
+
</project>
<?xml version="1.0"?>
-<project xmlns:antcontrib="antlib:net.sf.antcontrib" name="Vaadin Integration Tests" basedir="." default="integration-test-all">
+<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="Vaadin Integration Tests" basedir="." default="integration-test-all">
<!-- Import common targets -->
<import file="../common.xml" />
<property name="user" value="${test.integration.user}" />
<property name="passphrase" value="" />
+ <ivy:resolve file="ivy.xml" conf="build, build-provided" />
+ <ivy:cachepath pathid="classpath.tb3.lib" conf="build, build-provided" />
+ <path id="classpath.tb3">
+ <path refid="classpath.tb3.lib" />
+ <path location="result/classes" />
+ </path>
+
<!-- Upload war to deploy to ssh host -->
<target name="integration-test-upload-demo">
<scp file="${demo.war}" todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile="${sshkey.file}" passphrase="${passphrase}" />
</target>
<!-- Run basic integration test test -->
- <target name="integration-test-servlet">
+ <target name="legacy-integration-test">
<fail unless="html-test-files">html-test-files must be defined</fail>
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
<subant target="run-tests" failonerror="false" antfile="test.xml">
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" />
</target>
+ <target name="run-tb3-servlet-test">
+ <antcall target="run-tb3-test" inheritall="true">
+ <param name="junit.test.suite" value="com.vaadin.tests.tb3.ServletIntegrationTests" />
+ </antcall>
+ </target>
+ <target name="run-tb3-test">
+ <fail unless="server-name" message="Server name must be defined in server-name" />
+ <fail unless="deployment.url" message="Deplyoment url must be defined in deployment.url" />
+ <fail unless="com.vaadin.testbench.screenshot.directory" message="Screenshot directory must be defined in com.vaadin.testbench.screenshot.directory" />
+
+ <junit printsummary="withOutAndErr" fork="yes">
+ <formatter usefile="false" type="plain" />
+ <classpath refid="classpath.tb3" />
+
+ <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
+ <jvmarg value="-Ddeployment.url=${deployment.url}" />
+ <jvmarg value="-Dserver-name=${server-name}" />
+ <jvmarg value="-Djava.awt.headless=true" />
+ <test name="${junit.test.suite}" />
+ </junit>
+ </target>
<target name="integration-test-tomcat7">
<antcall target="run-generic-integration-test">
<parallel>
<antcontrib:trycatch property="tried">
<try>
- <!-- Still running GAE test from the old server which
- requires its own lock -->
<echo message="Getting lock" />
<antcall target="integration-test-get-lock" />
<echo message="Got lock" />
<antcall target="integration-test-tomcat6" />
<antcall target="integration-test-tomcat7" />
<antcall target="integration-test-websphere8" />
-
</parallel>
</target>
</fail>
<antcontrib:if>
- <isset property="html-test-files" />
+ <isset property="testfiles" />
<antcontrib:then>
- <antcall target="integration-test-servlet">
+ <echo>Starting legacy (TB2) test for ${target-server}</echo>
+ <antcall target="legacy-integration-test">
<param name="server-name" value="${target-server}" />
<param name="deployment.url" value="http://${target-host}:${target-port}" />
</antcall>
</antcontrib:then>
<antcontrib:else>
- <echo>Starting test.xml</echo>
- <subant target="run-tb3-tests" failonerror="false" buildpath=".." genericantfile="test.xml">
- <property name="junit.test.suite" value="com.vaadin.tests.tb3.AllIntegrationTests" />
-
- <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
- <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
- <property name="com.vaadin.testbench.deployment.url" value="http://${target-host}:${target-port}" />
- <property name="server-name" value="${target-server}" />
- </subant>
+ <echo>Starting TB3 test for ${target-server}</echo>
+ <antcall target="run-tb3-servlet-test">
+ <param name="server-name" value="${target-server}" />
+ <param name="deployment.url" value="http://${target-host}:${target-port}" />
+ </antcall>
</antcontrib:else>
</antcontrib:if>
baseUrl = baseUrl.substring(0, baseUrl.length() - 1);\r
}\r
\r
+ System.out.println("Starting TB3 test for " + baseUrl + getPath());\r
driver.get(baseUrl + getPath());\r
}\r
\r
+++ /dev/null
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- *
- * 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.
- */
-
-package com.vaadin.tests.tb3;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.model.InitializationError;
-
-import com.vaadin.tests.tb3.AllIntegrationTests.AllIntegrationTestsFinder;
-
-@RunWith(AllIntegrationTestsFinder.class)
-public class AllIntegrationTests {
- public static class AllIntegrationTestsFinder extends TB3TestFinder {
- public AllIntegrationTestsFinder(Class<?> klass)
- throws InitializationError {
- super(klass, AbstractTB3Test.class, "com.vaadin.tests.integration",
- new String[] {});
- }
- }
-}
* @throws InitializationError
*/
public AllTestsFinder(Class<?> klass) throws InitializationError {
- super(klass, AbstractTB3Test.class, "com.vaadin",
+ super(klass, AbstractTB3Test.class, "com.vaadin.tests",
new String[] { "com.vaadin.tests.integration" });
}
--- /dev/null
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * 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.
+ */
+
+package com.vaadin.tests.tb3;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.model.InitializationError;
+
+import com.vaadin.tests.tb3.ServletIntegrationTests.ServletIntegrationTestsFinder;
+
+@RunWith(ServletIntegrationTestsFinder.class)
+public class ServletIntegrationTests {
+ public static class ServletIntegrationTestsFinder extends TB3TestFinder {
+ public ServletIntegrationTestsFinder(Class<?> klass)
+ throws InitializationError {
+ super(klass, AbstractTB3Test.class, "com.vaadin.tests.integration",
+ new String[] {});
+ }
+ }
+}
browserName = "Opera";
}
- String format = browserName + capabilities.getVersion();
-
- String serverName = System.getProperty("server-name");
- if (serverName != null && !serverName.isEmpty()) {
- format = serverName + "_" + format;
- }
-
- return format;
+ return browserName + capabilities.getVersion();
}
}
}
* @param suiteClasses
* @throws InitializationError
*/
- public TB3TestFinder(Class<?> klass, Class<AbstractTB3Test> baseClass,
- String basePackage, String[] ignorePackages)
- throws InitializationError {
+ public TB3TestFinder(Class<?> klass,
+ Class<? extends AbstractTB3Test> baseClass, String basePackage,
+ String[] ignorePackages) throws InitializationError {
// Could consider reading settings from annoations on klass instead
// creating sub classes
super(klass, getAllTB3Tests(baseClass, basePackage, ignorePackages));
* @since
* @return
*/
- private static Class<?>[] getAllTB3Tests(Class<AbstractTB3Test> baseClass,
- String basePackage, String[] ignorePackages) {
+ private static Class<?>[] getAllTB3Tests(
+ Class<? extends AbstractTB3Test> baseClass, String basePackage,
+ String[] ignorePackages) {
try {
- List<Class<? extends AbstractTB3Test>> l = findClasses(baseClass,
- basePackage, ignorePackages);
+ List<?> l = findClasses(baseClass, basePackage, ignorePackages);
return l.toArray(new Class[] {});
} catch (IOException e) {
// TODO Auto-generated catch block
--- /dev/null
+<?xml version="1.0"?>
+<project name="tb3test" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" basedir=".">
+
+ <dirname property="tb3test.dir" file="${ant.file.tb3test}" />
+
+ <ivy:resolve file="${tb3test.dir}/ivy.xml" conf="build, build-provided" />
+ <ivy:cachepath pathid="classpath.tb3.lib" conf="build, build-provided" />
+ <path id="classpath.tb3">
+ <path refid="classpath.tb3.lib" />
+ <path location="${tb3test.dir}/result/classes" />
+ </path>
+
+ <target name="run-all-tb3-tests" description="Run all the TB3 tests (except server tests) in the project">
+ <antcall target="run-tb3-suite">
+ <param name="junit.test.suite" value="com.vaadin.tests.tb3.AllTB3Tests" />
+ </antcall>
+ </target>
+
+ <target name="run-tb3-suite">
+ <fail unless="junit.test.suite" message="Define suite to run using junit.test.suite" />
+ <fail unless="com.vaadin.testbench.screenshot.directory" message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
+ <junit printsummary="withOutAndErr" fork="yes">
+ <formatter usefile="false" type="plain" />
+ <classpath refid="classpath.tb3" />
+
+ <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
+ <jvmarg value="-Djava.awt.headless=true" />
+ <test name="${junit.test.suite}" />
+ </junit>
+
+ </target>
+
+</project>
<!-- fileset containing all TestBench tests to run -->
<fileset dir="${test.xml.dir}" id="html-test-files">
- <include name="src/**/*.html" />
+ <include name="src/**/*Clipping*.html" />
<exclude name="integration-testscripts/**/*.html" />
</fileset>
<fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined." />
</target>
- <target name="run-tests" depends="run-tb3-tests, run-tb2-tests">
- </target>
-
- <target name="run-tb3-tests">
- <echo>Test.xml started</echo>
-
- <property name="junit.test.suite" value="com.vaadin.tests.tb3.AllTB3Tests" />
- <property name="com.vaadin.testbench.deployment.hostname" value="auto" />
- <property name="com.vaadin.testbench.deployment.url" value="" />
- <property name="server-name" value="" />
-
- <ivy:resolve file="uitest/ivy.xml" conf="build, build-provided" />
- <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" />
-
- <junit printsummary="withOutAndErr" fork="yes">
- <formatter usefile="false" type="plain" />
-
- <classpath location="uitest/result/classes" />
- <classpath refid="classpath.compile.dependencies" />
-
- <jvmarg value="-Dcom.vaadin.testbench.tester.host=${com.vaadin.testbench.tester.host}" />
- <jvmarg value="-Dcom.vaadin.testbench.deployment.hostname=${com.vaadin.testbench.deployment.hostname}" />
-
- <!-- special parameters used when running integration tests -->
- <jvmarg value="-Ddeployment.url=${com.vaadin.testbench.deployment.url}" />
- <jvmarg value="-Dserver-name=${server-name}" />
-
- <!-- Define where the reference screenshots and diff files are
- saved -->
- <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
- <!-- Resolution for screenshots -->
- <jvmarg value="-Dcom.vaadin.testbench.screenshot.resolution=${com.vaadin.testbench.screenshot.resolution}" />
- <jvmarg value="-Dcom.vaadin.testbench.debug=${com.vaadin.testbench.debug}" />
- <jvmarg value="-Dcom.vaadin.testbench.screenshot.block.error=${com.vaadin.testbench.screenshot.block.error}" />
-
- <jvmarg value="-Djava.awt.headless=true" />
-
- <!-- true/false system arguments -->
- <jvmarg value="-Dcom.vaadin.testbench.screenshot.softfail=${com.vaadin.testbench.screenshot.softfail}" />
- <jvmarg value="-Dcom.vaadin.testbench.screenshot.reference.debug=${com.vaadin.testbench.screenshot.reference.debug}" />
- <jvmarg value="-Dcom.vaadin.testbench.screenshot.cursor=${com.vaadin.testbench.screenshot.cursor}" />
-
- <test name="${junit.test.suite}" />
- </junit>
- </target>
-
- <target name="run-tb2-tests" depends="compile-tests">
+ <target name="run-tb2-tests" depends="check-parameters,compile-tests">
<fileset dir="${test-output-dir}" id="tests-fileset">
<include name="**/**.java" />
</fileset>
<!-- ================================================================== -->
<!-- The default target. -->
- <target name="run-and-clean-up" depends="check-parameters,remove-error-screens,run-tests" />
+ <target name="run-and-clean-up" depends="check-parameters,remove-error-screens,run-tb2-tests" />
-
- <!-- Starts the server and runs all TestBench tests -->
- <target name="test-package">
- <fail unless="war.file" message="No 'war.file' parameter given." />
+ <!-- Runs all TestBench 2 tests -->
+ <target name="tb2-tests">
<property name="test-output-dir" location="${test.xml.dir}/result/testbench-junit-classes" />
<property name="retries" value="2" />
<property name="com.vaadin.testbench.screenshot.block.error" value="0.025" />
<property name="com.vaadin.testbench.debug" value="false" />
- <parallel>
- <daemons>
- <ant antfile="${test.xml.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
- </daemons>
- <sequential>
- <ant antfile="${test.xml.dir}/vaadin-server.xml" target="wait-for-startup" />
- <antcall inheritall="true" inheritrefs="true" target="run-and-clean-up" />
- <echo message="All TestBench tests have been run" />
- </sequential>
- </parallel>
+ <antcall inheritall="true" inheritrefs="true" target="run-tb2-tests" />
</target>
</project>