How to find Junit tests that use this Java method directly or indirectly

Suppose you have a Java project and a Junit project in your Eclipse workspace. And all unit tests are in the Junit project and depend on the Java application project. When making changes to the Java method, I need to find unit tests that use the method directly or indirectly so that I can run the corresponding tests locally on my PC before checking the initial control. I do not want to run the entire junit project since it takes time.

I could use the Eclipse call hierarchy to expand the caller's methods one by one until I find a test method. But for a project with over 1 million lines of source code, digging up a call hierarchy also takes time.

The search area in the call hierarchy view does not help much.

Appreciate any help.

+6
scope eclipse junit
source share
2 answers

Use the testing tool. See my answer:

How to find all unit tests that can directly or indirectly call this method? (.net)

+2
source share

Why not right-click on the changed method and select "Links → Workspace (or Workspace, if it is configured correctly)".

This should give you a list of methods that call the one you just changed. Search results can be organized by package or project. Choose a project organization and expand your JUnit project, and what you are looking for is likely to be the only one.

+1
source share

All Articles