This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


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