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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <?xml version="1.0"?>
  2. <project xmlns:antcontrib="antlib:net.sf.antcontrib" 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-firefox11" />
  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. <!-- ssh host values -->
  21. <property name="ant.hub" value="${test.integration.antfile}" />
  22. <property name="user" value="${test.integration.user}" />
  23. <property name="passphrase" value="" />
  24. <!-- Upload war to deploy to ssh host -->
  25. <target name="integration-test-upload-demo">
  26. <scp file="${demo.war}" todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile="${sshkey.file}" passphrase="${passphrase}" />
  27. </target>
  28. <!-- Run basic integration test test -->
  29. <target name="integration-test-servlet">
  30. <fileset dir="integration-testscripts" id="html-test-files" includes="integration-test-${server-name}-servlet.html" />
  31. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  32. <subant target="run-tests" failonerror="false" antfile="test.xml">
  33. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
  34. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
  35. <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
  36. <property name="server.start.succeeded" value="1" />
  37. <property name="browsers" value="${test_browsers}" />
  38. <property name="testfiles" value="${testfiles}" />
  39. <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
  40. <property name="retries" value="0" />
  41. <fileset dir="." includes="test.xml" />
  42. </subant>
  43. </target>
  44. <target name="integration-test-theme">
  45. <subant target="run-tests" failonerror="false" antfile="test.xml">
  46. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
  47. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
  48. <property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
  49. <property name="server.start.succeeded" value="1" />
  50. <property name="testfiles" value="${testfiles-theme}" />
  51. <property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
  52. <fileset dir="." includes="test.xml" />
  53. </subant>
  54. </target>
  55. <!-- Run integration test on GAE -->
  56. <target name="integration-test-test-GAE">
  57. <fileset dir="integration-testscripts" id="html-test-files" includes="GoogleAppEngine/integration-test-GAE.html" />
  58. <pathconvert pathsep=" " property="test-GAE" refid="html-test-files" />
  59. <subant target="run-tests" failonerror="false" antfile="test.xml">
  60. <property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
  61. <property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
  62. <property name="com.vaadin.testbench.deployment.url" value="http://vaadin-integration-test.appspot.com/" />
  63. <property name="server.start.succeeded" value="1" />
  64. <property name="browsers" value="${test_browsers}" />
  65. <property name="testfiles" value="${test-GAE}" />
  66. <property name="test-output-dir" value="../build/integration-test-gae-output" />
  67. <fileset dir="." includes="test.xml" />
  68. </subant>
  69. </target>
  70. <target name="integration-test-deploy-to-GAE">
  71. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" />
  72. </target>
  73. <target name="integration-test-tomcat7">
  74. <antcall target="run-generic-integration-test">
  75. <param name="startDelay" value="10" />
  76. <param name="target-server" value="tomcat7" />
  77. </antcall>
  78. </target>
  79. <target name="integration-test-tomcat5">
  80. <antcall target="run-generic-integration-test">
  81. <param name="startDelay" value="10" />
  82. <param name="target-server" value="tomcat5" />
  83. </antcall>
  84. </target>
  85. <target name="integration-test-tomcat6">
  86. <antcall target="run-generic-integration-test">
  87. <param name="startDelay" value="10" />
  88. <param name="target-server" value="tomcat6" />
  89. </antcall>
  90. </target>
  91. <target name="integration-test-jetty5">
  92. <antcall target="run-generic-integration-test">
  93. <param name="target-server" value="jetty5" />
  94. </antcall>
  95. </target>
  96. <target name="integration-test-jetty6">
  97. <antcall target="run-generic-integration-test">
  98. <param name="target-server" value="jetty6" />
  99. </antcall>
  100. </target>
  101. <target name="integration-test-jetty7">
  102. <antcall target="run-generic-integration-test">
  103. <param name="target-server" value="jetty7" />
  104. </antcall>
  105. </target>
  106. <target name="integration-test-jetty8">
  107. <antcall target="run-generic-integration-test">
  108. <param name="startDelay" value="300" />
  109. <param name="target-server" value="jetty8" />
  110. </antcall>
  111. </target>
  112. <target name="integration-test-jboss4">
  113. <antcall target="run-generic-integration-test">
  114. <param name="startDelay" value="10" />
  115. <param name="target-server" value="jboss4" />
  116. </antcall>
  117. </target>
  118. <target name="integration-test-jboss5">
  119. <antcall target="run-generic-integration-test">
  120. <param name="startDelay" value="10" />
  121. <param name="target-server" value="jboss5" />
  122. </antcall>
  123. </target>
  124. <target name="integration-test-jboss6">
  125. <antcall target="run-generic-integration-test">
  126. <param name="startDelay" value="10" />
  127. <param name="target-server" value="jboss6" />
  128. </antcall>
  129. </target>
  130. <target name="integration-test-jboss7">
  131. <antcall target="run-generic-integration-test">
  132. <param name="startDelay" value="10" />
  133. <param name="target-server" value="jboss7" />
  134. </antcall>
  135. </target>
  136. <target name="integration-test-glassfish2">
  137. <antcall target="run-generic-integration-test">
  138. <param name="startDelay" value="10" />
  139. <param name="target-server" value="glassfish2" />
  140. </antcall>
  141. </target>
  142. <target name="integration-test-glassfish3">
  143. <antcall target="run-generic-integration-test">
  144. <param name="startDelay" value="10" />
  145. <param name="target-server" value="glassfish3" />
  146. </antcall>
  147. </target>
  148. <target name="integration-test-liferay6">
  149. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" />
  150. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  151. <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" />
  152. <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
  153. <antcall target="run-generic-integration-test">
  154. <param name="startDelay" value="600" />
  155. <param name="target-server" value="liferay6" />
  156. </antcall>
  157. </target>
  158. <target name="integration-test-liferay5">
  159. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-5/integration-test-liferay-5.2.3-portlet2.html" />
  160. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  161. <antcall target="run-generic-integration-test">
  162. <param name="startDelay" value="600" />
  163. <param name="target-server" value="liferay5" />
  164. </antcall>
  165. </target>
  166. <target name="integration-test-liferay6ee">
  167. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6EE/integration-test-liferay-6ee.html" />
  168. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  169. <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6EE/Liferay6EE-theme.html" />
  170. <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
  171. <antcall target="run-generic-integration-test">
  172. <param name="startDelay" value="600" />
  173. <param name="target-server" value="liferay6ee" />
  174. </antcall>
  175. </target>
  176. <target name="integration-test-gatein3">
  177. <fileset dir="integration-testscripts" id="html-test-files" includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" />
  178. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  179. <antcall target="run-generic-integration-test">
  180. <param name="startDelay" value="600" />
  181. <param name="test_browsers" value="winxp-googlechrome21" />
  182. <param name="target-server" value="gatein3" />
  183. </antcall>
  184. </target>
  185. <target name="integration-test-exo3">
  186. <fileset dir="integration-testscripts" id="html-test-files" includes="eXo-3/integration-test-eXo-3.0.3-portlet2.html" />
  187. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  188. <antcall target="run-generic-integration-test">
  189. <param name="startDelay" value="600" />
  190. <param name="test_browsers" value="winxp-googlechrome21" />
  191. <param name="target-server" value="exo3" />
  192. </antcall>
  193. </target>
  194. <target name="integration-test-websphere8">
  195. <antcall target="run-generic-integration-test">
  196. <param name="startDelay" value="600" />
  197. <param name="target-port" value="9080" />
  198. <param name="target-server" value="websphere8" />
  199. </antcall>
  200. </target>
  201. <target name="integration-test-weblogic10">
  202. <antcall target="run-generic-integration-test">
  203. <param name="startDelay" value="600" />
  204. <param name="target-port" value="7001" />
  205. <param name="target-server" value="weblogic10" />
  206. </antcall>
  207. </target>
  208. <target name="integration-test-weblogic12">
  209. <antcall target="run-generic-integration-test">
  210. <param name="startDelay" value="600" />
  211. <param name="target-port" value="7001" />
  212. <param name="target-server" value="weblogic12" />
  213. </antcall>
  214. </target>
  215. <target name="integration-test-weblogicPortal">
  216. <fileset dir="integration-testscripts" id="html-test-files" includes="weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html" />
  217. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  218. <antcall target="run-generic-integration-test">
  219. <param name="startDelay" value="600" />
  220. <param name="target-port" value="7001" />
  221. <param name="target-server" value="weblogicportal" />
  222. </antcall>
  223. </target>
  224. <target name="integration-test-GAE">
  225. <antcall target="integration-test-deploy-to-GAE" />
  226. <antcall target="integration-test-test-GAE" />
  227. </target>
  228. <!-- Upload demo, clean error screenshots and test deployment on all servers -->
  229. <target name="integration-test-all">
  230. <property name="passphrase" value="${passphrase}" />
  231. <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
  232. <fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
  233. <parallel>
  234. <antcontrib:trycatch property="tried">
  235. <try>
  236. <!-- Still running GAE test from the old server which requires its own lock -->
  237. <echo message="Getting lock" />
  238. <antcall target="integration-test-get-lock" />
  239. <echo message="Got lock" />
  240. <antcall target="integration-test-upload-demo" />
  241. <antcall target="run-integration-test">
  242. <param name="target-server" value="GAE" />
  243. </antcall>
  244. <antcall target="integration-test-clean" />
  245. <echo message="Getting lock" />
  246. <antcall target="integration-test-release-lock" />
  247. <echo message="Lock released" />
  248. </try>
  249. <catch>
  250. <echo message="Uploading of demo.war failed. ${tried}" />
  251. </catch>
  252. </antcontrib:trycatch>
  253. <antcall target="integration-test-liferay6" />
  254. <antcall target="integration-test-liferay6ee" />
  255. <antcall target="integration-test-exo3" />
  256. <antcall target="integration-test-weblogicPortal" />
  257. <antcall target="integration-test-liferay5" />
  258. <antcall target="integration-test-weblogic10" />
  259. <antcall target="integration-test-weblogic12" />
  260. <antcall target="integration-test-gatein3" />
  261. <antcall target="integration-test-glassfish2" />
  262. <antcall target="integration-test-glassfish3" />
  263. <antcall target="integration-test-jboss4" />
  264. <antcall target="integration-test-jboss5" />
  265. <antcall target="integration-test-jboss6" />
  266. <antcall target="integration-test-jboss7" />
  267. <antcall target="integration-test-jetty5" />
  268. <antcall target="integration-test-jetty6" />
  269. <antcall target="integration-test-jetty7" />
  270. <antcall target="integration-test-jetty8" />
  271. <antcall target="integration-test-tomcat5" />
  272. <antcall target="integration-test-tomcat6" />
  273. <antcall target="integration-test-tomcat7" />
  274. <antcall target="integration-test-websphere8" />
  275. </parallel>
  276. </target>
  277. <target name="do-run-generic-test">
  278. <property name="target-host" value="${target-server}.devnet.vaadin.com" />
  279. <property name="target-port" value="8080" />
  280. <antcontrib:if>
  281. <isset property="startDelay" />
  282. <then>
  283. <antcontrib:math result="sleepTime" datatype="int">
  284. <op op="rint">
  285. <op op="*">
  286. <num value="${startDelay}" />
  287. <op op="random" />
  288. </op>
  289. </op>
  290. </antcontrib:math>
  291. <echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo>
  292. <sleep seconds="${sleepTime}" />
  293. </then>
  294. </antcontrib:if>
  295. <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}">
  296. <fileset dir="integration_base_files">
  297. <include name="*" />
  298. </fileset>
  299. </scp>
  300. <!-- trycatch probably not needed any more as it just fails with the original message and doesn't do anything in the finally block -->
  301. <antcontrib:trycatch property="error_message">
  302. <try>
  303. <!-- timeout in one hour (remote end should timeout in 55 minutes) -->
  304. <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" />
  305. <antcall target="echo-prefix">
  306. <param name="prefix" value="${target-server}: " />
  307. <param name="message" value="${lock-output}" />
  308. </antcall>
  309. <scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
  310. <!-- timeout in 15 minutes -->
  311. <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" />
  312. <antcall target="echo-prefix">
  313. <param name="prefix" value="${target-server}: " />
  314. <param name="message" value="${start-output}" />
  315. </antcall>
  316. <fail message="${start-output}">
  317. <condition>
  318. <not>
  319. <contains string="${start-output}" substring="Demo deployed successfully" />
  320. </not>
  321. </condition>
  322. </fail>
  323. <copy file="integration-testscripts/common/integration_test.tpl" tofile="integration-testscripts/integration-test-${target-server}-servlet.html" overwrite="true" />
  324. <antcall target="integration-test-servlet">
  325. <param name="server-name" value="${target-server}" />
  326. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  327. </antcall>
  328. <!-- Run theme tests in all browsers if there's a property with the test files -->
  329. <antcontrib:if>
  330. <isset property="testfiles-theme" />
  331. <antcontrib:then>
  332. <antcall target="integration-test-theme">
  333. <param name="server-name" value="${target-server}" />
  334. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  335. </antcall>
  336. </antcontrib:then>
  337. </antcontrib:if>
  338. <!-- timeout in five minutes -->
  339. <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" />
  340. <antcall target="echo-prefix">
  341. <param name="prefix" value="${target-server}: " />
  342. <param name="message" value="${stop-output}" />
  343. </antcall>
  344. </try>
  345. <catch>
  346. <fail message="${error_message}" />
  347. </catch>
  348. </antcontrib:trycatch>
  349. </target>
  350. <target name="echo-prefix">
  351. <antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
  352. <echo message="${message-prefixed}" />
  353. </target>
  354. <target name="run-generic-integration-test">
  355. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  356. <antcontrib:trycatch property="tried">
  357. <try>
  358. <antcall target="do-run-generic-test" />
  359. </try>
  360. <catch>
  361. <antcontrib:antcallback target="teamcity-escape" return="tried-escaped">
  362. <param name="returnTo" value="tried-escaped" />
  363. <param name="message" value="${tried}" />
  364. </antcontrib:antcallback>
  365. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
  366. </catch>
  367. </antcontrib:trycatch>
  368. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  369. </target>
  370. <target name="teamcity-escape">
  371. <property name="returnTo" value="return" />
  372. <!-- Should also perform other escaping (\u0085, \u2028 and \u2029) - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
  373. <!-- Immutable properties -> needs to create a new one every time -->
  374. <antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
  375. <antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
  376. <antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />
  377. <property name="${returnTo}" value="${details-escaped3}" />
  378. </target>
  379. <target name="run-integration-test">
  380. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  381. <antcontrib:trycatch property="tried">
  382. <try>
  383. <antcall target="integration-test-${target-server}" />
  384. </try>
  385. <catch>
  386. <antcallback target="teamcity-escape" return="tried-escaped">
  387. <param name="returnTo" value="tried-escaped" />
  388. <param name="message" value="${tried}" />
  389. </antcallback>
  390. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
  391. </catch>
  392. </antcontrib:trycatch>
  393. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  394. </target>
  395. <target name="integration-test-get-lock">
  396. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
  397. </target>
  398. <target name="integration-test-release-lock">
  399. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
  400. </target>
  401. <!-- Remove demo.war -->
  402. <target name="integration-test-clean">
  403. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
  404. </target>
  405. </project>