Adding the pluginbuilder files that are used in the nightly build process.
[phpeclipse.git] / utilities / pluginbuilder / build-files / automatedTests / run-tests.xml
1 <project name="Run automated Tests" default="run" basedir=".">\r
2         <taskdef resource="org/pluginbuilder/anttasks/pluginbuildertasks.properties" classpath="../pluginbuilder-anttasks.jar" />\r
3 \r
4         <property file="../../build_local.properties" />\r
5         <property file="run-tests.properties" />\r
6 \r
7         <import file="../build_shared.xml" />\r
8 \r
9         <target name="-init">\r
10                 <antcall target="-purgeTestEclipseHost" />\r
11                 <property name="eclipse.installation.dir" value="${test.eclipse.base}/eclipse" />\r
12                 <property name="eclipse.local.tar.non.server" value="${test.eclipse.zip}" />\r
13                 <antcall target="-installTestEclipseHost" />\r
14         </target>\r
15 \r
16         <target name="-purgeTestEclipseHost">\r
17                 <delete dir="${test.eclipse.base}" failOnError="false" />\r
18         </target>\r
19 \r
20         <target name="-installTestEclipseHost" description="Install Eclipse and all required plug-ins for testing" unless="isEclipseInstallationAvailable">\r
21                 <echo message="Installing plug-ins for testing" />\r
22                 \r
23                 <unzip dest="${test.eclipse.base}">\r
24                         <fileset dir="." includes="eclipse-test-framework*.zip" />\r
25                 </unzip>\r
26                 <unzip dest="${test.eclipse.host}">\r
27                         <fileset dir="." includes="org.pluginbuilder.autotestsuite*.zip" />\r
28                 </unzip>\r
29                 <condition property="buildResultZipDest" value="${test.eclipse.base}" else="${test.eclipse.host}">\r
30                         <equals arg1="${archivePrefix}" arg2="eclipse" />\r
31                 </condition>\r
32                 <unzip dest="${buildResultZipDest}">\r
33                         <fileset dir="${buildDirectory}" includes="${buildType}-**/*.zip" excludes="**/${archiveNamePrefix}-*"/>\r
34                 </unzip>\r
35                 <!-- unpack eclipse after the features because there might be product features extracted which contain a config.ini -->\r
36                 <antcall target="unpack.eclipse">\r
37                         <param name="unpack.eclipse" value="true"/>\r
38                 </antcall>\r
39         </target>\r
40 \r
41 \r
42         <!-- Example target which demonstrates how to run a test suite with the Eclipse test fwk.\r
43                 Note that it is not needed if you use the autotestsuite\r
44         \r
45         <target name="-runTestSuite" description="Should be called from allTests.xml only">\r
46                 <ant target="ui-test" antfile="${test.library.xml}" dir="${test.eclipse.host}">\r
47                         <comment use -clean because plug-ins have been unzipped into the eclipse folder comment>\r
48                         <property name="data-dir" value="${test.workspace} -clean" />\r
49                 <property name="plugin-name" value="<your plugin id>" />\r
50                 <property name="classname" value="<the class which defines the suite>" />\r
51                         <property name="eclipse-home" value="${test.eclipse.host}" />\r
52                 </ant>\r
53         </target>\r
54         \r
55         <target name="run" depends="-init,-runTestSuite" description="Run manually defined tests and create a report.">\r
56                 <delete dir="${test.result.dir}" />\r
57                 <mkdir dir="${test.result.dir}/xml" />\r
58                 <comment collect creates an aggregated report file in ${test.eclipse.host} comment>\r
59                 <ant target="collect" antfile="${test.library.xml}" dir="${test.eclipse.host}">\r
60                         <property name="includes" value="*.xml" />\r
61                         <property name="output-file" value="${test.aggregated.report}" />\r
62                 </ant>\r
63                 <copy file="${test.eclipse.host}/${test.aggregated.report}" todir="${test.result.dir}/xml" />\r
64                 <style style="${basedir}/JUNIT.XSL" basedir="${test.result.dir}/xml" destdir="${test.result.dir}/html" />\r
65 \r
66         </target>\r
67         -->\r
68         \r
69         <target name="run" depends="-init,-runAutoTests" description="Run all tests using the autotestsuite and create xml and html reports.">\r
70 \r
71                 <junitreport todir="${test.result.dir}/xml" tofile="${test.aggregated.report}">\r
72                         <fileset dir="${test.result.dir}/xml">\r
73                                 <include name="*.xml" />\r
74                         </fileset>\r
75                 </junitreport>\r
76 \r
77                 <BundleFileLocator eclipseInstallationRoot="${test.eclipse.host}" bundleId="org.pluginbuilder.autotestsuite.application" filePath="JUNIT.XSL" property="junit.xsl.file" />\r
78 \r
79                 <style style="${junit.xsl.file}" basedir="${test.result.dir}/xml" includes="${test.aggregated.report}" destdir="${test.result.dir}/html" />\r
80         </target>\r
81 \r
82         <target name="-runAutoTests">\r
83                 <mkdir dir="${test.result.dir}/xml"/>\r
84                 <java fork="true" dir="." logError="true" classname="org.eclipse.core.launcher.Main">\r
85                         <classpath>\r
86                                 <fileset dir="${test.eclipse.host}/plugins">\r
87                                         <include name="org.eclipse.equinox.launcher_*.jar" />\r
88                                 </fileset>\r
89                         </classpath>\r
90                         <arg line="-application org.pluginbuilder.autotestsuite.application.autotestapplication" />\r
91                         <arg line="-data ${test.workspace}" />\r
92                         <arg line="-os ${os}" />\r
93                         <arg line="-ws ${ws}" />\r
94                         <arg line="-arch ${arch}" />\r
95                         <arg line="-consolelog" />\r
96 \r
97                         <sysproperty key="autotestsuite.results.directory" value="${test.result.dir}/xml" />\r
98                         <sysproperty key="autotest.debug" value="${autotestsuite.trace}" />\r
99                         <sysproperty key="autotestsuite.plugin.inclusions" value="${autotestsuite.plugin.inclusions}" />\r
100                         <sysproperty key="autotestsuite.plugin.exclusions" value="${autotestsuite.plugin.exclusions}|^org.eclipse.test$" />\r
101                         <sysproperty key="autotestsuite.class.inclusions" value="${autotestsuite.class.inclusions}" />\r
102                         <sysproperty key="autotestsuite.class.exclusions" value="${autotestsuite.class.exclusions}" />\r
103 \r
104                 </java>\r
105         </target>\r
106 \r
107 </project>\r