Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

test.xml 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?xml version="1.0"?>
  2. <project xmlns:antcontrib="antlib:net.sf.antcontrib"
  3. xmlns:ivy="antlib:org.apache.ivy.ant"
  4. name="Run Vaadin Testbench Tests" basedir="." default="run-and-clean-up">
  5. <property name="project.root" value=".."/>
  6. <!-- Import common targets -->
  7. <import file="../build/common.xml" />
  8. <!-- ================================================================== -->
  9. <!-- Configuration -->
  10. <!-- ================================================================== -->
  11. <!-- Browsers to use for testing -->
  12. <property name="browsers-windows" value="winxp-ie8,win7-ie9,winxp-firefox12,winxp-safari5,winxp-googlechrome21,winxp-opera11" />
  13. <property name="browsers-linux" value="linux-firefox3,linux-opera10,linux-googlechrome8" />
  14. <property name="browsers-mac" value="osx-firefox3,osx-opera10,osx-googlechrome8,osx-safari4,osx-safari5" />
  15. <property name="browsers" value="${browsers-windows}" />
  16. <!-- Number of times to retry a test if it fails -->
  17. <property name="retries" value="2" />
  18. <!-- Screen shot base directory -->
  19. <fail unless="com.vaadin.testbench.screenshot.directory" message="The 'com.vaadin.testbench.screenshot.directory' property must be defined." />
  20. <!-- Screen shot resolution -->
  21. <property name="com.vaadin.testbench.screenshot.resolution" value="1500x850" />
  22. <!-- Host running Testbench Hub -->
  23. <property name="com.vaadin.testbench.tester.host" value="testbench-hub.intra.itmill.com" />
  24. <property name="com.vaadin.testbench.screenshot.block.error" value="0.025"/>
  25. <property name="com.vaadin.testbench.debug" value="false"/>
  26. <!-- Temporary output directory, created and removed by this script -->
  27. <fail unless="test-output-dir" message="The 'test-output-dir' property must be defined." />
  28. <property name="class-dir" value="${test-output-dir}/classes" />
  29. <target name="initialize" depends="common.init-deps">
  30. <ivy:resolve conf="emma"/>
  31. <ivy:cachepath pathid="emma.lib" conf="emma" />
  32. <!-- classpath must include test bench jar and its dependencies -->
  33. <path id="classpath">
  34. <fileset dir="${com.vaadin.testbench.lib.dir}" includes="**/*.jar" />
  35. <path refid="emma.lib" />
  36. </path>
  37. </target>
  38. <!-- fileset containing all TestBench tests to run -->
  39. <fileset dir=".." id="html-test-files">
  40. <include name="tests/**/**.html" />
  41. <include name="testbench/com/vaadin/tests/**/**.html" />
  42. <exclude name="tests/integration-testscripts/**" />
  43. </fileset>
  44. <!-- This target converts HTML tests files to java junit tests. One test file for each browser is created. -->
  45. <target name="create-tests" depends="initialize, remove-temp-testclasses">
  46. <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
  47. <java classname="com.vaadin.testbench.util.TestConverter" classpathref="classpath" fork="true">
  48. <sysproperty key="com.vaadin.testbench.test.retries" value="${retries}" />
  49. <jvmarg value="-Duser.language=en"/>
  50. <jvmarg value="-Duser.country=US"/>
  51. <arg value="${test-output-dir}" />
  52. <arg value="${browsers}" />
  53. <arg line="${testfiles}" />
  54. </java>
  55. </target>
  56. <!-- This target complies the generated java junit tests. -->
  57. <target name="compile-tests" depends="create-tests">
  58. <mkdir dir="${class-dir}" />
  59. <javac includeantruntime="false" srcdir="${test-output-dir}" destdir="${class-dir}" debug="on" fork="yes" failonerror="false" encoding="UTF8">
  60. <classpath>
  61. <path refid="classpath" />
  62. </classpath>
  63. </javac>
  64. </target>
  65. <!-- ================================================================== -->
  66. <!-- Running Tests -->
  67. <!-- ================================================================== -->
  68. <target name="check-parameters">
  69. <fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined." />
  70. <fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined." />
  71. <fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined." />
  72. </target>
  73. <target name="run-tests" depends="compile-tests">
  74. <fileset dir="${test-output-dir}" id="tests-fileset">
  75. <include name="**/**.java" />
  76. </fileset>
  77. <antcontrib:for threadCount="30" parallel="true" keepgoing="true" param="target">
  78. <path>
  79. <fileset refid="tests-fileset" />
  80. </path>
  81. <sequential>
  82. <antcall target="execute-tests">
  83. <param name="target" value="@{target}" />
  84. <reference refid="classpath" />
  85. </antcall>
  86. </sequential>
  87. </antcontrib:for>
  88. </target>
  89. <!-- This target runs the generated and compiled junit tests -->
  90. <target name="execute-tests">
  91. <junit fork="yes" printsummary="withOutAndErr" maxmemory="96m">
  92. <classpath>
  93. <path refid="classpath" />
  94. <pathelement path="${class-dir}" />
  95. </classpath>
  96. <formatter usefile="false" type="plain"/>
  97. <jvmarg value="-Dcom.vaadin.testbench.tester.host=${com.vaadin.testbench.tester.host}" />
  98. <jvmarg value="-Dcom.vaadin.testbench.deployment.url=${com.vaadin.testbench.deployment.url}" />
  99. <!-- Define where the reference screenshots and diff files are saved -->
  100. <jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
  101. <!-- Resolution for screenshots -->
  102. <jvmarg value="-Dcom.vaadin.testbench.screenshot.resolution=${com.vaadin.testbench.screenshot.resolution}" />
  103. <jvmarg value="-Dcom.vaadin.testbench.debug=${com.vaadin.testbench.debug}" />
  104. <jvmarg value="-Dcom.vaadin.testbench.screenshot.block.error=${com.vaadin.testbench.screenshot.block.error}" />
  105. <jvmarg value="-Djava.awt.headless=true" />
  106. <!-- true/false system arguments -->
  107. <jvmarg value="-Dcom.vaadin.testbench.screenshot.softfail=${com.vaadin.testbench.screenshot.softfail}" />
  108. <jvmarg value="-Dcom.vaadin.testbench.screenshot.reference.debug=${com.vaadin.testbench.screenshot.reference.debug}" />
  109. <jvmarg value="-Dcom.vaadin.testbench.screenshot.cursor=${com.vaadin.testbench.screenshot.cursor}" />
  110. <batchtest>
  111. <filelist dir="${test-output-dir}" files="${target}" />
  112. </batchtest>
  113. </junit>
  114. </target>
  115. <!-- Remove temporary source and compiled java files -->
  116. <target name="remove-temp-testclasses">
  117. <delete failonerror="false">
  118. <fileset dir="${test-output-dir}">
  119. <include name="**/**.java" />
  120. <include name="**/**.class" />
  121. </fileset>
  122. </delete>
  123. </target>
  124. <!-- Remove old error screenshots -->
  125. <target name="remove-error-screens">
  126. <mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" />
  127. <delete>
  128. <fileset dir="${com.vaadin.testbench.screenshot.directory}/errors">
  129. <include name="**/**.*" />
  130. </fileset>
  131. </delete>
  132. </target>
  133. <!-- ================================================================== -->
  134. <!-- Main Targets -->
  135. <!-- ================================================================== -->
  136. <!-- The default target. -->
  137. <target name="run-and-clean-up" depends="check-parameters,remove-error-screens,run-tests" />
  138. <!-- Also starts the server. -->
  139. <target name="test-package">
  140. <parallel>
  141. <daemons>
  142. <ant antfile="vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
  143. </daemons>
  144. <sequential>
  145. <ant antfile="vaadin-server.xml" target="wait-for-startup" />
  146. <antcall inheritall="true" inheritrefs="true" target="run-and-clean-up" />
  147. <move file="${testing.testarea}/${package.name}/war.ec" todir="../build/result" failonerror="false" />
  148. </sequential>
  149. </parallel>
  150. </target>
  151. </project>