Search code examples
javaeclipsejuniteclipse-plugin

Eclipse function/plugin that finds corresponding junit class?


I've been searching high and low for an Eclipse feature that lets you right-click on a main source class and find the corresponding JUnit class(es), without me having to navigate through the test classes of my project. I am using Mylyn which helps reduce the clutter but it would be much easier if there was a feature that performs a find automagically.

I am following the Maven standard directory layout (/src/main/java, /src/test/java, etc.). And all of my test classes are named *Test. I'd imagine this can be feasibly implemented and probably already exists.

Is there a function or plugin in Eclipse that finds the corresponding JUnit test classes for a given main class?


Solution

  • The moreUnit plugin probably works for you.

    Capabilities (from its site):

    • Decorate classes which have a testcase.
    • Mark methods in the editor which are under test.
    • Jump to a testcase/testmethod in the editor via the menu or a shortcut.
    • Rename classes/methods and moreUnit will rename the corresponding testcode too.
    • Move classes and moreUnit will move the corresponding tests.
    • Generate a testmethod stub for the method under cursor-position in the editor via the menu or a shortcut.