Skip to content

Instantly share code, notes, and snippets.

@heddn
Created October 9, 2012 21:35
Show Gist options
  • Save heddn/3861610 to your computer and use it in GitHub Desktop.
Save heddn/3861610 to your computer and use it in GitHub Desktop.
selenium ant build
<?xml version="1.0" encoding="UTF-8"?>
<project name="Example Test Suite" default="build">
<property environment="env"/>
<target name="build" depends="prepare,phpunit,stop-selenium" />
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/logs" />
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/logs" />
</target>
<target name="phpunit" description="Run unit tests with PHPUnit" depends="start-selenium">
<exec executable="phpunit" failonerror="true" />
</target>
<target name="start-selenium">
<exec executable="Xvfb" spawn="true">
<arg line=" :99 -ac -noreset -screen 0 1024x768x24" />
</exec>
<exec executable="java" spawn="true">
<env key="DISPLAY" value=":99" />
<arg line="-jar ${env.SELENIUM} -log ${basedir}/build/logs/selenium.log -browserSessionReuse" />
</exec>
<sleep seconds="3"/>
</target>
<target name="stop-selenium">
<get taskname="selenium-shutdown" src="http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer" dest="${basedir}/build/logs/seleniumResult.txt" ignoreerrors="true" />
<echo taskname="selenium-shutdown" message="DGF Errors during shutdown are expected" />
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment