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

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