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
Check PCT plug-in
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.
PCtConnection has logical name and Alias, one of them should do the trick.
What error ur getting ?
How about build.xml ? Have u added PCT jar file path in the build.xml ?
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>
Where is the call to build.xml in your batch file ?
e.g.
Call ANT c:\tmp\build.xml > c:\tmp\ABLUnitTestLog.txt
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.
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 ?
I am getting below error:
ablunit doesn't support the nested "dbconnection" element.
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" />
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?
I am not sure but it works fine at my end
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 )
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.
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" />