如何查找直接或间接使用给定Java方法的Junit测试 [英] How to find Junit tests that are using a given Java method directly or indirectly

查看:132
本文介绍了如何查找直接或间接使用给定Java方法的Junit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设Eclipse工作区中有Java项目和Junit项目。并且所有的单元测试都位于Junit项目中,并且依赖于应用程序Java项目。在更改Java方法时,需要直接或间接查找使用该方法的单元测试,以便在进行源代码控制之前,可以在本地PC中运行相应的测试。我不想运行整个junit项目,因为它需要时间。



我可以使用Eclipse调用层次结构逐个扩展调用方法,直到找到一个测试方法。但是对于包含100多万行源代码的项目,挖掘调用层次结构也需要时间。



调用层次结构视图中的搜索范围似乎没有帮助



欣赏任何帮助。

解决方案

工具。看到我的答案:



如何查找可能直接或间接调用给定方法的所有单元测试? (.net)


Assume there are Java project and Junit project in an Eclipse workspace. And All the unit tests are located in the Junit project and dependent on the application Java project. When making changes to a Java method, I need to find the unit tests that are using the method directly or indirectly, so that I can run the corresponding tests locally in my PC before checking into source control. I don't want to run the entire junit project since it takes time.

I could use Eclipse call hierarchy to expand caller methods one by one until I find a test method. But for a project including more than 1 million lines of source code, digging down the call hierarchy takes time too.

The search scope within call hierarchy view doesn't seem help much.

Appreciate any help.

解决方案

Use a test coverage tool. See my answer:

How do I find all the unit tests that may directly or indirectly call a given method? (.net)

这篇关于如何查找直接或间接使用给定Java方法的Junit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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