How to add external jars from external directory using antjunit build.xml

Document ID : KB000127974
Last Modified Date : 26/02/2019
Show Technical Document Details
Question:
       We are trying to execute test cases using antjunit task defined in build.xml.  Here we wanted to add external jar myown_test.jar to execute the testcases .  We don't want to place the jars inside LISA_HOME\lib directory. Because this jar may overwrite other functionalities.  So, we wanted to add the jars to be placed in a different directory and to be present in the classpath. How can I add this jar files to classpath using Junitlisa?
Answer:
Please try by adding classpath details inside junitlisa tag as given below. This will load the jar file defined in the ANT target task.

<target name="oneTest" description="Executes a LISA Test as a JUnit test." > 
<!-- make sure old reports are deleted and that we have a place to report... --> 
<delete dir="${testReportDir}"/> 
<mkdir dir="${testReportDir}"/> 

<!-- run the lisa suite in junit mode --> 
<junitlisa toDir="${testReportDir}" 
test="Tests/Lisa_config_info.tst" 
stagingDoc="StagingDocs/1User0Think_RunContinuously.stg" 
user="admin" 
password="admin"> 
<classpath> 
<fileset dir="C:/Sample_Data/" includes="myown_test.jar"/> 
</classpath>
</junitlisa> 

<!-- generate junit style html report --> 

<junitlisareport toDir="${testReportDir}"/> 
<echo message="The JUnit report is available at ${testReportDir}/index.html"/> 
</target>