Feature: Goto Test
I liked how in intellij when editing java files you could easily press the shortcut key ctrl-shift-T or something similar to go to the associated test file.
It would be great to have the same functionality in IC defined 2 ways perhaps.
- If there is a file name MyClass.cls or MyTrigger.trigger a matching Test class would be 'MyClass.cls' and would go that way,.
- Introduce a ApexDoc annotation
@Tests
for both the Test file and class/trigger files so you can specify the tests. e.g.
/**
* @author jjulicher,
* @see RelatedClass
* @tests MyClassTest,
*/
public class MyClass {
}
or
/**
* @author JJulicher
* @see RelatedClass
* @Tests MyClass, MyClass2
*/
public class MyClassTest {
}
In addition to this if you could at the file like you have done for the .meta-xml files to the sub-tab Source|Metadata as additional tabs that would be great so you could alt-shift-left/right to navigate between source & tests super quickly.
Comments (7)
-
repo owner -
reporter Hi Scott,
Sorry not sure if you mis-understood me. Didn't really mean 'Apex user defined annotations' but more along the lines of the
@see
documentation comment/annotation.Sorry if I wasn't clear about that in my examples. I've updated to include the
@see
and@author
comments. -
reporter - edited description
-
reporter Also, in Webstorm I don't seem to have the Go to Related functionality... perhaps thats an IntelliJ only function...
thanks
-
repo owner Justin, that action is under Navigate>Related Symbol.... On Windows/Linux it's Ctrl+Alt+Home, and on Mac it's Ctrl+Cmd+Up.
As for the doclet-style recommendation, that makes more sense. However, this is a situation where the IDE should be able to determine the relationship between production code and test code, and in fact it does right now, but only at the class-level, not at the method-level. Give Go To Related a try and see if it doesn't provide what you're wanting since it automatically determine what would be the manually-maintained values for
@Tests
. -
reporter Hi Scott
Goto Related is exactly what I wanted!
Thanks!
Closing.
-
reporter - changed status to resolved
Goto Related is the same functionality.
- Log in to comment
Justin, you can use the Go to Related action now to navigate between product classes and test classes. Note that Apex doesn't have user-defined annotations, though, so it's currently not possible to add an
@Tests
annotation to Apex in a way that would be recognized pervasively.