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

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