Selenium provides cross-browser functional, web-based testing using table-driven tests. What’s more is that you can configure Selenium to run these tests with every source code change or on a periodic basis.

This flash demo walks you through the steps of using the Selenium IDE with Selenium Remote Control and Ant so that you can incorporate the execution of functional tests with every build. Because it can run with an automated build, you can easily configure these tests to run in a Continuous Integration environment.

Watch the demo.

Below, is an example of an Ant script which runs the Selenium tests using the Selenum Server. This script is based on the Selenium-RC and Continuous Integration entry

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="functional-tests" default="all" basedir=".">
  <property file="${basedir}/selenium.properties"/>
  <import file="${basedir}/common-environment.xml"/>

 <target name="all" depends="clean" >
    <antcall target="run-selenium-tests"/>
    <antcall target="stop-server"/>
  </target>

  <target name="clean">
  </target>

  <property name="acceptance.test.lib.dir"
                value="${functional.test.dir}" />
  <property name="firefox" value="*firefox" />
  <property name="base.url"
                value="http://${web.host.name}:${web.port}" />
  <property name="acceptance.test.list.dir"
                value="${functional.test.dir}" />
  <property name="acceptance.test.report.dir"
                value="${functional.test.dir}" />

  <target name="run-selenium-tests">
    <mkdir dir="${reports.dir}" />
    <java jar="${acceptance.test.lib.dir}/selenium-server.jar"
            fork="true">
      <arg line="-htmlSuite &quot;${firefox}&quot;"/>
      <arg line="&quot;${base.url}&quot;"/>
      <arg line="&quot;${acceptance.test.list.dir}/${test.suite}&quot;"/>
      <arg line="&quot;${reports.dir}/index.html&quot;"/>
      <arg line="-timeout ${timeout}"/>
    </java>
  </target>

  <target name="stop-server">
    <get taskname="selenium-shutdown" src="http://${web.host.name}: 
${selenium.rc.port}/selenium-server/driver/?cmd=shutDown"
      dest="result.txt" ignoreerrors="true" />
     <echo taskname="selenium-shutdown"
              message="Errors during shutdown are expected" />
  </target>

</project>