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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  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-tomcat6">
  115. <antcall target="run-generic-integration-test">
  116. <param name="startDelay" value="10" />
  117. <param name="target-server" value="tomcat6" />
  118. </antcall>
  119. </target>
  120. <target name="integration-test-jetty7">
  121. <antcall target="run-generic-integration-test">
  122. <param name="target-server" value="jetty7" />
  123. </antcall>
  124. </target>
  125. <target name="integration-test-jetty8">
  126. <antcall target="run-generic-integration-test">
  127. <param name="startDelay" value="300" />
  128. <param name="target-server" value="jetty8" />
  129. </antcall>
  130. </target>
  131. <target name="integration-test-jetty9">
  132. <antcall target="run-generic-integration-test">
  133. <param name="startDelay" value="300" />
  134. <param name="target-server" value="jetty9" />
  135. </antcall>
  136. </target>
  137. <target name="integration-test-jboss4">
  138. <antcall target="run-generic-integration-test">
  139. <param name="startDelay" value="10" />
  140. <param name="target-server" value="jboss4" />
  141. </antcall>
  142. </target>
  143. <target name="integration-test-jboss5">
  144. <antcall target="run-generic-integration-test">
  145. <param name="startDelay" value="10" />
  146. <param name="target-server" value="jboss5" />
  147. </antcall>
  148. </target>
  149. <target name="integration-test-jboss6">
  150. <antcall target="run-generic-integration-test">
  151. <param name="startDelay" value="10" />
  152. <param name="target-server" value="jboss6" />
  153. </antcall>
  154. </target>
  155. <target name="integration-test-jboss7">
  156. <antcall target="run-generic-integration-test">
  157. <param name="startDelay" value="10" />
  158. <param name="target-server" value="jboss7" />
  159. </antcall>
  160. </target>
  161. <target name="integration-test-jboss-eap6">
  162. <antcall target="run-generic-integration-test">
  163. <param name="startDelay" value="10" />
  164. <param name="target-server" value="jbosseap6" />
  165. </antcall>
  166. </target>
  167. <target name="integration-test-wildfly8">
  168. <antcall target="run-generic-integration-test">
  169. <param name="startDelay" value="10" />
  170. <param name="target-server" value="wildfly8" />
  171. </antcall>
  172. </target>
  173. <target name="integration-test-wildfly9">
  174. <antcall target="run-generic-integration-test">
  175. <param name="startDelay" value="10" />
  176. <param name="target-server" value="wildfly9" />
  177. </antcall>
  178. </target>
  179. <target name="integration-test-wildfly10">
  180. <antcall target="run-generic-integration-test">
  181. <param name="startDelay" value="10" />
  182. <param name="target-server" value="wildfly10" />
  183. </antcall>
  184. </target>
  185. <target name="integration-test-wildfly9-nginx">
  186. <antcall target="run-generic-integration-test">
  187. <param name="startDelay" value="10" />
  188. <param name="target-server" value="wildfly9-nginx" />
  189. <param name="target-port" value="80" />
  190. </antcall>
  191. </target>
  192. <target name="integration-test-glassfish3">
  193. <antcall target="run-generic-integration-test">
  194. <param name="startDelay" value="10" />
  195. <param name="target-server" value="glassfish3" />
  196. </antcall>
  197. </target>
  198. <target name="integration-test-glassfish4">
  199. <antcall target="run-generic-integration-test">
  200. <param name="startDelay" value="10" />
  201. <param name="target-server" value="glassfish4" />
  202. </antcall>
  203. </target>
  204. <target name="integration-test-payara">
  205. <antcall target="run-generic-integration-test">
  206. <param name="startDelay" value="10" />
  207. <param name="target-server" value="payara" />
  208. </antcall>
  209. </target>
  210. <target name="integration-test-liferay6">
  211. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" />
  212. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  213. <antcall target="run-generic-integration-test">
  214. <param name="startDelay" value="600" />
  215. <param name="test_browsers" value="winxp-firefox17-esr" />
  216. <param name="target-server" value="liferay6" />
  217. </antcall>
  218. </target>
  219. <target name="integration-test-liferay6-theme">
  220. <fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" />
  221. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  222. <fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" />
  223. <pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
  224. <antcall target="run-generic-integration-test">
  225. <param name="startDelay" value="600" />
  226. <param name="test_browsers" value="winxp-firefox17-esr" />
  227. <param name="target-server" value="liferay6" />
  228. </antcall>
  229. </target>
  230. <target name="integration-test-websphere8">
  231. <antcall target="run-generic-integration-test">
  232. <param name="startDelay" value="600" />
  233. <param name="target-port" value="9080" />
  234. <param name="target-server" value="websphere8" />
  235. </antcall>
  236. </target>
  237. <target name="integration-test-websphereportal8">
  238. <concat>##teamcity[testStarted name='websphereportal8' flowId='websphereportal8']</concat>
  239. <antcall target="run-tb3-test" inheritall="true">
  240. <param name="junit.test.suite" value="com.vaadin.tests.integration.WebSpherePortalIntegrationTest" />
  241. <param name="server-name" value="websphereportal8" />
  242. <!-- Fill out dummy values for params required by run-tb3-test target -->
  243. <param name="test.integration.server" value="" />
  244. <param name="test.integration.user" value="" />
  245. <param name="test.integration.antfile" value="" />
  246. </antcall>
  247. <concat>##teamcity[testFinished name='websphereportal8' flowId='websphereportal8']"</concat>
  248. </target>
  249. <target name="integration-test-weblogic10">
  250. <antcall target="run-generic-integration-test">
  251. <param name="startDelay" value="600" />
  252. <param name="target-port" value="7001" />
  253. <param name="target-server" value="weblogic10" />
  254. </antcall>
  255. </target>
  256. <target name="integration-test-weblogic12">
  257. <antcall target="run-generic-integration-test">
  258. <param name="startDelay" value="600" />
  259. <param name="target-port" value="7001" />
  260. <param name="target-server" value="weblogic12" />
  261. </antcall>
  262. </target>
  263. <target name="integration-test-weblogicPortal">
  264. <fileset dir="integration-testscripts" id="html-test-files" includes="weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html" />
  265. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  266. <antcall target="run-generic-integration-test">
  267. <param name="startDelay" value="600" />
  268. <param name="target-port" value="7001" />
  269. <param name="target-server" value="weblogicportal" />
  270. </antcall>
  271. </target>
  272. <!-- Upload demo, clean error screenshots and test deployment on all
  273. servers -->
  274. <target name="integration-test-all" unless="tests.integration.skip">
  275. <property name="passphrase" value="${passphrase}" />
  276. <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
  277. <fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
  278. <delete dir="${report.dir}" />
  279. <mkdir dir="${report.dir}" />
  280. <parallel>
  281. <antcall target="integration-test-liferay6" />
  282. <antcall target="integration-test-liferay6-theme" />
  283. <antcall target="integration-test-weblogicPortal" />
  284. <antcall target="integration-test-weblogic10" />
  285. <antcall target="integration-test-weblogic12" />
  286. <antcall target="integration-test-glassfish3" />
  287. <antcall target="integration-test-glassfish4" />
  288. <antcall target="integration-test-payara" />
  289. <antcall target="integration-test-jboss4" />
  290. <antcall target="integration-test-jboss5" />
  291. <antcall target="integration-test-jboss6" />
  292. <antcall target="integration-test-jboss7" />
  293. <antcall target="integration-test-jboss-eap6" />
  294. <antcall target="integration-test-wildfly8" />
  295. <antcall target="integration-test-wildfly9" />
  296. <antcall target="integration-test-wildfly10" />
  297. <antcall target="integration-test-jetty7" />
  298. <antcall target="integration-test-jetty8" />
  299. <antcall target="integration-test-jetty9" />
  300. <antcall target="integration-test-tomcat6" />
  301. <antcall target="integration-test-tomcat7" />
  302. <antcall target="integration-test-tomcat8" />
  303. <antcall target="integration-test-osgi" />
  304. <antcall target="integration-test-tomcat7apacheproxy" />
  305. <antcall target="integration-test-websphere8" />
  306. </parallel>
  307. </target>
  308. <target name="do-run-generic-test">
  309. <property name="target-host" value="${target-server}.devnet.vaadin.com" />
  310. <property name="target-port" value="8080" />
  311. <antcontrib:if>
  312. <isset property="startDelay" />
  313. <then>
  314. <antcontrib:math result="sleepTime" datatype="int">
  315. <op op="rint">
  316. <op op="*">
  317. <num value="${startDelay}" />
  318. <op op="random" />
  319. </op>
  320. </op>
  321. </antcontrib:math>
  322. <echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo>
  323. <sleep seconds="${sleepTime}" />
  324. </then>
  325. </antcontrib:if>
  326. <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}">
  327. <fileset dir="integration_base_files">
  328. <include name="*" />
  329. </fileset>
  330. </scp>
  331. <!-- trycatch probably not needed any more as it just fails with
  332. the original message and doesn't do anything in the finally block -->
  333. <antcontrib:trycatch property="error_message">
  334. <try>
  335. <!-- timeout in one hour (remote end should timeout in 55
  336. minutes) -->
  337. <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" />
  338. <antcall target="echo-prefix">
  339. <param name="prefix" value="${target-server}: " />
  340. <param name="message" value="${lock-output}" />
  341. </antcall>
  342. <scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
  343. <!-- timeout in 15 minutes -->
  344. <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" />
  345. <antcall target="echo-prefix">
  346. <param name="prefix" value="${target-server}: " />
  347. <param name="message" value="${start-output}" />
  348. </antcall>
  349. <fail message="${start-output}">
  350. <condition>
  351. <not>
  352. <contains string="${start-output}" substring="Demo deployed successfully" />
  353. </not>
  354. </condition>
  355. </fail>
  356. <antcontrib:if>
  357. <isset property="testfiles" />
  358. <antcontrib:then>
  359. <echo>Starting legacy (TB2) test for ${target-server}</echo>
  360. <antcall target="legacy-integration-test">
  361. <param name="server-name" value="${target-server}" />
  362. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  363. </antcall>
  364. </antcontrib:then>
  365. <antcontrib:else>
  366. <echo>Starting TB3 test for ${target-server}</echo>
  367. <antcall target="run-tb3-servlet-test">
  368. <param name="server-name" value="${target-server}" />
  369. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  370. </antcall>
  371. </antcontrib:else>
  372. </antcontrib:if>
  373. <!-- Run theme tests in all browsers if there's a property
  374. with the test files -->
  375. <antcontrib:if>
  376. <isset property="testfiles-theme" />
  377. <antcontrib:then>
  378. <antcall target="integration-test-theme">
  379. <param name="server-name" value="${target-server}" />
  380. <param name="deployment.url" value="http://${target-host}:${target-port}" />
  381. </antcall>
  382. </antcontrib:then>
  383. </antcontrib:if>
  384. <!-- timeout in five minutes -->
  385. <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" />
  386. <antcall target="echo-prefix">
  387. <param name="prefix" value="${target-server}: " />
  388. <param name="message" value="${stop-output}" />
  389. </antcall>
  390. </try>
  391. <catch>
  392. <fail message="${error_message}" />
  393. </catch>
  394. </antcontrib:trycatch>
  395. </target>
  396. <target name="echo-prefix">
  397. <antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
  398. <echo message="${message-prefixed}" />
  399. </target>
  400. <target name="run-generic-integration-test">
  401. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  402. <antcontrib:trycatch property="tried">
  403. <try>
  404. <antcall target="do-run-generic-test" />
  405. </try>
  406. <catch>
  407. <antcontrib:antcallback target="teamcity-escape" return="tried-escaped">
  408. <param name="returnTo" value="tried-escaped" />
  409. <param name="message" value="${tried}" />
  410. </antcontrib:antcallback>
  411. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
  412. </catch>
  413. </antcontrib:trycatch>
  414. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  415. </target>
  416. <target name="teamcity-escape">
  417. <property name="returnTo" value="return" />
  418. <!-- Should also perform other escaping (\u0085, \u2028 and \u2029)
  419. - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
  420. <!-- Immutable properties -> needs to create a new one every time -->
  421. <antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
  422. <antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
  423. <antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />
  424. <property name="${returnTo}" value="${details-escaped3}" />
  425. </target>
  426. <target name="run-integration-test">
  427. <concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
  428. <antcontrib:trycatch property="tried">
  429. <try>
  430. <antcall target="integration-test-${target-server}" />
  431. </try>
  432. <catch>
  433. <antcallback target="teamcity-escape" return="tried-escaped">
  434. <param name="returnTo" value="tried-escaped" />
  435. <param name="message" value="${tried}" />
  436. </antcallback>
  437. <concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
  438. </catch>
  439. </antcontrib:trycatch>
  440. <concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
  441. </target>
  442. <target name="integration-test-get-lock">
  443. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
  444. </target>
  445. <target name="integration-test-release-lock">
  446. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
  447. </target>
  448. <!-- Remove demo.war -->
  449. <target name="integration-test-clean">
  450. <sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
  451. </target>
  452. </project>