2011-09-19 50 views
3

我在尝试从ANT任务运行Junits时遇到此错误。使用Eclipse启动器它工作正常。版本junit为4.9,ANT版本为1.7 令人惊讶的是,它给出了JUNIT 3中包装结构“junit.framework.AssertionFailedError”3. ,在4中它已经更改为org.junit。 我交叉检查所有库,并没有参考junit 3. *版本 - 和它的工作无论如何使用Eclipse启动器。 任何线索?让我知道是否需要更多细节。 Ant任务是如下junit.framework.AssertionFailedError:在xyz包中找不到测试

<target name="test"> 
    <junit fork="yes" haltonfailure="yes"> 
    <test name="${test.class.name}" /> 
    <formatter type="plain" usefile="false" /> 
    <classpath refid="junittest.classpath" /> 
    </junit> 
</target> 

回答

3

您应该检查,这junit.jarant-junit.jar蚂蚁试图使用,并确保他们是JUnit 4中,在http://ant.apache.org/manual/Tasks/junit.html看看为把他们的最佳场所。

+0

非常感谢ponter,ant-junit.jar不同步,它是1.6.2 – cpandey05

+1

只需添加:如果使用JUnit4,相应的ant-junit JAR文件是ANT_HOME/lib/ant-junit4 .jar'。如果我们错过了4并且使用了'ANT_HOME/lib/ant-junit.jar',那么我们会得到这个错误:'junit.framework.AssertionFailedError:No tests found'(这是ant 1.9.4版本,它有'ant-junit .jar'和'ant-junit4.jar') – arun

相关问题