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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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-liferay6-theme">
  179. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" />
  180. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  181. <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" />
  182. <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
  183. <antcall target="run-generic-integration-test">
  184. <param name="startDelay" value="300" />
  185. <param name="test_browsers" value="winxp-firefox17-esr" />
  186. <param name="target-server" value="liferay6" />
  187. </antcall>
  188. </target>
  189. <target name="integration-test-weblogic12">
  190. <antcall target="run-generic-integration-test">
  191. <param name="startDelay" value="360" />
  192. <param name="target-port" value="7001" />
  193. <param name="target-server" value="weblogic12" />
  194. </antcall>
  195. </target>
  196. <!-- Upload demo, clean error screenshots and test deployment on all
  197. servers -->
  198. <target name="integration-test-all" unless="tests.integration.skip">
  199. <property name="passphrase" value="${passphrase}" />
  200. <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
  201. <fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
  202. <delete dir="${report.dir}" />
  203. <mkdir dir="${report.dir}" />
  204. <parallel>
  205. <antcall target="integration-test-liferay6" />
  206. <antcall target="integration-test-liferay6-theme" />
  207. <antcall target="integration-test-weblogic12" />
  208. <antcall target="integration-test-glassfish4" />
  209. <antcall target="integration-test-payara" />
  210. <antcall target="integration-test-jboss-eap6" />
  211. <antcall target="integration-test-wildfly8" />
  212. <antcall target="integration-test-wildfly9" />
  213. <antcall target="integration-test-wildfly10" />
  214. <antcall target="integration-test-jetty8" />
  215. <antcall target="integration-test-jetty9" />
  216. <antcall target="integration-test-tomcat7" />
  217. <antcall target="integration-test-tomcat8" />
  218. <antcall target="integration-test-osgi" />
  219. <antcall target="integration-test-tomcat7apacheproxy" />
  220. </parallel>
  221. </target>
  222. <target name="do-run-generic-test">
  223. <property name="target-host" value="${target-server}.devnet.vaadin.com" />
  224. <property name="target-port" value="8080" />
  225. <antcontrib:if>
  226. <isset property="startDelay" />
  227. <then>
  228. <antcontrib:math result="sleepTime" datatype="int">
  229. <op op="rint">
  230. <op op="*">
  231. <num value="${startDelay}" />
  232. <op op="random" />
  233. </op>
  234. </op>
  235. </antcontrib:math>
  236. <echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo>
  237. <sleep seconds="${sleepTime}" />
  238. </then>
  239. </antcontrib:if>
  240. <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}">
  241. <fileset dir="integration_base_files">
  242. <include name="*" />
  243. </fileset>
  244. </scp>
  245. <!-- trycatch probably not needed any more as it just fails with
  246. the original message and doesn't do anything in the finally block -->
  247. <antcontrib:trycatch property="error_message">
  248. <try>
  249. <!-- timeout in one hour (remote end should timeout in 55
  250. minutes) -->
  251. <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" />
  252. <antcall target="echo-prefix">
  253. <param name="prefix" value="${target-server}: " />
  254. <param name="message" value="${lock-output}" />
  255. </antcall>
  256. <scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
  257. <!-- timeout in 15 minutes -->
  258. <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" />
  259. <antcall target="echo-prefix">
  260. <param name="prefix" value="${target-server}: " />
  261. <param name="message" value="${start-output}" />
  262. </antcall>
  263. <fail message="${start-output}">
  264. <condition>
  265. <not>
  266. <contains string="${start-output}" substring="Demo deployed successfully" />
  267. </not>
  268. </condition>
  269. </fail>
  270. <antcontrib:if>
  271. <isset property="testfiles" />
  272. <antcontrib:then>
  273. <echo>Starting legacy (TB2) test for ${target-server}</echo>
  274. <antcall target="legacy-integration-test">
  275. <param name="server-name" value="${target-server}" />
  276. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  277. </antcall>
  278. </antcontrib:then>
  279. <antcontrib:else>
  280. <echo>Starting TB3 test for ${target-server}</echo>
  281. <antcall target="run-tb3-servlet-test">
  282. <param name="server-name" value="${target-server}" />
  283. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  284. </antcall>
  285. </antcontrib:else>
  286. </antcontrib:if>
  287. <!-- Run theme tests in all browsers if there's a property
  288. with the test files -->
  289. <antcontrib:if>
  290. <isset property="testfiles-theme" />
  291. <antcontrib:then>
  292. <antcall target="integration-test-theme">
  293. <param name="server-name" value="${target-server}" />
  294. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  295. </antcall>
  296. </antcontrib:then>
  297. </antcontrib:if>
  298. <!-- timeout in five minutes -->
  299. <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" />
  300. <antcall target="echo-prefix">
  301. <param name="prefix" value="${target-server}: " />
  302. <param name="message" value="${stop-output}" />
  303. </antcall>
  304. </try>
  305. <catch>
  306. <fail message="${error_message}" />
  307. </catch>
  308. </antcontrib:trycatch>
  309. </target>
  310. <target name="echo-prefix">
  311. <antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
  312. <echo message="${message-prefixed}" />
  313. </target>
  314. <target name="run-generic-integration-test">
  315. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  316. <antcontrib:trycatch property="tried">
  317. <try>
  318. <antcall target="do-run-generic-test" />
  319. </try>
  320. <catch>
  321. <antcontrib:antcallback target="teamcity-escape" return="tried-escaped">
  322. <param name="returnTo" value="tried-escaped" />
  323. <param name="message" value="${tried}" />
  324. </antcontrib:antcallback>
  325. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
  326. </catch>
  327. </antcontrib:trycatch>
  328. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  329. </target>
  330. <target name="teamcity-escape">
  331. <property name="returnTo" value="return" />
  332. <!-- Should also perform other escaping (\u0085, \u2028 and \u2029)
  333. - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
  334. <!-- Immutable properties -> needs to create a new one every time -->
  335. <antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
  336. <antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
  337. <antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />
  338. <property name="${returnTo}" value="${details-escaped3}" />
  339. </target>
  340. <target name="run-integration-test">
  341. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  342. <antcontrib:trycatch property="tried">
  343. <try>
  344. <antcall target="integration-test-${target-server}" />
  345. </try>
  346. <catch>
  347. <antcallback target="teamcity-escape" return="tried-escaped">
  348. <param name="returnTo" value="tried-escaped" />
  349. <param name="message" value="${tried}" />
  350. </antcallback>
  351. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
  352. </catch>
  353. </antcontrib:trycatch>
  354. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  355. </target>
  356. <target name="integration-test-get-lock">
  357. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
  358. </target>
  359. <target name="integration-test-release-lock">
  360. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
  361. </target>
  362. <!-- Remove demo.war -->
  363. <target name="integration-test-clean">
  364. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
  365. </target>
  366. </project>