File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes JUnit ant batch process failing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JUnit ant batch process failing" Watch "JUnit ant batch process failing" New topic
Author

JUnit ant batch process failing

Clinton Morrison
Greenhorn

Joined: Jun 28, 2007
Posts: 24
When I try to run the batch script below it keeps failing. I am not sure were I am going wrong with my classpath as I have my log4j in the folder ${testing.lib}. Is there a better way to reference my classpath?

Thanks in advance
Clinton

JUNIT SCRIPT
[code]
<?xml version="1.0" encoding="UTF-8"?>
<project name="testing tier" default="report" basedir=".">
<property file="junit_build.properties" />

<target name="init">
<echo message="Clean the directory ${target.report.dir}" />
<delete dir="${target.report.dir}" />
<mkdir dir="${target.report.dir}" />
</target>

<target name="test" depends="init">
<echo message="Run the JUnit Tests in ${target.classes.test.dir}" />
<junit printsummary="yes" haltonerror="yes" haltonfailure="no" fork="yes">
<classpath>
<pathelement location="${common-nge}/bin" />
<pathelement location="${common-us}/bin" />
<pathelement location="${services}/bin" />
<pathelement location="${ts2-consumer}/bin" />
<pathelement location="${common-nge-fe}/bin" />
<pathelement location="${common-us-fe}/bin" />
<pathelement location="${services-fe}/bin" />
<pathelement location="${ts2-consumer-fe}/bin" />
<pathelement location="${testing.lib}" />
<pathelement location="${target.classes.test.dir}" />
</classpath>

<jvmarg value="-DclientConfig=C:/build-apps/us/COMMON-US/etc/config/" />
<jvmarg value="-DlazyLoadConfigs=true" />
<jvmarg value="-DconfigRefreshCheckInterval=0" />

<formatter type="plain" usefile="false" />
<formatter type="xml" />
<batchtest todir="${target.report.dir}" fork="yes">
<fileset dir="${src.test.dir}">
<include name="${tests}" />
<exclude name="${suites}" />
<exclude name="${cactus}" />
</fileset>
</batchtest>
</junit>
</target>

<target name="report" depends="test">
<mkdir dir="${target.report.dir}/html" />
<junitreport todir="${target.report.dir}">
<fileset dir="${target.report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${target.report.dir}/html" />
</junitreport>
</target>
</project>
[code]

ERROR MESSAGE
Buildfile: C:\build-apps\us\UnitTestTier\junit_build.xml
init:
[echo] Clean the directory report
[delete] Deleting directory C:\build-apps\us\UnitTestTier\report
[mkdir] Created dir: C:\build-apps\us\UnitTestTier\report
test:
[echo] Run the JUnit Tests in C:/build-apps/us/UnitTestTier/bin
[junit] Running com.tsys.common.config.TestAdvisorConfig
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.031 sec
[junit] Testsuite: com.tsys.common.config.TestAdvisorConfig
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.031 sec
[junit] Testcase: testRead took 0.015 sec
[junit] Caused an ERROR
[junit] org/apache/log4j/Priority
[junit] java.lang.NoClassDefFoundError: org/apache/log4j/Priority
[junit] at com.tsys.common.config.AdvisorConfig.read(AdvisorConfig.java:56)
[junit] at com.tsys.common.config.TestAdvisorConfig.testRead(TestAdvisorConfig.java:61)

BUILD FAILED
C:\build-apps\us\UnitTestTier\junit_build.xml:13: Test com.tsys.common.config.TestAdvisorConfig failed

Total time: 1 second
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JUnit ant batch process failing