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

JUnit ant batch process failing

Clinton Morrison

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

<?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 name="test" depends="init">
<echo message="Run the JUnit Tests in ${target.classes.test.dir}" />
<junit printsummary="yes" haltonerror="yes" haltonfailure="no" fork="yes">
<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}" />

<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}" />

<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" />
<report todir="${target.report.dir}/html" />

Buildfile: C:\build-apps\us\UnitTestTier\junit_build.xml
[echo] Clean the directory report
[delete] Deleting directory C:\build-apps\us\UnitTestTier\report
[mkdir] Created dir: C:\build-apps\us\UnitTestTier\report
[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)

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

Total time: 1 second
David Newton

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.
I agree. Here's the link: http://aspose.com/file-tools
subject: JUnit ant batch process failing
Similar Threads
[junit] java.lang.ClassNotFoundException: UserActivityTest
java.lang.classnotfoundexception in junit report
'junit' task problem
ServletTestCase::request is not accessible my test class, which extends jspTestCase.
ANT issues - Unable to create JUnit Reports- Please help