Feature: Goto Test

Issue #1210 resolved
Justin Julicher created an issue

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.

  1. If there is a file name MyClass.cls or MyTrigger.trigger a matching Test class would be 'MyClass.cls' and would go that way,.
  2. 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 {



  *  @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)

  1. Scott Wells repo owner

    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.

  2. Justin Julicher 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.

  3. Justin Julicher reporter

    Also, in Webstorm I don't seem to have the Go to Related functionality... perhaps thats an IntelliJ only function...


  4. Scott Wells 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.

  5. Log in to comment