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

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

问题描述

如果我有一个包含多个测试的测试套件,当我尝试运行单个单元测试时,无论是从代码编辑器的上下文菜单,还是从 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.

推荐答案

在包资源管理器中展开类.它应该向您展示所有方法.右键单击要运行的一种方法,然后从上下文菜单中选择 Run As -> JUnit(刚刚使用 Eclipse 3.4.1 进行了测试).同样在 JUnit-results 视图中的单个条目上选择运行"以重新运行测试以相同的方式工作.

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天全站免登陆