JUnit 没有提供有关“错误"的信息. [英] JUnit gives no information regarding "errors"

查看:33
本文介绍了JUnit 没有提供有关“错误"的信息.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Junit 4.4 和 Ant 1.7.如果测试用例因错误而失败(例如,因为某个方法抛出了意外异常),我将无法获得有关错误是什么的任何详细信息.

I'm using Junit 4.4 and Ant 1.7. If a test case fails with an error (for example because a method threw an unexpected exception) I don't get any details about what the error was.

我的 build.xml 如下所示:

My build.xml looks like this:

<target name="test" depends="compile">
<junit printsummary="withOutAndErr" filtertrace="no" fork="yes" haltonfailure="yes" showoutput="yes">
  <classpath refid="project.run.path"/>
  <test name="a.b.c.test.TestThingee1"/>
  <test name="a.b.c.test.NoSuchTest"/>
</junit>
</target>

当我运行ant test"时,它说(例如)2次测试运行,0次失败,1次错误.它没有说没有像 NoSuchTest 这样的测试",即使这是完全合理的,并且可以让我找出错误的原因.

When I run "ant test" it says (for example) 2 Test runs, 0 failures, 1 error. It doesn't say "There is no such test as NoSuchTest" even though this is completely reasonable and would let me figure out the cause of the error.

谢谢!

-丹

推荐答案

想通了 :)

我需要在 junit 块中添加一个格式化程序".

I needed to add a "formatter" inside the junit block.

<formatter type="plain" usefile="false" />

什么是皮塔饼.

-丹

这篇关于JUnit 没有提供有关“错误"的信息.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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