在大纲视图中显示注释
我目前正在更新测试套件以使用 JUnit4 而不是 JUnit3。一切都很顺利,没有什么大问题,但在 Eclipse 中现在不太容易看到测试的布局。
我的意思是,使用 JUnit3,我可以在 Outline 视图中轻松查看 setUp
和 tearDown
方法。现在我使用 @Before
、@After
和其他注释,信息就不那么容易找到了。
我想要的是一种查看所有用 @Before 或其他注释注释的方法的方法。如果您愿意,可以使用注释的“查找用法”。
我是不是很愚蠢,这个选项就在我面前?
I'm currently updating a test suite to use JUnit4 instead of JUnit3. It's all going well, there's no big problems, but in Eclipse it's now less easy to see the layout of a test.
What I mean is that with JUnit3 I could look in the Outline view to see the setUp
and tearDown
methods very easily. Now that I'm using @Before
, @After
and other annotations that information isn't so easy to find.
What I'd like is a way of seeing all the methods annotated with @Before
or other annotations. A "find usages" for an annotation, if you like.
Am I being daft and the option is staring me in the face?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为标准 Eclipse 发行版中不存在这样的功能。我只是建议您继续使用此类方法的命名约定(例如,继续将它们称为
setUp
和tearDown
,这样您就可以在大纲视图中轻松找到它们。I do not think that such feature exists in standard Eclipse distribution. I just can recommend you to continue using naming conventions for such methods (e.g. continue call them
setUp
andtearDown
, so you will easily find them in outline view.不在大纲视图中,但在
References > 中工作区
(Ctrl-Shift-G) 也适用于注释,并像往常一样在搜索
视图中列出匹配项。您只能获得一种类型注释的列表,而且并不像浏览大纲视图那么容易。但即使在 JUnit 4 中,您仍然可以保留命名方案。Not in the outline view, but
References > Workspace
(Ctrl-Shift-G) does work for annotations also and lists the hits as usual in theSearch
view. You only get the list for one type of annotation, and it is not as easy as a glance at the outline view. But then you still could stay with the naming scheme even in JUnit 4.