views:

24

answers:

1

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.

+1  A: 

Why not right click on the changed method and select "References->Workspace (or Working Set if configured properly)".

This should give you a list of methods invoking the one you just changed. The search results can be organized by package or project. Select project organization and expand the JUnit project and what you are looking for will likely be the only thing there.

Kris
If C is called by B, which is called by A, e.g. illustrated by C-B-A, and assuming A is the test method. When searching for references of C, it only shows B. Of course, we could again search for B's references, but it's better to use "call hierarchy" for this kind of "digging". However, for the project I'm working on, it's very typical that the call hierarchy gets very big like this ("-"means called by):C-B | D-E-F | G-H-I | R-S-T-<test method>It's time consuming to dig into the tree and find the test method. Is there a better way/tool?
IT-Worx