junit.framework.AssertionFailedError:在 xyz 包中找不到测试 [英] junit.framework.AssertionFailedError: No tests found in xyz package

查看:39
本文介绍了junit.framework.AssertionFailedError:在 xyz 包中找不到测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试从 ANT 任务运行 Junits 时出现此错误.使用 eclipse 启动器它工作正常.junit 版本是 4.9,ANT 版本是 1.7令人惊讶的是,它给出了junit.framework.AssertionFailedError",这是 JUNIT 3 中的包结构.,在 4 中它已更改为 org.junit.我交叉检查了所有库,并且没有 junit 3.* 版本的参考——无论如何它使用 eclipse 启动器工作.有什么线索吗?让我知道是否需要更多细节.Ant任务如下

I am getting this error when I try to run Junits from ANT task. using eclipse launcher it works fine. Version of junit is 4.9 and ANT version is 1.7 Surprisingly its giving "junit.framework.AssertionFailedError" which was package structure in JUNIT 3., in 4 it has changed to org.junit. I cross checked all libs and there is NO reference of junit 3.* version --and its working anyway using eclipse launcher. Any clue? Let me know if more detail is needed. Ant task is as follows

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

推荐答案

你应该检查一下,junit.jarant-junit.jar ant 正在尝试使用哪个并确保它们适用于 JUnit 4.看看 http://ant.apache.org/manual/Tasks/junit.html 是放置它们的最佳位置.

You should check, which junit.jar and ant-junit.jar ant is trying to use and make sure, they are for JUnit 4. Take a look at http://ant.apache.org/manual/Tasks/junit.html for the best place to put them.

这篇关于junit.framework.AssertionFailedError:在 xyz 包中找不到测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆