在Eclipse中运行单个JUnit测试 [英] Running a single JUnit test in Eclipse

查看:118
本文介绍了在Eclipse中运行单个JUnit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个具有多个测试的测试套件,当我尝试运行单个单元测试时,无论是从代码编辑器的上下文菜单还是从JUnit视图中,似乎都坚持要始终运行整个套件,而不是单次测试。有没有办法禁用更改这种行为,以便我可以要求运行它,只有这样才能测试。

解决方案

在包资源管理器中展开类。它应该告诉你所有的方法。右键单击要运行的一种方法,然后从上下文菜单中选择Run As - > JUnit(仅使用Eclipse 3.4.1测试)。在JUnit结果视图中的单个条目上也选择运行以重新运行测试工作方式相同。


If I have a test suite with multiple tests, when I try to run a single unit test, either from the context menu of the code editor, or from the JUnit view, it seems to insist on always running the entire suite, rather than the single test. Is there a way to disable to change this behavior so that I can ask to to run that, and only that, test.

解决方案

In the package explorer unfold the class. It should show you all methods. Right click on the one method you want to run, then select Run As -> JUnit from the context menu (just tested with Eclipse 3.4.1). Also selecting "Run" on a single entry in the JUnit-results view to re-run a test works in the same way.

这篇关于在Eclipse中运行单个JUnit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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