Adding the pluginbuilder files that are used in the nightly build process.
[phpeclipse.git] / utilities / pluginbuilder / build-files / automatedTests / run-tests.xml
diff --git a/utilities/pluginbuilder/build-files/automatedTests/run-tests.xml b/utilities/pluginbuilder/build-files/automatedTests/run-tests.xml
new file mode 100644 (file)
index 0000000..94f1987
--- /dev/null
@@ -0,0 +1,107 @@
+<project name="Run automated Tests" default="run" basedir=".">\r
+       <taskdef resource="org/pluginbuilder/anttasks/pluginbuildertasks.properties" classpath="../pluginbuilder-anttasks.jar" />\r
+\r
+       <property file="../../build_local.properties" />\r
+       <property file="run-tests.properties" />\r
+\r
+       <import file="../build_shared.xml" />\r
+\r
+       <target name="-init">\r
+               <antcall target="-purgeTestEclipseHost" />\r
+               <property name="eclipse.installation.dir" value="${test.eclipse.base}/eclipse" />\r
+               <property name="eclipse.local.tar.non.server" value="${test.eclipse.zip}" />\r
+               <antcall target="-installTestEclipseHost" />\r
+       </target>\r
+\r
+       <target name="-purgeTestEclipseHost">\r
+               <delete dir="${test.eclipse.base}" failOnError="false" />\r
+       </target>\r
+\r
+       <target name="-installTestEclipseHost" description="Install Eclipse and all required plug-ins for testing" unless="isEclipseInstallationAvailable">\r
+               <echo message="Installing plug-ins for testing" />\r
+               \r
+               <unzip dest="${test.eclipse.base}">\r
+                       <fileset dir="." includes="eclipse-test-framework*.zip" />\r
+               </unzip>\r
+               <unzip dest="${test.eclipse.host}">\r
+                       <fileset dir="." includes="org.pluginbuilder.autotestsuite*.zip" />\r
+               </unzip>\r
+               <condition property="buildResultZipDest" value="${test.eclipse.base}" else="${test.eclipse.host}">\r
+                       <equals arg1="${archivePrefix}" arg2="eclipse" />\r
+               </condition>\r
+               <unzip dest="${buildResultZipDest}">\r
+                       <fileset dir="${buildDirectory}" includes="${buildType}-**/*.zip" excludes="**/${archiveNamePrefix}-*"/>\r
+               </unzip>\r
+               <!-- unpack eclipse after the features because there might be product features extracted which contain a config.ini -->\r
+               <antcall target="unpack.eclipse">\r
+                       <param name="unpack.eclipse" value="true"/>\r
+               </antcall>\r
+       </target>\r
+\r
+\r
+       <!-- Example target which demonstrates how to run a test suite with the Eclipse test fwk.\r
+               Note that it is not needed if you use the autotestsuite\r
+       \r
+       <target name="-runTestSuite" description="Should be called from allTests.xml only">\r
+               <ant target="ui-test" antfile="${test.library.xml}" dir="${test.eclipse.host}">\r
+                       <comment use -clean because plug-ins have been unzipped into the eclipse folder comment>\r
+                       <property name="data-dir" value="${test.workspace} -clean" />\r
+               <property name="plugin-name" value="<your plugin id>" />\r
+               <property name="classname" value="<the class which defines the suite>" />\r
+                       <property name="eclipse-home" value="${test.eclipse.host}" />\r
+               </ant>\r
+       </target>\r
+       \r
+       <target name="run" depends="-init,-runTestSuite" description="Run manually defined tests and create a report.">\r
+               <delete dir="${test.result.dir}" />\r
+               <mkdir dir="${test.result.dir}/xml" />\r
+               <comment collect creates an aggregated report file in ${test.eclipse.host} comment>\r
+               <ant target="collect" antfile="${test.library.xml}" dir="${test.eclipse.host}">\r
+                       <property name="includes" value="*.xml" />\r
+                       <property name="output-file" value="${test.aggregated.report}" />\r
+               </ant>\r
+               <copy file="${test.eclipse.host}/${test.aggregated.report}" todir="${test.result.dir}/xml" />\r
+               <style style="${basedir}/JUNIT.XSL" basedir="${test.result.dir}/xml" destdir="${test.result.dir}/html" />\r
+\r
+       </target>\r
+       -->\r
+       \r
+       <target name="run" depends="-init,-runAutoTests" description="Run all tests using the autotestsuite and create xml and html reports.">\r
+\r
+               <junitreport todir="${test.result.dir}/xml" tofile="${test.aggregated.report}">\r
+                       <fileset dir="${test.result.dir}/xml">\r
+                               <include name="*.xml" />\r
+                       </fileset>\r
+               </junitreport>\r
+\r
+               <BundleFileLocator eclipseInstallationRoot="${test.eclipse.host}" bundleId="org.pluginbuilder.autotestsuite.application" filePath="JUNIT.XSL" property="junit.xsl.file" />\r
+\r
+               <style style="${junit.xsl.file}" basedir="${test.result.dir}/xml" includes="${test.aggregated.report}" destdir="${test.result.dir}/html" />\r
+       </target>\r
+\r
+       <target name="-runAutoTests">\r
+               <mkdir dir="${test.result.dir}/xml"/>\r
+               <java fork="true" dir="." logError="true" classname="org.eclipse.core.launcher.Main">\r
+                       <classpath>\r
+                               <fileset dir="${test.eclipse.host}/plugins">\r
+                                       <include name="org.eclipse.equinox.launcher_*.jar" />\r
+                               </fileset>\r
+                       </classpath>\r
+                       <arg line="-application org.pluginbuilder.autotestsuite.application.autotestapplication" />\r
+                       <arg line="-data ${test.workspace}" />\r
+                       <arg line="-os ${os}" />\r
+                       <arg line="-ws ${ws}" />\r
+                       <arg line="-arch ${arch}" />\r
+                       <arg line="-consolelog" />\r
+\r
+                       <sysproperty key="autotestsuite.results.directory" value="${test.result.dir}/xml" />\r
+                       <sysproperty key="autotest.debug" value="${autotestsuite.trace}" />\r
+                       <sysproperty key="autotestsuite.plugin.inclusions" value="${autotestsuite.plugin.inclusions}" />\r
+                       <sysproperty key="autotestsuite.plugin.exclusions" value="${autotestsuite.plugin.exclusions}|^org.eclipse.test$" />\r
+                       <sysproperty key="autotestsuite.class.inclusions" value="${autotestsuite.class.inclusions}" />\r
+                       <sysproperty key="autotestsuite.class.exclusions" value="${autotestsuite.class.exclusions}" />\r
+\r
+               </java>\r
+       </target>\r
+\r
+</project>\r