由于无法编译的源代码,maven项目junit测试全部失败

时间:2010-12-16 15:27:00

标签: unit-testing testing junit maven surefire

运行mvn test-compile,一切都很好。 然后运行mvn test,由于无法编译的源代码,所有测试都将失败。以下是报告。这一直困扰着我几天。任何的想法?感谢。

<?xml version="1.0" encoding="UTF-8" ?>
    <testsuite failures="0" time="0.076" errors="2" skipped="0" tests="2" name="com.kibboko.poprocks.appservices.test.ContestTest">
      <properties>
        <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
        <property name="sun.boot.library.path" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries"/>
        <property name="java.vm.version" value="17.1-b03-307"/>
        <property name="awt.nativeDoubleBuffering" value="true"/>
        <property name="gopherProxySet" value="false"/>
        <property name="mrj.build" value="10M3261"/>
        <property name="java.vm.vendor" value="Apple Inc."/>
        <property name="java.vendor.url" value="http://www.apple.com/"/>
        <property name="path.separator" value=":"/>
        <property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
        <property name="file.encoding.pkg" value="sun.io"/>
        <property name="user.country" value="US"/>
        <property name="sun.java.launcher" value="SUN_STANDARD"/>
        <property name="sun.os.patch.level" value="unknown"/>
        <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
        <property name="user.dir" value="/Users/boxu/svn-checkout/maven/poprocks/trunk/app-services-test"/>
        <property name="java.runtime.version" value="1.6.0_22-b04-307-10M3261"/>
        <property name="java.awt.graphicsenv" value="apple.awt.CGraphicsEnvironment"/>
        <property name="basedir" value="/Users/boxu/svn-checkout/maven/poprocks/trunk/app-services-test"/>
        <property name="java.endorsed.dirs" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/endorsed"/>
        <property name="os.arch" value="x86_64"/>
        <property name="surefire.real.class.path" value="/var/folders/1P/1PucFK5nGcabpqNUAkgLM++++TY/-Tmp-/surefirebooter7894544689184454123.jar"/>
        <property name="java.io.tmpdir" value="/var/folders/1P/1PucFK5nGcabpqNUAkgLM++++TY/-Tmp-/"/>
        <property name="line.separator" value="
    "/>
        <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
        <property name="os.name" value="Mac OS X"/>
        <property name="sun.jnu.encoding" value="MacRoman"/>
        <property name="java.library.path" value=".:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java"/>
        <property name="surefire.test.class.path" value="/Users/boxu/svn-checkout/maven/poprocks/trunk/app-services-test/target/test-classes:/Users/boxu/svn-checkout/maven/poprocks/trunk/app-services-test/target/classes:/Users/boxu/.m2/repository/com/kibboko/poprocks/app-services/1.0/app-services-1.0.jar:/Users/boxu/.m2/repository/com/kibboko/poprocks/contest-core/1.0/contest-core-1.0.jar:/Users/boxu/.m2/repository/com/kibboko/poprocks/person-core/1.0/person-core-1.0.jar:/Users/boxu/.m2/repository/com/kibboko/poprocks/poprocks-foundation/1.0/poprocks-foundation-1.0.jar:/Users/boxu/.m2/repository/com/kibboko/foundation/foundation-core/1.1/foundation-core-1.1.jar:/Users/boxu/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/Users/boxu/.m2/repository/com/restfb/restfb/1.5.4/restfb-1.5.4.jar:/Users/boxu/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar:/Users/boxu/.m2/repository/com/kibboko/foundation/foundation-util/1.0/foundation-util-1.0.jar:/Users/boxu/.m2/repository/org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar:/Users/boxu/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/Users/boxu/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar:/Users/boxu/.m2/repository/org/hibernate/hibernate-entitymanager/3.5.0-Final/hibernate-entitymanager-3.5.0-Final.jar:/Users/boxu/.m2/repository/org/hibernate/hibernate-core/3.5.0-Final/hibernate-core-3.5.0-Final.jar:/Users/boxu/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar:/Users/boxu/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar:/Users/boxu/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/Users/boxu/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:/Users/boxu/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/Users/boxu/.m2/repository/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar:/Users/boxu/.m2/repository/org/hibernate/hibernate-annotations/3.5.0-Final/hibernate-annotations-3.5.0-Final.jar:/Users/boxu/.m2/repository/org/hibernate/hibernate-commons-annotations/3.2.0.Final/hibernate-commons-annotations-3.2.0.Final.jar:/Users/boxu/.m2/repository/cglib/cglib/2.2/cglib-2.2.jar:/Users/boxu/.m2/repository/asm/asm/3.1/asm-3.1.jar:/Users/boxu/.m2/repository/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar:/Users/boxu/.m2/repository/mysql/mysql-connector-java/5.1.13/mysql-connector-java-5.1.13.jar:/Users/boxu/.m2/repository/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar:/Users/boxu/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar:"/>
        <property name="java.specification.name" value="Java Platform API Specification"/>
        <property name="java.class.version" value="50.0"/>
        <property name="sun.management.compiler" value="HotSpot 64-Bit Server Compiler"/>
        <property name="os.version" value="10.6.5"/>
        <property name="http.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
        <property name="user.home" value="/Users/boxu"/>
        <property name="user.timezone" value=""/>
        <property name="java.awt.printerjob" value="apple.awt.CPrinterJob"/>
        <property name="java.specification.version" value="1.6"/>
        <property name="file.encoding" value="MacRoman"/>
        <property name="user.name" value="boxu"/>
        <property name="java.class.path" value="/Users/boxu/svn-checkout/maven/poprocks/trunk/app-services-test/target/test-classes:/Users/boxu/svn-checkout/maven/poprocks/trunk/app-services-test/target/classes:/Users/boxu/.m2/repository/com/kibboko/poprocks/app-services/1.0/app-services-1.0.jar:/Users/boxu/.m2/repository/com/kibboko/poprocks/contest-core/1.0/contest-core-1.0.jar:/Users/boxu/.m2/repository/com/kibboko/poprocks/person-core/1.0/person-core-1.0.jar:/Users/boxu/.m2/repository/com/kibboko/poprocks/poprocks-foundation/1.0/poprocks-foundation-1.0.jar:/Users/boxu/.m2/repository/com/kibboko/foundation/foundation-core/1.1/foundation-core-1.1.jar:/Users/boxu/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/Users/boxu/.m2/repository/com/restfb/restfb/1.5.4/restfb-1.5.4.jar:/Users/boxu/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar:/Users/boxu/.m2/repository/com/kibboko/foundation/foundation-util/1.0/foundation-util-1.0.jar:/Users/boxu/.m2/repository/org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar:/Users/boxu/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/Users/boxu/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar:/Users/boxu/.m2/repository/org/hibernate/hibernate-entitymanager/3.5.0-Final/hibernate-entitymanager-3.5.0-Final.jar:/Users/boxu/.m2/repository/org/hibernate/hibernate-core/3.5.0-Final/hibernate-core-3.5.0-Final.jar:/Users/boxu/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar:/Users/boxu/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar:/Users/boxu/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/Users/boxu/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:/Users/boxu/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/Users/boxu/.m2/repository/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar:/Users/boxu/.m2/repository/org/hibernate/hibernate-annotations/3.5.0-Final/hibernate-annotations-3.5.0-Final.jar:/Users/boxu/.m2/repository/org/hibernate/hibernate-commons-annotations/3.2.0.Final/hibernate-commons-annotations-3.2.0.Final.jar:/Users/boxu/.m2/repository/cglib/cglib/2.2/cglib-2.2.jar:/Users/boxu/.m2/repository/asm/asm/3.1/asm-3.1.jar:/Users/boxu/.m2/repository/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar:/Users/boxu/.m2/repository/mysql/mysql-connector-java/5.1.13/mysql-connector-java-5.1.13.jar:/Users/boxu/.m2/repository/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar:/Users/boxu/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar:"/>
        <property name="java.vm.specification.version" value="1.0"/>
        <property name="sun.arch.data.model" value="64"/>
        <property name="java.home" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"/>
        <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
        <property name="user.language" value="en"/>
        <property name="awt.toolkit" value="apple.awt.CToolkit"/>
        <property name="java.vm.info" value="mixed mode"/>
        <property name="java.version" value="1.6.0_22"/>
        <property name="java.ext.dirs" value="/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext"/>
        <property name="sun.boot.class.path" value="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar"/>
        <property name="java.vendor" value="Apple Inc."/>
        <property name="localRepository" value="/Users/boxu/.m2/repository"/>
        <property name="file.separator" value="/"/>
        <property name="java.vendor.url.bug" value="http://bugreport.apple.com/"/>
        <property name="sun.cpu.endian" value="little"/>
        <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
        <property name="mrj.version" value="1060.1.6.0_22-307"/>
        <property name="socksNonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
        <property name="ftp.nonProxyHosts" value="local|*.local|169.254/16|*.169.254/16"/>
        <property name="sun.cpu.isalist" value=""/>
      </properties>
      <testcase time="0" classname="com.kibboko.poprocks.appservices.test.ContestTest" name="com.kibboko.poprocks.appservices.test.ContestTest">
        <error message="Uncompilable source code" type="java.lang.RuntimeException">java.lang.RuntimeException: Uncompilable source code
        at com.kibboko.poprocks.appservices.test.ContestTest.setUpClass(ContestTest.java:51)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
    </error>
      </testcase>
      <testcase time="0.004" classname="com.kibboko.poprocks.appservices.test.ContestTest" name="com.kibboko.poprocks.appservices.test.ContestTest">
        <error message="Uncompilable source code" type="java.lang.RuntimeException">java.lang.RuntimeException: Uncompilable source code
        at com.kibboko.poprocks.appservices.test.ContestTest.tearDownClass(ContestTest.java:75)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:37)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
    </error>
      </testcase>
    </testsuite>

1 个答案:

答案 0 :(得分:0)

test-compile仅编译测试。我认为您的应用程序中存在无法编译的代码,而不是您的测试代码。尝试运行mvn compile。