Jeté Sample: Ant Integration

Home Overview
Jeté doesn't currently deviate from JUnit tasks and reports concerning Ant integration.  While this is limiting (and slated for change) it does have the benefit of not introducing any new concepts.

To run the sample system tests, one only needs to include Junit jar file in the classpath and have MySQL setup with a user "root" and password "admin".  To change the MySQL default, modify the dbTest.xml system test datasource entity.

A standard system test build.xml file should make use of company specific jars, should generate and compile WSDLs for testing, setup a db locally to test against, etc.  Basically the point of system testing is to provide an isolated environment to confirm what's been built.  

This particular install target cleans and initializes the appropriate build directories, and compiles the sample company code (making sure to include hibernate mapping files for the ORM)

     <target name="install" depends="clean,init">
        <!-- Compile the company specific java code -->
        <javac debug="true"
        <copy todir="${classes.dir}/com/company/customer" file="${src.dir}/com/company/customer/Customer.hbm.xml"/>
        <copy todir="${classes.dir}/com/company/user" file="${src.dir}/com/company/user/User.hbm.xml"/>

        <jar jarfile="${build.dir}/${output.jar}" basedir="${classes.dir}">

JUnit & JUnit Report

The junit task creates the db schema using the included sample script, executes the junit Ant task, and then the junitreport Ant task.

The schema creation is a windows .bat file (sorry, was on XP at the time) to drop the database, recreate it, and create 2 tables: Customer and User.

Junit references the only suite that works right now: org.jete.SystemTest.  Further refactoring should rectify this (with little impact to already created tests).

Junitreport does nothing really special, just takes the output from the junit task generates a pretty report.  This should also change a bit in the future with another task allowing suites to be named (currently they only work with class names).

     <target name="junit"
            description="Performs unit tests and build a report">
        <echo message="Running db schema creation script"/>
        <exec dir="db" executable="cmd">
            <arg line="/c create-schema.bat"/>
        <property name="win.classpath" refid="run.classpath"/>
        <echo message="classpath is ${win.classpath}"/>

                <path refid="run.classpath"/>
                <pathelement path="."/>
            <test name="org.jete.SystemTest" haltonfailure="no" todir="report">
                <formatter type="xml"/>

            <fileset dir="${}">
                <include name="TEST-*.xml"/>


Check back often regarding this page.  Enhancements for a 1.X release will include new junit and junitreport type ant tasks (unless I can find a way to make them work like I want).  The existing tasks won't change as these are not a part of this project.  My goal is to extend the existing tasks and modify them with as little work as possible.

The 2 main issues with these tasks are:
1. Cannot pass parameters in junit task.  This prevents specifying system test files other than the hard-coded SystemTest.xml
2. Classname, not suite name, is used when reporting.  This means changing suite names has no effect (if issue 1 were to work, multiple org.jete.SystemTest instances could be configured to show completely different test suites).
hosted by SourceForge Logo