Eclipse Jubula Automated Test Ant File

As a followup to my previous post on automating Eclipse Jubula tests with Jenkins, here’s an Ant file that

  • Extracts the target platform (Eclipse in this case) and Jubula’s instrumentation plugin
  • Deploys the plugins under test into the target platform (simple copy in this case, no p2 installation)
  • Runs the Jubula tests usingtestexec
  • Collects links to all test results in an index.html file that can be published using the Jenkins HTML Publisher plugin


<project name="plugin-test" default="run">
	<!-- Locations -->
	<property name="testdata.dir" value="testdata" />
	<property name="report.dir" value="report/jubula"/>
	<property name="application.dir" value="/tmp/plugin-test/runtime"/>
	<property name="workspace.dir" value="/home/jenkins/.jubula/workspace"/>
	<property name="artifact.dir" value="target"/><!-- Location of plugins under test -->
	<property name="testexec" value="/home/jenkins/jubula/jubula/testexec"/>

	<!-- Derived properties -->
	<property name="deploy.dir" value="${application.dir}/eclipse/plugins"/>
	<property name="report.index" value="${report.dir}/index.html"/>

	<!-- Taskdefs -->
	<taskdef resource="net/sf/antcontrib/" classpath="lib/ant-contrib.jar"/>

	<!-- Main target -->
	<target name="run" depends="check, setup, prepare-runtime, deploy, test, report" />

	<target name="check" unless="application.archive" description="Check configuration">
		<fail message="The mandatory property application.archive pointing to a zipped Eclipse runtime is missing"/>

	<target name="setup" description="Prepare directories">
		<delete dir="${report.dir}"/>
		<mkdir dir="${report.dir}"/>
		<delete dir="${testdata.dir}"/>
		<mkdir dir="${testdata.dir}"/>
		<delete dir="${application.dir}"/>
		<mkdir dir="${application.dir}"/>
		<mkdir dir="${artifact.dir}"/>

Unpack the target runtime, copy instrumentation plugin and deploy plugins under test

	<target name="prepare-runtime" description="Unpack the runtime application to a working directory">
		<!-- Extract Eclipse -->
		<unzip dest="${application.dir}" src="${application.archive}" overwrite="true"/>
		<chmod perm="a+x" file="${application.dir}/eclipse/eclipse"/>
		<!-- Extract Jubula instrumentation plugin -->
		<unzip dest="${application.dir}/eclipse" src="${jubula.plugin.archive}" overwrite="true"/>

	<target name="deploy" description="Copy all plugins (target/*.jar) directory to the runtime application's plugins directory">
		<copy todir="${deploy.dir}">
			<fileset dir="${artifact.dir}" includes="*.jar"/>

Run Jubula tests using testexec

	<target name="test" description="Run the tests using testexec against an autagent">
		<property name="test.project" value="_your project name_"/>
		<property name="test.project.version" value="1.0"/>
		<property name="test.suite" value="_your test suite name_"/>
		<property name="test.aut.config" value="Eclipse_Helios"/>
		<property name="" value="localhost"/>
		<property name="autagent.port" value="60000"/>
		<property name="db.scheme" value="_your DB scheme_"/>
		<property name="db.user" value="_your DB user_"/>
		<property name="db.pwd" value="_your DB pwd_"/>

		<exec executable="${testexec}" failonerror="true">
			<arg line='-project ${test.project} -version ${test.project.version} -testsuite ${test.suite}'/>
			<arg line='-server ${} -port ${autagent.port} -autconfig ${test.aut.config}'/>
			<arg line='-datadir "${testdata.dir}" -resultdir "${report.dir}"'/>
			<arg line='-data "${workspace.dir}"'/>
			<arg line='-language en_US -dbscheme "${db.scheme}"'/>
			<arg line="-dbuser ${db.user} -dbpw ${db.pwd}"/>

Generate index page with links to test results

	<target name="report" description="Create report index HTML page">
		<!-- Find report files -->
		<fileset id="html.fileset" dir="${report.dir}">
		    <include name="*.htm*" />
			<exclude name="index.html"/>

		<pathconvert pathsep=";" property="html.filelist" refid="html.fileset">
		    <mapper type="flatten" />

		<!-- Create index page header -->
		<echo file="${report.index}">

		<!-- Add links to all files -->
		<foreach list="${html.filelist}" delimiter=";" target="-print-report-link" param=""/>

		<!-- Footer -->
		<echo file="${report.index}" append="true">

	<target name="-print-report-link" description="Print a link to a Jubula report file into the index page">
		<!-- Strip file prefix -->
		<propertyregex input="${}" property="report.file.title" regexp="executionLog-" replace=""/>
		<!-- Create file link in list -->
		<echo file="${report.index}" append="true" message="&lt;li&gt;  &lt;a href=${}&gt; ${report.file.title}  &lt;/a&gt;  &lt;/li&gt;"/>

This entry was posted in Eclipse, Java, Jenkins, Testing. Bookmark the permalink.

4 Responses to Eclipse Jubula Automated Test Ant File

  1. Pingback: Automating Eclipse Jubula Tests with Jenkins | Development Notes

  2. Alex says:

    Hi Matt,

    I´m currently trying to write a ANT-script, that just automatically runs a test suite. I did it in the console via the “testexec”-command. When I use ANt, I always get an Error, that the database drivers are missing.

    [exec] Exception [EclipseLink-4002] (Eclipse Persistence Services – 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
    [exec] Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:h2:~/.jubula/database/embedded;MVCC=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE
    [exec] Error Code: 0
    [exec] at org.eclipse.persistence.exceptions.DatabaseException.sqlException(
    [exec] at org.eclipse.persistence.exceptions.DatabaseException.sqlException(
    [exec] at org.eclipse.persistence.sessions.DefaultConnector.connect(
    [exec] at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(
    [exec] at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(
    [exec] at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(
    [exec] at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(
    [exec] at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(
    [exec] at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(
    [exec] at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(
    [exec] at org.eclipse.jubula.client.core.persistence.Hibernator.buildSessionFactoryWithLoginData(
    [exec] at org.eclipse.jubula.client.core.persistence.Hibernator.(
    [exec] at org.eclipse.jubula.client.core.persistence.Hibernator.instance(
    [exec] at org.eclipse.jubula.client.core.persistence.Hibernator.access$4(
    [exec] at org.eclipse.jubula.client.core.persistence.Hibernator$
    [exec] at
    [exec] Caused by: java.sql.SQLException: No suitable driver found for jdbc:h2:~/.jubula/database/embedded;MVCC=TRUE;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE
    [exec] at java.sql.DriverManager.getConnection(Unknown Source)
    [exec] at java.sql.DriverManager.getConnection(Unknown Source)
    [exec] at org.eclipse.persistence.sessions.DefaultConnector.connect(
    [exec] … 13 more
    [exec] !!Error occurred !!

    Maybe you also got into this error? Or do you have some hints??


  3. Turic says:

    Hi Alex,
    i also get the same error as you described. Did it work now? Do you have any idea about what the problem is and how i can solve it?


    • Alex says:

      Hi Turic,

      I´m sorry, but I wasn´t able to solve this error in acceptable time. So what I did was, to make a nightly build, using the a shell script to start the tests.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s