request: open in > unit test

Answered

In large programs it can be taxing to navigate the file system a lot.

It would be nice to have a shortcut to open the unit test.  Obviously the other way is easy enough.  Something like “Open > Matching Unit test”, tho that would mean changing “Open In” to “Open”…

It would also be nice to have a way to jump to the resource or test-resource path of a class.  Only needed the first time a resource is added, but still… to create many sub-paths manually invites a typo.

0
5 comments

Hi Dan Royer , for the first request, we have a short cut of going to test.

For another request “jump to the resource or test-resource path of a class”, would you mind giving us more details? An example will be helpful. Thank you.

0

Oh!  Nice.

How annoying that it only shows up if I right-click on the class name.  It doesn't show up on the filename or the tab name.

0

Hi Dan Royer :

This behavior is by design and is related to how IntelliJ IDEA understands context.

1. “Go to Test” is a code-level action, not a file-level one. The Go to Test / Go to Test Subject action works on symbols (classes, methods), not on files. When you right-click the class name inside the editor, the IDE knows exactly which class you are targeting and can: Resolve its fully qualified name / Apply test-search rules (naming conventions, test frameworks, scopes)

2. When you right-click the Java file itself, IntelliJ only sees it as a file, not a specific symbol. A single file can contain: Multiple classes, Inner / nested classes, Package-private helper classes. 

Because of this ambiguity, the IDE does not offer “Go to Test” at the file level.

0

It should be possible to look in the file, confirm there's only one class at the top level, and off the “go to” option for that class.

0

Hi Dan Royer , I've created a feature request for this, please upvote and follow it to get updates.

https://youtrack.jetbrains.com/issue/IJPL-231201/Support-GOTO-in-the-context-menu-of-a-file

 

0

Please sign in to leave a comment.