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 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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="${vaadin.basedir}/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. <target name="run-tb3-servlet-test">
  39. <antcall target="run-tb3-test" inheritall="true">
  40. <param name="junit.test.suite" value="com.vaadin.tests.integration.ServletIntegrationTests" />
  41. </antcall>
  42. </target>
  43. <target name="run-tb3-test">
  44. <fail unless="server-name" message="Server name must be defined in server-name" />
  45. <fail unless="deployment.url" message="Deplyoment url must be defined in deployment.url" />
  46. <fail unless="com.vaadin.testbench.screenshot.directory" message="Screenshot directory must be defined in com.vaadin.testbench.screenshot.directory" />
  47. <property name="server.report.dir" location="${report.dir}/integration-test-tb3/${server-name}" />
  48. <!-- The junit task does not create the report dir... -->
  49. <mkdir dir="${server.report.dir}" />
  50. <junit showoutput="no" printsummary="no" fork="yes">
  51. <formatter type="xml" />
  52. <classpath refid="classpath.tb3" />
  53. <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
  54. <jvmarg value="-Ddeployment.url=${deployment.url}" />
  55. <jvmarg value="-Dserver-name=${server-name}" />
  56. <jvmarg value="-Djava.awt.headless=true" />
  57. <jvmarg value="-Ddemo.war=${demo.war}" />
  58. <jvmarg value="-Dvaadin.testbench.developer.license=${vaadin.testbench.developer.license}" />
  59. <test name="${junit.test.suite}" todir="${server.report.dir}" />
  60. </junit>
  61. </target>
  62. <target name="integration-test-tomcat7">
  63. <antcall target="run-generic-integration-test">
  64. <param name="startDelay" value="10" />
  65. <param name="target-server" value="tomcat7" />
  66. </antcall>
  67. </target>
  68. <target name="integration-test-tomcat7apacheproxy">
  69. <antcall target="run-generic-integration-test">
  70. <param name="startDelay" value="10" />
  71. <param name="target-server" value="tomcat7apacheproxy" />
  72. </antcall>
  73. </target>
  74. <target name="integration-test-tomcat8">
  75. <antcall target="run-generic-integration-test">
  76. <param name="startDelay" value="10" />
  77. <param name="target-server" value="tomcat8" />
  78. </antcall>
  79. </target>
  80. <target name="integration-test-jetty8">
  81. <antcall target="run-generic-integration-test">
  82. <param name="startDelay" value="90" />
  83. <param name="target-server" value="jetty8" />
  84. </antcall>
  85. </target>
  86. <target name="integration-test-jetty9">
  87. <antcall target="run-generic-integration-test">
  88. <param name="startDelay" value="90" />
  89. <param name="target-server" value="jetty9" />
  90. </antcall>
  91. </target>
  92. <target name="integration-test-jboss-eap6">
  93. <antcall target="run-generic-integration-test">
  94. <param name="startDelay" value="10" />
  95. <param name="target-server" value="jbosseap6" />
  96. <param name="demo.war" value="${demo.jboss6.war}"/>
  97. </antcall>
  98. </target>
  99. <target name="integration-test-wildfly8">
  100. <antcall target="run-generic-integration-test">
  101. <param name="startDelay" value="10" />
  102. <param name="target-server" value="wildfly8" />
  103. </antcall>
  104. </target>
  105. <target name="integration-test-wildfly9">
  106. <antcall target="run-generic-integration-test">
  107. <param name="startDelay" value="10" />
  108. <param name="target-server" value="wildfly9" />
  109. </antcall>
  110. </target>
  111. <target name="integration-test-wildfly10">
  112. <antcall target="run-generic-integration-test">
  113. <param name="startDelay" value="10" />
  114. <param name="target-server" value="wildfly10" />
  115. </antcall>
  116. </target>
  117. <target name="integration-test-wildfly9-nginx">
  118. <antcall target="run-generic-integration-test">
  119. <param name="startDelay" value="10" />
  120. <param name="target-server" value="wildfly9-nginx" />
  121. <param name="target-port" value="80" />
  122. </antcall>
  123. </target>
  124. <target name="integration-test-glassfish4">
  125. <antcall target="run-generic-integration-test">
  126. <param name="startDelay" value="10" />
  127. <param name="target-server" value="glassfish4" />
  128. </antcall>
  129. </target>
  130. <target name="integration-test-payara">
  131. <antcall target="run-generic-integration-test">
  132. <param name="startDelay" value="10" />
  133. <param name="target-server" value="payara" />
  134. </antcall>
  135. </target>
  136. <target name="integration-test-weblogic12">
  137. <antcall target="run-generic-integration-test">
  138. <param name="startDelay" value="60" />
  139. <param name="target-port" value="7001" />
  140. <param name="target-server" value="weblogic12" />
  141. </antcall>
  142. </target>
  143. <!-- Upload demo, clean error screenshots and test deployment on all
  144. servers -->
  145. <target name="integration-test-all" unless="tests.integration.skip">
  146. <property name="passphrase" value="${passphrase}" />
  147. <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
  148. <fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
  149. <delete dir="${report.dir}" />
  150. <mkdir dir="${report.dir}" />
  151. <parallel>
  152. <antcall target="integration-test-weblogic12" />
  153. <antcall target="integration-test-glassfish4" />
  154. <antcall target="integration-test-payara" />
  155. <antcall target="integration-test-jboss-eap6" />
  156. <antcall target="integration-test-wildfly8" />
  157. <antcall target="integration-test-wildfly9" />
  158. <antcall target="integration-test-wildfly10" />
  159. <antcall target="integration-test-jetty8" />
  160. <antcall target="integration-test-jetty9" />
  161. <antcall target="integration-test-tomcat7" />
  162. <antcall target="integration-test-tomcat8" />
  163. <antcall target="integration-test-tomcat7apacheproxy" />
  164. </parallel>
  165. </target>
  166. <target name="do-run-generic-test">
  167. <property name="target-host" value="${target-server}.devnet.vaadin.com" />
  168. <property name="target-port" value="8080" />
  169. <antcontrib:if>
  170. <isset property="startDelay" />
  171. <then>
  172. <echo>Delaying startup of ${target-server} with ${startDelay} seconds</echo>
  173. <sleep seconds="${startDelay}" />
  174. </then>
  175. </antcontrib:if>
  176. <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}">
  177. <fileset dir="integration_base_files">
  178. <include name="*" />
  179. </fileset>
  180. </scp>
  181. <!-- trycatch probably not needed any more as it just fails with
  182. the original message and doesn't do anything in the finally block -->
  183. <antcontrib:trycatch property="error_message">
  184. <try>
  185. <!-- timeout in one hour (remote end should timeout in 55
  186. minutes) -->
  187. <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" />
  188. <antcall target="echo-prefix">
  189. <param name="prefix" value="${target-server}: " />
  190. <param name="message" value="${lock-output}" />
  191. </antcall>
  192. <scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
  193. <!-- timeout in 15 minutes -->
  194. <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" />
  195. <antcall target="echo-prefix">
  196. <param name="prefix" value="${target-server}: " />
  197. <param name="message" value="${start-output}" />
  198. </antcall>
  199. <fail message="${start-output}">
  200. <condition>
  201. <not>
  202. <contains string="${start-output}" substring="Demo deployed successfully" />
  203. </not>
  204. </condition>
  205. </fail>
  206. <echo>Starting TB3 test for ${target-server}</echo>
  207. <antcall target="run-tb3-servlet-test">
  208. <param name="server-name" value="${target-server}" />
  209. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  210. </antcall>
  211. <!-- timeout in five minutes -->
  212. <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" />
  213. <antcall target="echo-prefix">
  214. <param name="prefix" value="${target-server}: " />
  215. <param name="message" value="${stop-output}" />
  216. </antcall>
  217. </try>
  218. <catch>
  219. <fail message="${error_message}" />
  220. </catch>
  221. </antcontrib:trycatch>
  222. </target>
  223. <target name="echo-prefix">
  224. <antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
  225. <echo message="${message-prefixed}" />
  226. </target>
  227. <target name="run-generic-integration-test">
  228. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  229. <antcontrib:trycatch property="tried">
  230. <try>
  231. <antcall target="do-run-generic-test" />
  232. </try>
  233. <catch>
  234. <antcontrib:antcallback target="teamcity-escape" return="tried-escaped">
  235. <param name="returnTo" value="tried-escaped" />
  236. <param name="message" value="${tried}" />
  237. </antcontrib:antcallback>
  238. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
  239. </catch>
  240. </antcontrib:trycatch>
  241. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  242. </target>
  243. <target name="teamcity-escape">
  244. <property name="returnTo" value="return" />
  245. <!-- Should also perform other escaping (\u0085, \u2028 and \u2029)
  246. - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
  247. <!-- Immutable properties -> needs to create a new one every time -->
  248. <antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
  249. <antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
  250. <antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />
  251. <property name="${returnTo}" value="${details-escaped3}" />
  252. </target>
  253. <target name="run-integration-test">
  254. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  255. <antcontrib:trycatch property="tried">
  256. <try>
  257. <antcall target="integration-test-${target-server}" />
  258. </try>
  259. <catch>
  260. <antcallback target="teamcity-escape" return="tried-escaped">
  261. <param name="returnTo" value="tried-escaped" />
  262. <param name="message" value="${tried}" />
  263. </antcallback>
  264. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
  265. </catch>
  266. </antcontrib:trycatch>
  267. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  268. </target>
  269. <target name="integration-test-get-lock">
  270. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
  271. </target>
  272. <target name="integration-test-release-lock">
  273. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
  274. </target>
  275. <!-- Remove demo.war -->
  276. <target name="integration-test-clean">
  277. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
  278. </target>
  279. </project>