| <project name="Automated SWTBot Testing" default="all" basedir="."> |
| |
| <!--default directory where test-eclipse will be installed--> |
| <property name="install" value="${basedir}/test-eclipse" /> |
| |
| <!--suffix added to test output files to identify platform on which tests ran.--> |
| <property name="platform" value="${os}.${ws}.${arch}" /> |
| |
| <!-- The root of the eclipse installation --> |
| <property name="eclipse-home" value="${install}/eclipse" /> |
| |
| <!-- The directory that will contain all files containing information on the tests that ran.--> |
| <property name="results" value="${basedir}/results" /> |
| |
| <!--Directory for JUnit report output, console log output and .log content for each test suite. |
| Overrides default in org.eclipse.test/library.xml--> |
| <property name="junit-report-output" value="${results}/${platform}" /> |
| |
| <target name="setup" unless="noclean" depends="init"> |
| <condition property="setupTarget" value="setup-zip"> |
| <contains string="${runtimeArchive}" substring=".zip" /> |
| </condition> |
| <condition property="setupTarget" value="setup-tar.gz"> |
| <contains string="${runtimeArchive}" substring=".tar.gz" /> |
| </condition> |
| <antcall target="${setupTarget}" /> |
| </target> |
| |
| <!--setup for zip archives--> |
| <target name="setup-zip" description="Reinstall the test Eclipse installation if specified by user"> |
| <delete dir="${install}" /> |
| <mkdir dir="${install}" /> |
| <unzip dest="${install}" src="../externals/${runtimeArchive}" /> |
| <antcall target="installTestPlugins" /> |
| </target> |
| |
| <!--setup for tar.gz archives--> |
| <target name="setup-tar.gz" description="Reinstall the test Eclipse installation if specified by user"> |
| <delete dir="${install}" /> |
| <mkdir dir="${install}" /> |
| <untar compression="gzip" dest="${install}" src="../externals/${runtimeArchive}" /> |
| <antcall target="installTestPlugins" /> |
| </target> |
| |
| <target name="installTestPlugins"> |
| <!-- one each for each feature that is tested --> |
| <unzip src="${basedir}/../artifacts/${feature.id}-${all.buildId}.zip" dest="${install}" /> |
| <unzip src="${basedir}/../artifacts/${feature.id.test}-${all.buildId}.zip" dest="${install}" /> |
| <unzip src="${basedir}/../artifacts/org.eclipse.swtbot.eclipse-${all.buildId}.zip" dest="${install}" /> |
| |
| <copy todir="${install}/eclipse/plugins" verbose="true"> |
| <fileset dir="${basedir}/../externals/plugins" /> |
| </copy> |
| |
| <!-- copy over any other dependencies |
| <copy todir="${eclipse-home}" includeemptydirs="true"> |
| <fileset dir="${mylyn-base}" /> |
| </copy> |
| --> |
| </target> |
| |
| <target name="init" depends="setRuntimeArchive"> |
| |
| <mkdir dir="${results}/xml" /> |
| <mkdir dir="${results}/html" /> |
| <mkdir dir="${junit-report-output}" /> |
| |
| <!--Unlock files on the Mac before starting tests. |
| Required to delete some workspace directories (org.eclipse.core.filebuffers.tests and Team CVS tests).--> |
| <exec dir="${basedir}" executable="chflags" os="Mac OS X"> |
| <arg line="-R nouchg ${install}" /> |
| </exec> |
| </target> |
| |
| <target name="setRuntimeArchive"> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-win32.zip"> |
| <and> |
| <equals arg1="${os}" arg2="win32" /> |
| <equals arg1="${ws}" arg2="win32" /> |
| <equals arg1="${arch}" arg2="x86" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-win32-wpf.zip"> |
| <and> |
| <equals arg1="${os}" arg2="win32" /> |
| <equals arg1="${ws}" arg2="wpf" /> |
| <equals arg1="${arch}" arg2="x86" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-win32-win32-x86_64.zip"> |
| <and> |
| <equals arg1="${os}" arg2="win32" /> |
| <equals arg1="${ws}" arg2="win32" /> |
| <equals arg1="${arch}" arg2="x86_64" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-linux-gtk.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="linux" /> |
| <equals arg1="${ws}" arg2="gtk" /> |
| <equals arg1="${arch}" arg2="x86" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-linux-gtk-x86_64.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="linux" /> |
| <equals arg1="${ws}" arg2="gtk" /> |
| <equals arg1="${arch}" arg2="x86_64" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-linux-motif.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="linux" /> |
| <equals arg1="${ws}" arg2="motif" /> |
| <equals arg1="${arch}" arg2="x86" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-linux-gtk-ppc.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="linux" /> |
| <equals arg1="${ws}" arg2="gtk" /> |
| <equals arg1="${arch}" arg2="ppc" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-linux-gtk-x86_64.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="linux" /> |
| <equals arg1="${ws}" arg2="gtk" /> |
| <equals arg1="${arch}" arg2="ppc" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-macosx-carbon.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="macosx" /> |
| <equals arg1="${ws}" arg2="carbon" /> |
| <equals arg1="${arch}" arg2="ppc" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-macosx-carbon.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="macosx" /> |
| <equals arg1="${ws}" arg2="carbon" /> |
| <equals arg1="${arch}" arg2="x86" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-macosx-cocoa.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="macosx" /> |
| <equals arg1="${ws}" arg2="cocoa" /> |
| <equals arg1="${arch}" arg2="x86" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-macosx-cocoa-x86_64.tar.gz"> |
| <and> |
| <equals arg1="${os}" arg2="macosx" /> |
| <equals arg1="${ws}" arg2="cocoa" /> |
| <equals arg1="${arch}" arg2="x86_64" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-hpux-motif.zip"> |
| <and> |
| <equals arg1="${os}" arg2="hpux" /> |
| <equals arg1="${ws}" arg2="motif" /> |
| <equals arg1="${arch}" arg2="PA_RISC" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-solaris-motif.zip"> |
| <and> |
| <equals arg1="${os}" arg2="solaris" /> |
| <equals arg1="${ws}" arg2="motif" /> |
| <equals arg1="${arch}" arg2="sparc" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-solaris-gtk.zip"> |
| <and> |
| <equals arg1="${os}" arg2="solaris" /> |
| <equals arg1="${ws}" arg2="gtk" /> |
| <equals arg1="${arch}" arg2="sparc" /> |
| </and> |
| </condition> |
| <condition property="runtimeArchive" value="eclipse-SDK-${buildId}-aix-motif.zip"> |
| <and> |
| <equals arg1="${os}" arg2="aix" /> |
| <equals arg1="${ws}" arg2="motif" /> |
| <equals arg1="${arch}" arg2="ppc" /> |
| </and> |
| </condition> |
| </target> |
| |
| <macrodef name="runTests"> |
| <attribute name="testPlugin" /> |
| <attribute name="testPluginsRequired" default="" /> |
| <sequential> |
| <echo>=========================================================================</echo> |
| <echo>Executing tests for @{testPlugin}</echo> |
| <echo>=========================================================================</echo> |
| |
| <property name="test.target" value="junit" /> |
| <property name="report" value="@{testPlugin}" /> |
| |
| <antcall target="${test.target}"> |
| <param name="testPlugin" value="@{testPlugin}" /> |
| <param name="testPluginsRequired" value="@{testPluginsRequired}" /> |
| <param name="output-file" value="@{testPlugin}.xml" /> |
| <param name="consolelog" value="-consolelog" /> |
| </antcall> |
| </sequential> |
| </macrodef> |
| |
| <target name="junit" unless="skip.test"> |
| <antcall target="setup" /> |
| <ant antfile="${testPlugin}.xml" /> |
| <antcall target="genResults" /> |
| </target> |
| |
| <target name="genResults"> |
| <property name="junit.reports.xml.dir" value="${results.dir}/${report}/junit/xml" /> |
| <property name="junit.reports.html.dir" value="${results.dir}/${report}/junit/html" /> |
| |
| <mkdir dir="${junit.reports.xml.dir}" /> |
| <mkdir dir="${junit.reports.html.dir}" /> |
| |
| <move file="${eclipse-home}/${report}.xml" tofile="${junit.reports.xml.dir}/index.xml" failonerror="false" /> |
| |
| <available file="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit3.headless_${all.buildId}/JUNIT.XSL" property="junit.xsl" value="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit3.headless_${all.buildId}/JUNIT.XSL" /> |
| <available file="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_${all.buildId}/JUNIT.XSL" property="junit.xsl" value="${eclipse-home}/plugins/org.eclipse.swtbot.eclipse.junit4.headless_${all.buildId}/JUNIT.XSL" /> |
| |
| <mkdir dir="${junit.reports.html.dir}/screenshots" /> |
| <move todir="${junit.reports.html.dir}/screenshots" failonerror="false"> |
| <fileset dir="${junit-report-output}/screenshots" includes="*.*" /> |
| </move> |
| |
| <xslt style="${junit.xsl}" in="${junit.reports.xml.dir}/index.xml" out="${junit.reports.html.dir}/index.html"> |
| <param name="screenshot_dir" expression="screenshots"/> |
| <!-- |
| Only use this if you've set SWTBotPreferences#SCREENSHOT_FORMAT preference |
| Optional: possible values are bmp, gif, ico, jpeg, jpg, png or tiff |
| <param name="screenshot_format" expression="jpeg"/> |
| --> |
| </xslt> |
| |
| <xslt in="${junit.reports.xml.dir}/index.xml" out="./passFail.txt" style="passFail.xsl" /> |
| <property file="passFail.txt" /> |
| <fail message="Unit Tests failed." if="test.failed" /> |
| </target> |
| |
| <target name="core-tests"> |
| |
| <echo>==============================================================</echo> |
| <echo>eclipse-home is ${eclipse-home}</echo> |
| <echo>Executing tests under ${testPlugin}</echo> |
| <echo>==============================================================</echo> |
| |
| <ant antfile="${basedir}/${testPlugin}.xml" dir="${eclipse-home}/plugins/${testPlugin}_${all.buildId}"> |
| <property name="all.buildId" value="${all.buildId}" /> |
| <property name="build.base" value="${build.base}" /> |
| <property name="results.dir" value="${results.dir}/${testPlugin}" /> |
| </ant> |
| </target> |
| |
| <target name="clean"> |
| <delete dir="${install}" /> |
| <delete dir="${results}" /> |
| </target> |
| |
| <target name="test-finder" depends="setup"> |
| <antcall target="core-tests"> |
| <param name="testPlugin" value="org.eclipse.swtbot.swt.finder.test" /> |
| </antcall> |
| </target> |
| |
| <target name="test-generator" depends="setup"> |
| <antcall target="core-tests"> |
| <param name="testPlugin" value="org.eclipse.swtbot.generator.test" /> |
| </antcall> |
| </target> |
| |
| <target name="test-eclipse-finder"> |
| <runTests testPlugin="org.eclipse.swtbot.eclipse.finder.test" /> |
| </target> |
| |
| <target name="test-forms"> |
| <runTests testPlugin="org.eclipse.swtbot.forms.finder.test" /> |
| </target> |
| |
| <target name="test-eclipse-ui"> |
| <runTests testPlugin="org.eclipse.swtbot.eclipse.ui.test" /> |
| </target> |
| |
| <target name="all" depends="test-finder, test-forms, test-eclipse-finder, test-eclipse-ui, test-generator" /> |
| |
| </project> |
| |