Example Ant Project

Note: Full syntax support for the mfurun task is covered in the Micro Focus Ant User Manual, available from the Micro Focus SupportLine web site.

Running the following Ant project in your Ant framework and it will pick up any test fixture files (.mfu files) in the current directory, and as long as those files can also locate the test suites, will run them. The project is also configured to output the test results to a reports sub-directory; open the resulting index.html file in your browser to view the results of the test run. As these results have been generated in junit format, you can import them into your CI server solution.

The <taskdef> element points to the Micro Focus mfunit API, which is located in the mfunit.jar supplied with Visual COBOL; this .jar file must be on the current CLASSPATH in order to run the project.

<project>
<taskdef name="mfurun" classname="com.microfocus.mfunit.ant.MFURunMFUTask" />
    <condition property="src" else=".">
        <isset property="src"/>
    </condition>

    <echo>Source directory = ${src}</echo>

    <mfurun dir="${src}"
     printsummary="true"
     junitresults="true"
     junitreportpackage="com.mycompany.testcases">
         <fileset dir="${src}" includes="*.mfu" />
    </mfurun>

    <property environment="env"/>
    <mkdir dir="report"/>
    <junitreport todir="report">
     <fileset dir=".">
           <include name="TEST-*.xml"/>
     </fileset>
     <report format="frames" styledir="${env.ANT_HOME}/etc" todir="report"/>
    </junitreport>

</project>