Unable to Run ABL unit test suit using ANT

Posted by ankitagrawal1234 on 12-Mar-2019 11:58

Hi Folks,

I am trying to run ABL test suit by using ANT script. I need DB connection while running this test suit build is not working with DB connection.

Here is my build.xml:

<target name="abldef">
<typedef name="ablunit" classname="com.progress.openedge.ant.ablunit.ABLUnitTask"
classpath="dist/ant-ablunit.jar" />
</target>


<target name="ablunittests" depends="abldef" if="isWindows">
<mkdir dir="${basedir}/tmpdir"/>
<ablunit dlc="${env.DLC}" environment="tty"
printsummary="true" haltonerror="no" haltonfailure="no" tempdir="${basedir}/tmpdir">
<propath>
<pathelement refid="lybridge-build-propath"/>
<pathelement path="${pso}"/>
<pathelement refid="server-build-propath"/>
<pathelement location="${basedir}/Test" />
<pathelement location="${basedir}/Test/npui" />
</propath>

<dbinfo name="testDb.db" host="localhost" />

<test name="${basedir}/Test/Testsuite.cls" todir="${basedir}" outfile="result-Testsuite" format="xml" />
</ablunit>
</target>

I also tried by using PCTConnection statement but it is also not working.

<target name="abldef">
<typedef name="ablunit" classname="com.progress.openedge.ant.ablunit.ABLUnitTask"
classpath="dist/ant-ablunit.jar" />

<PCTRUN procedure="TestConnect.p" dlvHome="${env.DLC}">

<PCTConnection dbname="${Basedir}/build/testDB" singleUser="true" />

</PCTRUN>

</target>


<target name="ablunittests" depends="abldef" if="isWindows">
<mkdir dir="${basedir}/tmpdir"/>
<ablunit dlc="${env.DLC}" environment="tty"
printsummary="true" haltonerror="no" haltonfailure="no" tempdir="${basedir}/tmpdir">
<propath>
<pathelement refid="lybridge-build-propath"/>
<pathelement path="${pso}"/>
<pathelement refid="server-build-propath"/>
<pathelement location="${basedir}/Test" />
<pathelement location="${basedir}/Test/npui" />
</propath>

<test name="${basedir}/Test/Testsuite.cls" todir="${basedir}" outfile="result-Testsuite" format="xml" />

</ablunit>
</target>

Please suggest.

Thanks in advance.

regards,
Ankit

All Replies

Posted by Riverside Software on 12-Mar-2019 13:23

What's the output ?

Posted by Rutger Olthuis on 12-Mar-2019 13:33

I have never tried it this way, but does it even work when you connect in one target and want to use that connection in the next target? I always believed the target were executed separately in their own AVM.

So I would do:

<target name="ablunittests" depends="abldef" if="isWindows">
    <mkdir dir="${basedir}/tmpdir"/>
    <ablunit dlc="${env.DLC}" environment="tty"
printsummary="true" haltonerror="no" haltonfailure="no" tempdir="${basedir}/tmpdir">
    <PCTConnection dbname="${Basedir}/build/testDB" singleUser="true" />
        <propath>
            <pathelement refid="lybridge-build-propath"/>
            <pathelement path="${pso}"/>
            <pathelement refid="server-build-propath"/>
            <pathelement location="${basedir}/Test" />
            <pathelement location="${basedir}/Test/npui" />
        </propath>

        <test name="${basedir}/Test/Testsuite.cls" todir="${basedir}" outfile="result-Testsuite" format="xml" />

    </ablunit>
</target>

Posted by ankitagrawal1234 on 12-Mar-2019 13:41

I have already tried this but It it gives me an error "ablunit doesn't support the nested "PCTConnection" element

Posted by ankitagrawal1234 on 12-Mar-2019 13:43

It does not create any output file and and throws error there is no output file. I believe this is happening because if there is any error it searches for old output file and shows success message with same output file.

Posted by Rutger Olthuis on 12-Mar-2019 14:33

This is mine and it works like a charm. Just need to figure out how to get a results.xml like file on linux jenkins

<target name="unit.test.windows"> <ABLUnit destDir="Testing/tests" tempDir="${basedir}" haltOnFailure="true"> <PCTConnection dbName="${dbName}" dbDir="${dbdir}" singleUser="true"> <Alias name="crs" /> <Alias name="crs_dict" /> </PCTConnection> <fileset dir="Testing/tests" includes="**/*.cls"/> <propath> <!--<pathelement path="${DLC}/fundation_server.pl"/>--> <pathelement location="${commonSource}"/> <pathelement location="${commonSource}/inc"/> <pathelement path="Testing/tests"/> <pathelement path="target/dist/AppServer/obj/fundation_server.pl"/> <pathelement path="${DLC}/tty/netlib/OpenEdge.Net.pl"/> <pathelement path="${DLC}/tty/ablunit.pl" /> </propath> </ABLUnit> </target>

Posted by ankitagrawal1234 on 14-Mar-2019 12:50

I have a scenario where Physical name is different from logical name and need to use logical name in code. Is there any way to give Logical name with <dbinfo> tag?

<dbInfo> is working when db is already connected and Active but did not find any way to give logical name in dbinfo element.

Posted by ankitagrawal1234 on 15-Mar-2019 12:39

I am able to run test by using dbinfo but did not find any way to use logical name inside dbinfo tag? Is anyone have any idea??

This thread is closed