• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ANT and JUnit fork problem

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am able to run my Junits in single thread. But when fork=true the Junits fail and I am unable to figure out why.



Following is output for ant -debug

Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.5 in: E:\java1.5\jre
Detected OS: Windows 2003
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file -> E:\cruisecontrol_work_dir\*****\build.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile *****\build.xml with URI = file:/E:/cruisecontrol_work_dir*****/build.xml
Setting ro project property: ant.project.name -> SIMPLE
............
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
.............
[junit] Couldn't find junit/framework/TestCase.class
[junit] Found E:\software\apache-ant-1.7.1\lib\ant-launcher.jar
[junit] Found E:\software\apache-ant-1.7.1\lib\ant.jar
[junit] Found E:\software\apache-ant-1.7.1\lib\ant-junit.jar
fileset: Setup scanner in dir E:\cruisecontrol_work_dir\*****\WebContent\WEB-INF\lib with patternSet{ includes: [junit*.jar] excludes: [] }
Finding class junit.framework.Test
Loaded from E:\cruisecontrol_work_dir\projects\****\WebContent\WEB-INF\lib\junit-4.4.jar junit/framework/Test.class
Class java.lang.Object loaded from parent loader (parentFirst)
Class junit.framework.Test loaded from ant loader (parentFirst)
Finding class org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirrorImpl
Loaded from E:\software\apache-ant-1.7.1\lib\ant-junit.jar org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskMirrorImpl.class
Class org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirror loaded from parent loader (parentFirst)
Class java.lang.Throwable loaded from parent loader (parentFirst)
Finding class junit.framework.AssertionFailedError
Loaded from E:\cruisecontrol_work_dir\projects\******\WebContent\WEB-INF\lib\junit-4.4.jar junit/framework/AssertionFailedError.class
Class java.lang.AssertionError loaded from parent loader (parentFirst)
Class junit.framework.AssertionFailedError loaded from ant loader (parentFirst)
Class org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirror$SummaryJUnitResultFormatterMirror loaded from parent loader (parentFirst)
Class java.lang.ClassLoader loaded from parent loader (parentFirst)
Class org.apache.tools.ant.AntClassLoader loaded from parent loader (parentFirst)
Class org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirror$JUnitTestRunnerMirror loaded from parent loader (parentFirst)
Class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask loaded from parent loader (parentFirst)
fileset: Setup scanner in dir E:\cruisecontrol_work_dir\projects\******\unitTest with patternSet{ includes: [**/*Test.java] excludes: [] }
[junit] Implicitly adding E:\software\apache-ant-1.7.1\lib\ant-launcher.jar;E:\software\apache-ant-1.7.1\lib\ant.jar;E:\software\apache-ant-1.7.1\lib\ant-junit.jar to CLASSPATH
[junit] Executing 'E:\java1.5\jre\bin\java.exe' with arguments:
[junit] '-Xms512m'
[junit] '-Xmx1024m'
[junit] '-classpath'
[junit] 'E:\cruisecontrol_work_dir\projects\******\WebContent\WEB-INF\lib\junit-4.4.jar;E:\cruisecontrol_work_dir\projects\****\build-cobertura;E:\cruisecontrol_work_dir\projects\****\unitTest;E:\software\apache-ant-1.7.1\lib\ant-launcher.jar;E:\software\apache-ant-1.7.1\lib\ant.jar;E:\software\apache-ant-1.7.1\lib\ant-junit.jar'
[junit] 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
[junit] 'com.bt.dalian.si.SingleWebServiceTest'
[junit] 'filtertrace=true'
[junit] 'haltOnError=false'
[junit] 'haltOnFailure=false'
[junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
[junit] 'showoutput=true'
[junit] 'outputtoformatters=true'
[junit] 'logtestlistenerevents=true'
[junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,E:\cruisecontrol_work_dir\projects\******\unitTest\reports\TEST-com.bt.dalian.si.SingleWebServiceTest.xml'
[junit] 'crashfile=E:\cruisecontrol_work_dir\projects\******\junitvmwatcher32572.properties'
[junit] 'propsfile=E:\cruisecontrol_work_dir\projects\******\junit32573.properties'
[junit]
[junit] The ' characters around the executable and arguments are
[junit] not part of the command.
Execute:Java13CommandLauncher: Executing 'E:\java1.5\jre\bin\java.exe' with arguments:
'-Xms512m'
'-Xmx1024m'
'-classpath'
'E:\cruisecontrol_work_dir\projects\******\WebContent\WEB-INF\lib\junit-4.4.jar;E:\cruisecontrol_work_dir\projects\******\build-cobertura;E:\cruisecontrol_work_dir\projects\******\unitTest;E:\software\apache-ant-1.7.1\lib\ant-launcher.jar;E:\software\apache-ant-1.7.1\lib\ant.jar;E:\software\apache-ant-1.7.1\lib\ant-junit.jar'
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
'com.bt.dalian.si.SingleWebServiceTest'
'filtertrace=true'
'haltOnError=false'
'haltOnFailure=false'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
'showoutput=true'
'outputtoformatters=true'
'logtestlistenerevents=true'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,E:\cruisecontrol_work_dir\projects\******\unitTest\reports\TEST-com.bt.dalian.si.SingleWebServiceTest.xml'
'crashfile=E:\cruisecontrol_work_dir\projects\******\junitvmwatcher32572.properties'
'propsfile=E:\cruisecontrol_work_dir\projects\******\junit32573.properties'

The ' characters around the executable and arguments are
not part of the command.
[junit] Running com.bt.dalian.si.SingleWebServiceTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
Setting project property: test.failed -> true
[junit] Implicitly adding E:\software\apache-ant-1.7.1\lib\ant-launcher.jar;E:\software\apache-ant-1.7.1\lib\ant.jar;E:\software\apache-ant-1.7.1\lib\ant-junit.jar to CLASSPATH

[junit] Executing 'E:\java1.5\jre\bin\java.exe' with arguments:
[junit] '-Xms512m'
[junit] '-Xmx1024m'
[junit] '-classpath'
[junit] 'E:\cruisecontrol_work_dir\projects\******\WebContent\WEB-INF\lib\junit-4.4.jar;E:\cruisecontrol_work_dir\projects\******\build-cobertura;E:\cruisecontrol_work_dir\projects\******\unitTest;E:\software\apache-ant-1.7.1\lib\ant-launcher.jar;E:\software\apache-ant-1.7.1\lib\ant.jar;E:\software\apache-ant-1.7.1\lib\ant-junit.jar'
[junit] 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
[junit] 'com.******.action.QueueBeanTest'
[junit] 'filtertrace=true'
[junit] 'haltOnError=false'
[junit] 'haltOnFailure=false'
[junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
[junit] 'showoutput=true'
[junit] 'outputtoformatters=true'
[junit] 'logtestlistenerevents=true'
[junit] 'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,E:\cruisecontrol_work_dir\projects\******\unitTest\reports\TEST-com.******.action.QueueBeanTest.xml'
[junit] 'crashfile=E:\cruisecontrol_work_dir\projects\******\junitvmwatcher32574.properties'
[junit] 'propsfile=E:\cruisecontrol_work_dir\projects\******\junit32575.properties'
[junit]
[junit] The ' characters around the executable and arguments are
[junit] not part of the command.
Execute:Java13CommandLauncher: Executing 'E:\java1.5\jre\bin\java.exe' with arguments:
'-Xms512m'
'-Xmx1024m'
'-classpath'
'E:\cruisecontrol_work_dir\projects\******\WebContent\WEB-INF\lib\junit-4.4.jar;E:\cruisecontrol_work_dir\projects\******\build-cobertura;E:\cruisecontrol_work_dir\projects\******\unitTest;E:\software\apache-ant-1.7.1\lib\ant-launcher.jar;E:\software\apache-ant-1.7.1\lib\ant.jar;E:\software\apache-ant-1.7.1\lib\ant-junit.jar'
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
'com.******.action.QueueBeanTest'
'filtertrace=true'
'haltOnError=false'
'haltOnFailure=false'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.SummaryJUnitResultFormatter'
'showoutput=true'
'outputtoformatters=true'
'logtestlistenerevents=true'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,E:\cruisecontrol_work_dir\projects\******\unitTest\reports\TEST-com.******.action.QueueBeanTest.xml'
'crashfile=E:\cruisecontrol_work_dir\projects\******\junitvmwatcher32574.properties'
'propsfile=E:\cruisecontrol_work_dir\projects\******\junit32575.properties'

The ' characters around the executable and arguments are
not part of the command.
[junit] Running com.******.action.QueueBeanTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
Override ignored for property "test.failed"
[junit] Implicitly adding E:\software\apache-ant-1.7.1\lib\ant-launcher.jar;E:\software\apache-ant-1.7.1\lib\ant.jar;E:\software\apache-ant-1.7.1\lib\ant-junit.jar to CLASSPATH

[junit] Executing 'E:\java1.5\jre\bin\java.exe' with arguments:
[junit] '-Xms512m'
[junit] '-Xmx1024m'



I have checked for CLASSPATH. CLASSPATH is not set on my system and so weblogic.jar is also not on it.

The Tests just show:

[junit] Test com.bt.dalian.si.SingleWebServiceTest FAILED
[junit] Test com.bt.dalian.simple.action.QueueBeanTest FAILED




Any debugging pointers??

Thanks,
Nirmal
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try adding <pathelement path="${java.class.path}" /> to your test.classpath. This ensures that spawned process includes the same classpath used by the original ant JVM. Note that the ${java.class.path} is a JVM provided property.

So you should have something like this:

 
Ikenna Nwaiwu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, set printsummary=false , and add <formatter type="plain" usefile="false"/> to the junit target to get a better error message for the failing test.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic