ABL unit ant script

Posted by ankitagrawal1234 on 25-Mar-2019 09:26

Hi folks,

I am trying to run my ABL test suit using ANT that needs db connection but facing some trouble while connecting database.

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.

Thanks in advance.

Regards,

Ankit Agrawal

All Replies

Posted by atuldalvi123 on 25-Mar-2019 09:57

Check PCT plug-in

github.com/.../PCTConnection

Posted by ankitagrawal1234 on 25-Mar-2019 10:10

I have installed PCT plugin and tried to use PCTconnection inside ABL that but It is not supporting inside ABLunit tag. I tried the following way but Not sure why it is not working for me.

<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>

Any help would be great.
Posted by Rutger Olthuis on 25-Mar-2019 10:11

PCtConnection has logical name and Alias, one of them should do the trick.

Posted by atuldalvi123 on 25-Mar-2019 10:17

What error ur getting ?

How about build.xml ? Have u added PCT jar file path in the build.xml ?

Posted by ankitagrawal1234 on 25-Mar-2019 10:35

Here is my .bat file-

@echo off
path = %PATH%;C:\Java\bin;C:\ant\bin
set PCT_HOME=C:\ant\pct
set DLC=C:\Progress\OpenEdge11.7
cmd /c ant ablunittests -v
pause.

Build.xml 

<!-- taskdef = Ant lib includes -->
 <taskdef resource="PCT.properties" classpath="${env.PCT_HOME}/lib/PCT.jar" />
 <!-- Import AntContrib -->
   <taskdef resource="net/sf/antcontrib/antlib.xml" />

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

 <!-- C:\Progress\OpenEdgexx.x\java\ant-ablunit.jar goes in ant\lib -->
 <!-- runtests target starts here -->
 <target name="ablunittests" depends="abldef" if="isWindows">
      
    <ablunit dlc="${env.DLC}" environment="tty"
    printsummary="true" haltonerror="no" haltonfailure="no" tempdir="${basedir}/tmpdir">

        <propath>
  
   <pathelement location="${basedir}/Test" />
    </propath>

    <dbconnection dbname="itsrv" dbDir="C:\Users\e5757\workspace\build\compiledb\" singleUser="true" logicalname="vision">
    <test name="${basedir}/Test/Testsuite.cls" todir="${basedir}/Results" outfile="result-Testsuite" format="xml" />
    </ablunit>
 </target>

Posted by atuldalvi123 on 25-Mar-2019 10:43

Where is the call to build.xml in your batch file ?

e.g.

  Call ANT c:\tmp\build.xml > c:\tmp\ABLUnitTestLog.txt

Posted by ankitagrawal1234 on 25-Mar-2019 11:48

I am not really sure if we need to write call for build.xml as it is already running for other targets. build.xml is residing inside base directory and it picks automatically when I run the batch file. I can see my changes are reflecting so I am pretty much sure it is picking correct xml file. The only thing I am wondering is to use PCTconnection command inside ABLunit tag.

Posted by atuldalvi123 on 25-Mar-2019 12:07

I think you should open the command prompt and execute each line in the batch script that will give you more idea on the errors if any.

Do you have any specific error ?

Posted by ankitagrawal1234 on 25-Mar-2019 12:21

I am getting below error:

ablunit doesn't support the nested "dbconnection" element.

Posted by atuldalvi123 on 25-Mar-2019 12:31

I think xml is not picking your PTC jar file correctly.

Can you check below tags in your build.xml.

<taskdef resource="PCT.properties" classpath="c:\tmp\PCT-187.jar" />

<typedef resource="types.properties" classpath="c:\tmp\PCT-187.jar" />

Posted by ankitagrawal1234 on 25-Mar-2019 12:54

I had only taskdef tag however I tried again by adding typedef also but did not get any luck.

Is there any difference in PCT version?

Posted by atuldalvi123 on 25-Mar-2019 13:02

I am not sure but it works fine at my end

Posted by Riverside Software on 25-Mar-2019 16:02

You're using the Progress version of ABLUnit task (recognized by the attributes in the task), so you have to use the <dbinfo> object to connect a database (see documentation.progress.com/.../index.html )

Posted by ankitagrawal1234 on 26-Mar-2019 06:07

I am able to use dbinfo but struggling to use logicalname with dbinfo. I did not find any documentation to use logical info with dbinfo.

Could you please suggest any workaround for this.

Posted by jvw on 02-Dec-2019 17:47

we use fysical stdcl and logical clsturing, in this way using PCT:

 <DBConnection dbName="stdclc" hostName="${HOST}" dbPort="L-${ENV}-maia-c" logicalName="clsturing" userName="_architect" password="${password}" id="stdclc" />

This thread is closed