Try OpenEdge Now
skip to main content
Online Help
Overview of ABLUnit testing framework : Tasks : Running test cases and test suites : Running test cases using an Apache ANT task
 
Running test cases using an Apache ANT task
You can use a custom ANT task (build.xml) to run ABLUnit tests cases. The task is a part of ant-ablunit.jar and is located in:
%DLC%\java location
Make sure that Apache ANT is installed on your machine and copy the ant-ablunit.jar file into the installation location of Apache ANT.
You must write an XML file (build.xml) for ABLUnit that runs test cases from the ABLUnit testing framework and can display the results in the console or save it to an XML file.
You can define ABLUnit tests by nesting elements in the test cases or using batch tests to run the ANT task.
ABLUnit Task-Level Properties
You can set the following are properties that you can set at the ANT task level for ABLUnit. You can override the properties while running individual test or batch test elements.
Name
Description
DLC
Specifies the installation location of OpenEdge.
environment (Optional)
Specifies the environment (GUI or TTY) in which test cases should run. By default, the test cases run in the GUI environment.
printsummary (Optional)
Prints a one-line summary of each test case that you run. The valid values are true, false, on, off, yes, and no. By default, the value is set to true.
haltonerror (Optional)
Stops the build process if an error occurs while running a test case. By default, the process proceeds even when errors occur.
haltonfailure (Optional)
Stops the build process if a test fails. By default, the process proceeds even if the test case fails.
tempdir (Optional)
Specifies the directory in which temporary files are placed while running the build process. By default, the working directory is used.
ABLUnit Elements
You can use the following ABLUnit elements in an ANT task to run an ABLUnit test case.
dbinfo element
Provides a database to be used while running a test case. This is a sub-element of the main ANT task and can appear any number of times. Each dbinfo element is considered as a single db connection. Set the following properties for this element:
Name
Description
name
Specifies the database name including the absolute path or the relative path if the database file is in the current working directory, for example in C:\OpenEdge\WRK114\sports2000.db.
host (Optional)
Specifies the host name of the server, for example, localhost.
port (Optional)
Specifies the port of the server or the service name, for example, 4545.
Note: The database must be available and the server must be active while running an ANT task.
propath element
Sets the PROPATH to be used while executing an ANT task. You can configure it with the pathelement element.
Note: For more information about pathelement, see the Apache ANT documentation.
test element
Configures an individual test case. Set the following properties for this element:
Name
Description
name
Specifies the name of a test class (.cls) or a test procedure (.p) file.
todir (Optional)
Specifies the directory to which the results of the ANT task are written.
outfile (Optional)
Specifies the name of the test results file. The format attribute file decides the extension of the file.
format (Optional)
Specifies the format of the results. Currently, we support on XML format.
DLC (Optional)
Specifies the installation location of OpenEdge. This property overrides the value you set in the ABLUnit task.
environment (Optional)
Specifies the environment (GUI or TTY) in which test cases must run. It overrides the value you set in the ABLUnit task.
printsummary (Optional)
Prints a one-line summary of each test case that you run. The valid values are true, false, on, off, yes, and no. It overrides the value you set in the ABLUnit task.
haltonerror (Optional)
Stops the build process if an error occurs while running the test case. This property overrides the value you set in the ABLUnit task.
haltonfailure (Optional)
Stops the build process if a test case fails. This property overrides the value you set in the ABLUnit task.
batchtest element
Configures a batch test case. You can configure a batch test case with the fileset element.
Note: For more information about fileset, see the Apache ANT documentation.
Set the following properties for this element:
Name
Description
todir (Optional)
Specifies the directory into which the results of the ANT task are written.
format (Optional)
Specifies the format of the test result.
DLC (Optional)
Specifies the installation location of OpenEdge. This property overrides the value you set in the ABLUnit task.
environment (Optional)
Specifies the environment (GUI or TTY) in which the test case must run. This property overrides the value you set in the ABLUnit task.
printsummary (Optional)
Prints a one-line summary of each test case that you run. The valid values are true, false, on, off, yes, and no. This property overrides the value you set in the ABLUnit task.
haltonerror (Optional)
Stops the build process if an error occurs while running the test case. This property overrides the value you set in the ABLUnit task.
haltonfailure (Optional)
Stops the build process if a test fails. This property overrides the value you set in the ABLUnit task.
Here is a sample build.xml file (Ant task):
<?xml version="1.0" encoding="UTF-8"?>
<project name="ABLUnit-Ant" default="main" basedir=".">

<!-- ABLUnit task definition target starts here -->
<target name="taskdef">
<taskdef name="ablunit" classname="com.progress.openedge.ant.ablunit.ABLUnitTask"
classpath="dist/ant-ablunit.jar" />
</target>

<!-- Main target starts here -->
<target name="main" depends="taskdef">
<ablunit dlc="C:\Progress\OpenEdge114" environment="gui"
printsummary="true" haltonerror="no" haltonfailure="no" tempdir="${basedir}/tmpdir">
<dbinfo name="C:\OpenEdge\WRK114\s2000.db" host="localhost" port="4545" />
<propath>
<pathelement location="${basedir}/samples/classes" />
<pathelement location="${basedir}/samples1/classes" />
</propath>

<test name="${basedir}/samples/MyTestClass.cls" todir="${basedir}/results" outfile="result-MyTestClass-gui" format="xml" />
<test name="${basedir}/samples/MyTestProcedure.p" todir="${basedir}/results" outfile="result-MyTestProcedure" format="xml" />

<batchtest todir="${basedir}/results" format="xml">
<fileset dir="${basedir}/samples1">
<include name="**/*.cls" />
<include name="**/*.p" />
</fileset>
</batchtest>

</ablunit>
</target>
</project>