Ant Build Failing with JUnit Tests

I have a bamboo plan setup containing two tasks. The first is a simple SVN checkout and the seecond being an ANT build which targets some unit tests.

When these unit tests are run within the eclipse/Junit workbench and ANT via cmd prompt all tests pass and the build is successful. However this behavior is not replicated in bamboo and as result failing the build.

I have specified the correct target within the ANT task in bambo, selected the checkbox - the build will produce results and have also specified the correct directory for the XML results. When the plan is run, the build seems to identify all of the unit test classes but is failing them for some apperant reason.

Could you please suggest what they problem may be and or if i missing a specific step.

Many thanls in advance.

The following is an example of one of the failures in the summary of the build number:

java.lang.ClassNotFoundException: com.ge.corporate.taxes.spp.model.AccountViewForEntityBeanUnitTest
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at java.lang.Class.forName0(Native Method)
(1 more lines...)

The complete build log:

08-Mar-2013 08:27:04 Build SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1-61 started building on agent 3.39.65.187
08-Mar-2013 08:27:04 Build working directory is /opt/bamboo_agent/agent02/xml-data/build-dir/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1
08-Mar-2013 08:27:04 Executing build SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1-61
08-Mar-2013 08:27:04 Starting task 'Source Code Checkout' of type 'com.atlassian.bamboo.plugins.vcs:task.vcs.checkout'
08-Mar-2013 08:27:04 Running preRetrieveSourceCode task...
08-Mar-2013 08:27:04 Build always requires a clean checkout
08-Mar-2013 08:27:04 Cleaning build directory '/opt/bamboo_agent/agent02/xml-data/build-dir/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1'
08-Mar-2013 08:27:06 Updating source code to revision: 1139
08-Mar-2013 08:27:06 Working directory '/opt/bamboo_agent/agent02/xml-data/build-dir/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1' is empty. Checking out SVN URL 'https://openge.ge.com/svn/stirpreprocess/trunk'
08-Mar-2013 08:30:00 Updated source code to revision: 1139
08-Mar-2013 08:30:00 Running postRetrieveSourceCode task...
08-Mar-2013 08:30:00 Finished task 'Source Code Checkout'
08-Mar-2013 08:30:00 Running pre-build action: VCS Version Collector
08-Mar-2013 08:30:00 Running pre-build action: Build Number Stamper
08-Mar-2013 08:30:00 Running pre-build action: Artifactory Release Staging
08-Mar-2013 08:30:00 Running pre-build action: Clover Grails PreBuild Action
08-Mar-2013 08:30:00 Running pre-build action: Repository Isolation Enabler Action
08-Mar-2013 08:30:00 Running pre-build action: Maven Settings Prebuild Action
08-Mar-2013 08:30:00 Starting task 'Build SPP Unit Tests' of type 'com.atlassian.bamboo.plugins.ant:task.builder.ant'
08-Mar-2013 08:30:00
Beginning to execute external process for build 'SPP CI Unit Tests - SPP CI Unit Tests - Default Job'
... running command line:
/usr/share/java/ant-1.8.2/bin/ant
-Djava.io.tmpdir=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1
-f
build.xml
spp-unit-tests
... in: /opt/bamboo_agent/agent02/xml-data/build-dir/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1
... using extra environment variables:
JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
ANT_HOME=/usr/share/java/ant-1.8.2
PATH=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
08-Mar-2013 08:30:01 Buildfile: /opt/bamboo_agent/agent02/xml-data/build-dir/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1/build.xml
08-Mar-2013 08:30:01
08-Mar-2013 08:30:01 spp-unit-tests:
08-Mar-2013 08:30:01 [mkdir] Created dir: /opt/bamboo_agent/agent02/xml-data/build-dir/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1/test-results
08-Mar-2013 08:30:02 [junit] Running com.ge.corporate.taxes.spp.action.AccountsForTrinityActionUnitTest
08-Mar-2013 08:30:02 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:02 [junit] Test com.ge.corporate.taxes.spp.action.AccountsForTrinityActionUnitTest FAILED
08-Mar-2013 08:30:03 [junit] Running com.ge.corporate.taxes.spp.action.AccountsViewForEntityActionUnitTest
08-Mar-2013 08:30:03 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:03 [junit] Test com.ge.corporate.taxes.spp.action.AccountsViewForEntityActionUnitTest FAILED
08-Mar-2013 08:30:03 [junit] Running com.ge.corporate.taxes.spp.action.AdjustmentsDialougeActionUnitTest
08-Mar-2013 08:30:04 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:04 [junit] Test com.ge.corporate.taxes.spp.action.AdjustmentsDialougeActionUnitTest FAILED
08-Mar-2013 08:30:04 [junit] Running com.ge.corporate.taxes.spp.action.AdjustmentsEnquiryActionUnitTest
08-Mar-2013 08:30:04 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:05 [junit] Test com.ge.corporate.taxes.spp.action.AdjustmentsEnquiryActionUnitTest FAILED
08-Mar-2013 08:30:05 [junit] Running com.ge.corporate.taxes.spp.action.AdjustmentsSummaryDialogueContentActionUnitTest
08-Mar-2013 08:30:05 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:06 [junit] Test com.ge.corporate.taxes.spp.action.AdjustmentsSummaryDialogueContentActionUnitTest FAILED
08-Mar-2013 08:30:06 [junit] Running com.ge.corporate.taxes.spp.action.AdminToolsActionUnitTest
08-Mar-2013 08:30:06 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:06 [junit] Test com.ge.corporate.taxes.spp.action.AdminToolsActionUnitTest FAILED
08-Mar-2013 08:30:07 [junit] Running com.ge.corporate.taxes.spp.action.CommentsDialogueContentActionUnitTest
08-Mar-2013 08:30:07 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:07 [junit] Test com.ge.corporate.taxes.spp.action.CommentsDialogueContentActionUnitTest FAILED
08-Mar-2013 08:30:08 [junit] Running com.ge.corporate.taxes.spp.action.FindMatchingAccountsActionUnitTest
08-Mar-2013 08:30:08 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:08 [junit] Test com.ge.corporate.taxes.spp.action.FindMatchingAccountsActionUnitTest FAILED
08-Mar-2013 08:30:08 [junit] Running com.ge.corporate.taxes.spp.action.InactiveUserActionUnitTest
08-Mar-2013 08:30:09 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:09 [junit] Test com.ge.corporate.taxes.spp.action.InactiveUserActionUnitTest FAILED
08-Mar-2013 08:30:09 [junit] Running com.ge.corporate.taxes.spp.action.IndexActionUnitTest
08-Mar-2013 08:30:09 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:10 [junit] Test com.ge.corporate.taxes.spp.action.IndexActionUnitTest FAILED
08-Mar-2013 08:30:10 [junit] Running com.ge.corporate.taxes.spp.action.MaintenanceModeActionUnitTest
08-Mar-2013 08:30:10 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:11 [junit] Test com.ge.corporate.taxes.spp.action.MaintenanceModeActionUnitTest FAILED
08-Mar-2013 08:30:11 [junit] Running com.ge.corporate.taxes.spp.action.MeForAccountsActionUnitTest
08-Mar-2013 08:30:11 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:11 [junit] Test com.ge.corporate.taxes.spp.action.MeForAccountsActionUnitTest FAILED
08-Mar-2013 08:30:12 [junit] Running com.ge.corporate.taxes.spp.action.NotAuthorisedActionUnitTest
08-Mar-2013 08:30:12 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:12 [junit] Test com.ge.corporate.taxes.spp.action.NotAuthorisedActionUnitTest FAILED
08-Mar-2013 08:30:13 [junit] Running com.ge.corporate.taxes.spp.action.SignOutActionUnitTest
08-Mar-2013 08:30:13 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:13 [junit] Test com.ge.corporate.taxes.spp.action.SignOutActionUnitTest FAILED
08-Mar-2013 08:30:13 [junit] Running com.ge.corporate.taxes.spp.action.StirSubmissionStagesUnitTest
08-Mar-2013 08:30:14 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:14 [junit] Test com.ge.corporate.taxes.spp.action.StirSubmissionStagesUnitTest FAILED
08-Mar-2013 08:30:14 [junit] Running com.ge.corporate.taxes.spp.action.ThemeExampleActionUnitTest
08-Mar-2013 08:30:14 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:15 [junit] Test com.ge.corporate.taxes.spp.action.ThemeExampleActionUnitTest FAILED
08-Mar-2013 08:30:15 [junit] Running com.ge.corporate.taxes.spp.action.ToggleTrinityStatesConduitActionUnitTest
08-Mar-2013 08:30:15 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:16 [junit] Test com.ge.corporate.taxes.spp.action.ToggleTrinityStatesConduitActionUnitTest FAILED
08-Mar-2013 08:30:16 [junit] Running com.ge.corporate.taxes.spp.action.TrinitiesViewForEntityActionUnitTest
08-Mar-2013 08:30:16 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:16 [junit] Test com.ge.corporate.taxes.spp.action.TrinitiesViewForEntityActionUnitTest FAILED
08-Mar-2013 08:30:17 [junit] Running com.ge.corporate.taxes.spp.action.UiParametersUnitTest
08-Mar-2013 08:30:17 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:17 [junit] Test com.ge.corporate.taxes.spp.action.UiParametersUnitTest FAILED
08-Mar-2013 08:30:18 [junit] Running com.ge.corporate.taxes.spp.interceptor.MaintenanceModeInterceptorUnitTest
08-Mar-2013 08:30:18 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:18 [junit] Test com.ge.corporate.taxes.spp.interceptor.MaintenanceModeInterceptorUnitTest FAILED
08-Mar-2013 08:30:18 [junit] Running com.ge.corporate.taxes.spp.model.AccountViewForEntityBeanUnitTest
08-Mar-2013 08:30:18 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:19 [junit] Test com.ge.corporate.taxes.spp.model.AccountViewForEntityBeanUnitTest FAILED
08-Mar-2013 08:30:19 [junit] Running com.ge.corporate.taxes.spp.model.AccountsForTrinityBeanUnitTest
08-Mar-2013 08:30:19 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:20 [junit] Test com.ge.corporate.taxes.spp.model.AccountsForTrinityBeanUnitTest FAILED
08-Mar-2013 08:30:20 [junit] Running com.ge.corporate.taxes.spp.model.AccountsValuesBeanUnitTest
08-Mar-2013 08:30:20 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:21 [junit] Test com.ge.corporate.taxes.spp.model.AccountsValuesBeanUnitTest FAILED
08-Mar-2013 08:30:21 [junit] Running com.ge.corporate.taxes.spp.model.AdjustmentsBeanUnitTest
08-Mar-2013 08:30:21 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:21 [junit] Test com.ge.corporate.taxes.spp.model.AdjustmentsBeanUnitTest FAILED
08-Mar-2013 08:30:22 [junit] Running com.ge.corporate.taxes.spp.model.CategoryValuesBeanUnitTest
08-Mar-2013 08:30:22 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:22 [junit] Test com.ge.corporate.taxes.spp.model.CategoryValuesBeanUnitTest FAILED
08-Mar-2013 08:30:22 [junit] Running com.ge.corporate.taxes.spp.model.EntitySummaryBeanUnitTest
08-Mar-2013 08:30:23 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:23 [junit] Test com.ge.corporate.taxes.spp.model.EntitySummaryBeanUnitTest FAILED
08-Mar-2013 08:30:23 [junit] Running com.ge.corporate.taxes.spp.model.MeForAccountBeanUnitTest
08-Mar-2013 08:30:23 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:24 [junit] Test com.ge.corporate.taxes.spp.model.MeForAccountBeanUnitTest FAILED
08-Mar-2013 08:30:24 [junit] Running com.ge.corporate.taxes.spp.model.PeriodEntityBeanUnitTest
08-Mar-2013 08:30:24 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:25 [junit] Test com.ge.corporate.taxes.spp.model.PeriodEntityBeanUnitTest FAILED
08-Mar-2013 08:30:25 [junit] Running com.ge.corporate.taxes.spp.model.PermaTempValuesBeanUnitTest
08-Mar-2013 08:30:25 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:25 [junit] Test com.ge.corporate.taxes.spp.model.PermaTempValuesBeanUnitTest FAILED
08-Mar-2013 08:30:26 [junit] Running com.ge.corporate.taxes.spp.model.StirSubmissionTrialBalanceBeanUnitTest
08-Mar-2013 08:30:26 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:26 [junit] Test com.ge.corporate.taxes.spp.model.StirSubmissionTrialBalanceBeanUnitTest FAILED
08-Mar-2013 08:30:27 [junit] Running com.ge.corporate.taxes.spp.model.TrinitiesCompleteValuesUnitTest
08-Mar-2013 08:30:27 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:27 [junit] Test com.ge.corporate.taxes.spp.model.TrinitiesCompleteValuesUnitTest FAILED
08-Mar-2013 08:30:27 [junit] Running com.ge.corporate.taxes.spp.model.TrinityViewForEntityBeanUnitTest
08-Mar-2013 08:30:28 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:28 [junit] Test com.ge.corporate.taxes.spp.model.TrinityViewForEntityBeanUnitTest FAILED
08-Mar-2013 08:30:28 [junit] Running com.ge.corporate.taxes.spp.security.AppSecurityInterceptorUnitTest
08-Mar-2013 08:30:28 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:29 [junit] Test com.ge.corporate.taxes.spp.security.AppSecurityInterceptorUnitTest FAILED
08-Mar-2013 08:30:29 [junit] Running com.ge.corporate.taxes.spp.security.FakeSecurityServiceForUIUnitTest
08-Mar-2013 08:30:29 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:30 [junit] Test com.ge.corporate.taxes.spp.security.FakeSecurityServiceForUIUnitTest FAILED
08-Mar-2013 08:30:30 [junit] Running com.ge.corporate.taxes.spp.security.InterceptorHelperUnitTest
08-Mar-2013 08:30:30 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:30 [junit] Test com.ge.corporate.taxes.spp.security.InterceptorHelperUnitTest FAILED
08-Mar-2013 08:30:31 [junit] Running com.ge.corporate.taxes.spp.service.PeriodServiceUnitTest
08-Mar-2013 08:30:31 [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
08-Mar-2013 08:30:31 [junit] Test com.ge.corporate.taxes.spp.service.PeriodServiceUnitTest FAILED
08-Mar-2013 08:30:31
08-Mar-2013 08:30:31 junitreport:
08-Mar-2013 08:30:32 [junitreport] Processing /opt/bamboo_agent/agent02/xml-data/build-dir/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1/test-results/TESTS-TestSuites.xml to /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/null1004096308
08-Mar-2013 08:30:32 [junitreport] Loading stylesheet jar:file:/usr/share/java/ant-1.8.2/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
08-Mar-2013 08:30:33 [junitreport] Transform time: 934ms
08-Mar-2013 08:30:33 [junitreport] Deleting: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/null1004096308
08-Mar-2013 08:30:33
08-Mar-2013 08:30:33 BUILD FAILED
08-Mar-2013 08:30:33 /opt/bamboo_agent/agent02/xml-data/build-dir/SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1/build.xml:394: spp-unit-tests failed. See reports!
08-Mar-2013 08:30:33
08-Mar-2013 08:30:33 Total time: 32 seconds
08-Mar-2013 08:30:33 Failing task since return code was 1 while expected 0
08-Mar-2013 08:30:33 Parsing test results...
08-Mar-2013 08:30:33 Finished task 'Build SPP Unit Tests'
08-Mar-2013 08:30:33 Running post build plugin 'Artifact Copier'
08-Mar-2013 08:30:33 Running post build plugin 'JMeter Aggregator Build Processor'
08-Mar-2013 08:30:33 Running post build plugin 'NCover Results Collector'
08-Mar-2013 08:30:33 Running post build plugin 'Artifactory Release Management Staging'
08-Mar-2013 08:30:33 Running post build plugin 'Artifactory Build Info Copier'
08-Mar-2013 08:30:33 Running post build plugin 'Artifactory Gradle Properties Info Copier'
08-Mar-2013 08:30:33 Running post build plugin 'Clover Results Collector'
08-Mar-2013 08:30:33 Running post build plugin 'FindBugs Build Processor'
08-Mar-2013 08:30:33 Running post build plugin 'Cleanup Build Processor'
08-Mar-2013 08:30:33 Finalising the build...
08-Mar-2013 08:30:33 Stopping timer.
08-Mar-2013 08:30:33 Build SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1-61 completed.
08-Mar-2013 08:31:25 Running on server: post build plugin 'JMeter Aggregator Build Processor Server'
08-Mar-2013 08:31:25 Running on server: post build plugin 'NCover Results Collector'
08-Mar-2013 08:31:25 Running on server: post build plugin 'PMD Build Processor'
08-Mar-2013 08:31:25 Running on server: post build plugin 'Clover Delta Calculator'
08-Mar-2013 08:31:25 Running on server: post build plugin 'CheckStyle Delta Calculator'
08-Mar-2013 08:31:25 Running on server: post build plugin 'Sonar Build Password Processor'
08-Mar-2013 08:31:25 Running on server: post build plugin 'Build Hanging Detection Configuration'
08-Mar-2013 08:31:25 Running on server: post build plugin 'Maven Dependencies Postprocessor'
08-Mar-2013 08:31:25 Running on server: post build plugin 'FindBugs Server Build Processor'
08-Mar-2013 08:31:25 All post build plugins have finished
08-Mar-2013 08:31:26 Generating build results summary...
08-Mar-2013 08:31:26 Saving build results to disk...
08-Mar-2013 08:31:26 Indexing build results...
08-Mar-2013 08:31:26 Finished building SPPCIUNITTESTS-SPPCIUNITTESTS-JOB1-61.

1 answer

1 accepted

This widget could not be displayed.

The ClassNotFoundException being thrown from your JUnit tests basically means the JUnit tests cannot find the classes they are testing. Check the classpath for the target that runs the unit tests. Junit targets typically need a classpath or pathelement reference in them.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

61 views 2 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you