You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

integration_tests.xml 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <?xml version="1.0"?>
  2. <project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="Vaadin Integration Tests" basedir="." default="integration-test-all">
  3. <!-- Import common targets -->
  4. <import file="../common.xml" />
  5. <dirname file="${ant.file.Vaadin Integration Tests}" property="integration_test.dir" />
  6. <!-- Target deploying demo.war -->
  7. <fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run" />
  8. <fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run" />
  9. <fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run" />
  10. <!-- Test with these browsers -->
  11. <property name="test_browsers" value="winxp-firefox17-esr" />
  12. <!-- Path to key file. Default value -->
  13. <property name="sshkey.file" value="id_dsa" />
  14. <!-- path and name for demo.war to be deployed -->
  15. <property name="demo.war" value="demo.war" />
  16. <!-- Host running Testbench RC or Testbench Hub. Default value -->
  17. <property name="com.vaadin.testbench.tester.host" value="127.0.0.1" />
  18. <!-- Base url where the testable application is deployed -->
  19. <property name="deployment.url" value="http://${test.integration.server}:8080" />
  20. <!-- TestBench license parameter -->
  21. <property name="vaadin.testbench.developer.license" value="" />
  22. <property name="report.dir" location="${integration_test.dir}/result/reports-integration" />
  23. <!-- ssh host values -->
  24. <property name="ant.hub" value="${test.integration.antfile}" />
  25. <property name="user" value="${test.integration.user}" />
  26. <property name="passphrase" value="" />
  27. <ivy:resolve file="ivy.xml" conf="build, build-provided" />
  28. <ivy:cachepath pathid="classpath.tb3.lib" conf="build, build-provided" />
  29. <path id="classpath.tb3">
  30. <path location="target/test-classes" />
  31. <path refid="classpath.tb3.lib" />
  32. <path location="target/classes" />
  33. </path>
  34. <!-- Upload war to deploy to ssh host -->
  35. <target name="integration-test-upload-demo">
  36. <scp file="${demo.war}" todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile="${sshkey.file}" passphrase="${passphrase}" />
  37. </target>
  38. <!-- Run basic integration test test -->
  39. <target name="legacy-integration-test">
  40. <fail unless="testfiles" message="You need to specify the files to run using the 'testfiles' property" />
  41. <subant target="run-tb2-tests" failonerror="false" antfile="test.xml">
  42. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
  43. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
  44. <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
  45. <property name="server.start.succeeded" value="1" />
  46. <property name="browsers" value="${test_browsers}" />
  47. <property name="testfiles" value="${testfiles}" />
  48. <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
  49. <property name="retries" value="0" />
  50. <property name="report.qualifier" value="integration-tb2/${server-name}" />
  51. <fileset dir="." includes="test.xml" />
  52. </subant>
  53. </target>
  54. <target name="integration-test-theme">
  55. <subant target="run-tb2-tests" failonerror="false" antfile="test.xml">
  56. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
  57. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
  58. <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
  59. <property name="server.start.succeeded" value="1" />
  60. <property name="testfiles" value="${testfiles-theme}" />
  61. <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
  62. <property name="report.qualifier" value="integration-theme-tb2/${server-name}" />
  63. <fileset dir="." includes="test.xml" />
  64. </subant>
  65. </target>
  66. <target name="run-tb3-servlet-test">
  67. <antcall target="run-tb3-test" inheritall="true">
  68. <param name="junit.test.suite" value="com.vaadin.tests.tb3.ServletIntegrationTests" />
  69. </antcall>
  70. </target>
  71. <target name="run-tb3-test">
  72. <fail unless="server-name" message="Server name must be defined in server-name" />
  73. <fail unless="deployment.url" message="Deplyoment url must be defined in deployment.url" />
  74. <fail unless="com.vaadin.testbench.screenshot.directory" message="Screenshot directory must be defined in com.vaadin.testbench.screenshot.directory" />
  75. <property name="server.report.dir" location="${report.dir}/integration-test-tb3/${server-name}" />
  76. <!-- The junit task does not create the report dir... -->
  77. <mkdir dir="${server.report.dir}" />
  78. <junit showoutput="no" printsummary="no" fork="yes">
  79. <formatter type="xml" />
  80. <classpath refid="classpath.tb3" />
  81. <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
  82. <jvmarg value="-Ddeployment.url=${deployment.url}" />
  83. <jvmarg value="-Dserver-name=${server-name}" />
  84. <jvmarg value="-Djava.awt.headless=true" />
  85. <jvmarg value="-Ddemo.war=${demo.war}" />
  86. <jvmarg value="-Dvaadin.testbench.developer.license=${vaadin.testbench.developer.license}" />
  87. <test name="${junit.test.suite}" todir="${server.report.dir}" />
  88. </junit>
  89. </target>
  90. <target name="integration-test-tomcat7">
  91. <antcall target="run-generic-integration-test">
  92. <param name="startDelay" value="10" />
  93. <param name="target-server" value="tomcat7" />
  94. </antcall>
  95. </target>
  96. <target name="integration-test-tomcat7apacheproxy">
  97. <antcall target="run-generic-integration-test">
  98. <param name="startDelay" value="10" />
  99. <param name="target-server" value="tomcat7apacheproxy" />
  100. </antcall>
  101. </target>
  102. <target name="integration-test-tomcat8">
  103. <antcall target="run-generic-integration-test">
  104. <param name="startDelay" value="10" />
  105. <param name="target-server" value="tomcat8" />
  106. </antcall>
  107. </target>
  108. <target name="integration-test-osgi">
  109. <antcall target="run-generic-integration-test">
  110. <param name="startDelay" value="10" />
  111. <param name="target-server" value="osgi" />
  112. </antcall>
  113. </target>
  114. <target name="integration-test-jetty8">
  115. <antcall target="run-generic-integration-test">
  116. <param name="startDelay" value="180" />
  117. <param name="target-server" value="jetty8" />
  118. </antcall>
  119. </target>
  120. <target name="integration-test-jetty9">
  121. <antcall target="run-generic-integration-test">
  122. <param name="startDelay" value="180" />
  123. <param name="target-server" value="jetty9" />
  124. </antcall>
  125. </target>
  126. <target name="integration-test-jboss-eap6">
  127. <antcall target="run-generic-integration-test">
  128. <param name="startDelay" value="10" />
  129. <param name="target-server" value="jbosseap6" />
  130. </antcall>
  131. </target>
  132. <target name="integration-test-wildfly8">
  133. <antcall target="run-generic-integration-test">
  134. <param name="startDelay" value="10" />
  135. <param name="target-server" value="wildfly8" />
  136. </antcall>
  137. </target>
  138. <target name="integration-test-wildfly9">
  139. <antcall target="run-generic-integration-test">
  140. <param name="startDelay" value="10" />
  141. <param name="target-server" value="wildfly9" />
  142. </antcall>
  143. </target>
  144. <target name="integration-test-wildfly10">
  145. <antcall target="run-generic-integration-test">
  146. <param name="startDelay" value="10" />
  147. <param name="target-server" value="wildfly10" />
  148. </antcall>
  149. </target>
  150. <target name="integration-test-wildfly9-nginx">
  151. <antcall target="run-generic-integration-test">
  152. <param name="startDelay" value="10" />
  153. <param name="target-server" value="wildfly9-nginx" />
  154. <param name="target-port" value="80" />
  155. </antcall>
  156. </target>
  157. <target name="integration-test-glassfish4">
  158. <antcall target="run-generic-integration-test">
  159. <param name="startDelay" value="10" />
  160. <param name="target-server" value="glassfish4" />
  161. </antcall>
  162. </target>
  163. <target name="integration-test-payara">
  164. <antcall target="run-generic-integration-test">
  165. <param name="startDelay" value="10" />
  166. <param name="target-server" value="payara" />
  167. </antcall>
  168. </target>
  169. <target name="integration-test-liferay6">
  170. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" />
  171. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  172. <antcall target="run-generic-integration-test">
  173. <param name="startDelay" value="300" />
  174. <param name="test_browsers" value="winxp-firefox17-esr" />
  175. <param name="target-server" value="liferay6" />
  176. </antcall>
  177. </target>
  178. <target name="integration-test-weblogic12">
  179. <antcall target="run-generic-integration-test">
  180. <param name="startDelay" value="360" />
  181. <param name="target-port" value="7001" />
  182. <param name="target-server" value="weblogic12" />
  183. </antcall>
  184. </target>
  185. <!-- Upload demo, clean error screenshots and test deployment on all
  186. servers -->
  187. <target name="integration-test-all" unless="tests.integration.skip">
  188. <property name="passphrase" value="${passphrase}" />
  189. <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
  190. <fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
  191. <delete dir="${report.dir}" />
  192. <mkdir dir="${report.dir}" />
  193. <parallel>
  194. <antcall target="integration-test-liferay6" />
  195. <antcall target="integration-test-weblogic12" />
  196. <antcall target="integration-test-glassfish4" />
  197. <antcall target="integration-test-payara" />
  198. <antcall target="integration-test-jboss-eap6" />
  199. <antcall target="integration-test-wildfly8" />
  200. <antcall target="integration-test-wildfly9" />
  201. <antcall target="integration-test-wildfly10" />
  202. <antcall target="integration-test-jetty8" />
  203. <antcall target="integration-test-jetty9" />
  204. <antcall target="integration-test-tomcat7" />
  205. <antcall target="integration-test-tomcat8" />
  206. <antcall target="integration-test-osgi" />
  207. <antcall target="integration-test-tomcat7apacheproxy" />
  208. </parallel>
  209. </target>
  210. <target name="do-run-generic-test">
  211. <property name="target-host" value="${target-server}.devnet.vaadin.com" />
  212. <property name="target-port" value="8080" />
  213. <antcontrib:if>
  214. <isset property="startDelay" />
  215. <then>
  216. <antcontrib:math result="sleepTime" datatype="int">
  217. <op op="rint">
  218. <op op="*">
  219. <num value="${startDelay}" />
  220. <op op="random" />
  221. </op>
  222. </op>
  223. </antcontrib:math>
  224. <echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo>
  225. <sleep seconds="${sleepTime}" />
  226. </then>
  227. </antcontrib:if>
  228. <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}">
  229. <fileset dir="integration_base_files">
  230. <include name="*" />
  231. </fileset>
  232. </scp>
  233. <!-- trycatch probably not needed any more as it just fails with
  234. the original message and doesn't do anything in the finally block -->
  235. <antcontrib:trycatch property="error_message">
  236. <try>
  237. <!-- timeout in one hour (remote end should timeout in 55
  238. minutes) -->
  239. <sshexec host="${target-host}" outputproperty="lock-output" timeout="3600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="chmod +x *.sh; ant -f deploy.xml get-lock" />
  240. <antcall target="echo-prefix">
  241. <param name="prefix" value="${target-server}: " />
  242. <param name="message" value="${lock-output}" />
  243. </antcall>
  244. <scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
  245. <!-- timeout in 15 minutes -->
  246. <sshexec host="${target-host}" outputproperty="start-output" timeout="900000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml startup-and-deploy" failonerror="false" />
  247. <antcall target="echo-prefix">
  248. <param name="prefix" value="${target-server}: " />
  249. <param name="message" value="${start-output}" />
  250. </antcall>
  251. <fail message="${start-output}">
  252. <condition>
  253. <not>
  254. <contains string="${start-output}" substring="Demo deployed successfully" />
  255. </not>
  256. </condition>
  257. </fail>
  258. <antcontrib:if>
  259. <isset property="testfiles" />
  260. <antcontrib:then>
  261. <echo>Starting legacy (TB2) test for ${target-server}</echo>
  262. <antcall target="legacy-integration-test">
  263. <param name="server-name" value="${target-server}" />
  264. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  265. </antcall>
  266. </antcontrib:then>
  267. <antcontrib:else>
  268. <echo>Starting TB3 test for ${target-server}</echo>
  269. <antcall target="run-tb3-servlet-test">
  270. <param name="server-name" value="${target-server}" />
  271. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  272. </antcall>
  273. </antcontrib:else>
  274. </antcontrib:if>
  275. <!-- Run theme tests in all browsers if there's a property
  276. with the test files -->
  277. <antcontrib:if>
  278. <isset property="testfiles-theme" />
  279. <antcontrib:then>
  280. <antcall target="integration-test-theme">
  281. <param name="server-name" value="${target-server}" />
  282. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  283. </antcall>
  284. </antcontrib:then>
  285. </antcontrib:if>
  286. <!-- timeout in five minutes -->
  287. <sshexec host="${target-host}" outputproperty="stop-output" timeout="600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" />
  288. <antcall target="echo-prefix">
  289. <param name="prefix" value="${target-server}: " />
  290. <param name="message" value="${stop-output}" />
  291. </antcall>
  292. </try>
  293. <catch>
  294. <fail message="${error_message}" />
  295. </catch>
  296. </antcontrib:trycatch>
  297. </target>
  298. <target name="echo-prefix">
  299. <antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
  300. <echo message="${message-prefixed}" />
  301. </target>
  302. <target name="run-generic-integration-test">
  303. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  304. <antcontrib:trycatch property="tried">
  305. <try>
  306. <antcall target="do-run-generic-test" />
  307. </try>
  308. <catch>
  309. <antcontrib:antcallback target="teamcity-escape" return="tried-escaped">
  310. <param name="returnTo" value="tried-escaped" />
  311. <param name="message" value="${tried}" />
  312. </antcontrib:antcallback>
  313. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
  314. </catch>
  315. </antcontrib:trycatch>
  316. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  317. </target>
  318. <target name="teamcity-escape">
  319. <property name="returnTo" value="return" />
  320. <!-- Should also perform other escaping (\u0085, \u2028 and \u2029)
  321. - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
  322. <!-- Immutable properties -> needs to create a new one every time -->
  323. <antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
  324. <antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
  325. <antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />
  326. <property name="${returnTo}" value="${details-escaped3}" />
  327. </target>
  328. <target name="run-integration-test">
  329. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  330. <antcontrib:trycatch property="tried">
  331. <try>
  332. <antcall target="integration-test-${target-server}" />
  333. </try>
  334. <catch>
  335. <antcallback target="teamcity-escape" return="tried-escaped">
  336. <param name="returnTo" value="tried-escaped" />
  337. <param name="message" value="${tried}" />
  338. </antcallback>
  339. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
  340. </catch>
  341. </antcontrib:trycatch>
  342. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  343. </target>
  344. <target name="integration-test-get-lock">
  345. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
  346. </target>
  347. <target name="integration-test-release-lock">
  348. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
  349. </target>
  350. <!-- Remove demo.war -->
  351. <target name="integration-test-clean">
  352. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
  353. </target>
  354. </project>