从调用层次结构中隐藏单元测试

发布于 2025-01-06 00:59:57 字数 310 浏览 2 评论 0原文

在“调用层次结构”视图中,它显示了调用所选方法的所有方法。我希望能够过滤掉 src/test/java 中的所有内容,这样我就可以看到实际代码正在调用什么,而不是 100 个单元测试方法。

我尝试在 Test 上添加名称过滤器,但似乎不起作用。我认为过滤器是基于方法名称的,而且我使用的是 JUnit 4,所以方法名称不包含 test,只是一个注释,尽管我们的类名称通常以 Test 或 TestIT 结尾。还有其他方法可以根据源文件夹或类名称进行过滤吗?

我使用 Indigo 和 M2Eclipse 来配置标准 Java 项目。

谢谢,

In the "Call Hierarchy" View, it shows all methods calling a selected method. I'd like to be able to filter out everything in src/test/java so I can see what actual code is calling, instead of 100 Unit test methods.

I tried adding a name filter on Test but it didn't seem to work. I think that filters based on method name, and I'm using JUnit 4 so method names don't contian test, just an annotation, though our class names generally end in Test or TestIT. Any other ways to filter based on source folder or Class name?

I'm using Indigo with M2Eclipse to configure standard Java projects.

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

楠木可依 2025-01-13 00:59:57
  1. 在“呼叫层次结构”视图中,单击白色向下箭头图标。
  2. 选择“过滤器...”。
  3. 检查“过滤器测试代码”。
  4. 单击刷新按钮(或按 F5)。

测试类和方法不应该再可见。

Eclipse Photon 中添加了“过滤器测试代码”复选框。在早期版本中,您可以选择“命名过滤模式”复选框,并根据命名约定过滤测试(例如,如果类以“Test”结尾,则输入*Test)。

  1. In the Call Hierarchy view, click the white downwards arrow icon.
  2. Select "Filters...".
  3. Check "Filter Test Code".
  4. Click the refresh button (or press F5).

The test classes and methods should not be visible anymore.

The "Filter Test Code" checkbox was added in Eclipse Photon. In earlier versions, you can select the "Name filter patterns" checkbox and filter tests based on your naming convention (e.g. if the classes end with "Test" then enter *Test).

辞取 2025-01-13 00:59:57

您可以定义一个仅包含 Java 源代码但不包含单元测试的工作集,然后选择“搜索范围”>呼叫层次结构视图菜单中的工作集...。

搜索帮助以获取有关工作集的更多详细信息。

You can define a Working Set that only includes Java source but excludes your unit tests, then select Search Scope > Working Set... in the Call Hierarchy view menu.

Search the help for more details on Working Sets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文