Is it possible to view tests written for IDEA's source code?

I'm a new plugin developer and I've already gone through the custom language tutorial here and the related testing tutorial here.

I have checked out the source code from https://github.com/JetBrains/intellij-community.git and am sifting through the source code trying to determine how IntelliJ IDEA's refactoring engine works (my end goal is to make a plugin that applies custom code changes and refactorings).

However, I do not see a test sources root in the working directory. If I try to switch configurations, the only testing one available is "Dart tests."

Where can I find the tests that test the actual IntelliJ IDEA source code?

Thanks,

LM

5 comments
Comment actions Permalink

There are more than 3000 of them. Almost each module has its own test source root. You can navigate to any test class or method and run it from context menu.
Untitled.png

0
Comment actions Permalink

Thanks Alexander. I was able to find the refactoring tests just by searching by name through the list. It would be nice, though, if there were a less overwhelming way that they were organized... :D

0
Comment actions Permalink

It is also worth noting that this approach requires:
1. navigating to lib/src/junit-4.12-sources.jar/junit/framework/TestCase.java,
2. right clicking the class name and choosing Go To > Implementation(s) from the context menu,
3. then picking a test by name that looks like it will be helpful.

I spent some amount of time in the classes I was trying to find related tests for (namely java/java-impl/src/com/intellij/refactoring/rename/RenameJavaVariableProcessor and platform/lang-impl/src/com/intellij/refactoring/rename/inplace/VariableInplaceRenamer) and choosing Go To > Test from the context menu, which doesn't actually help if there is no test (0 found) for that specific class.

0
Comment actions Permalink

This was not an approach, this was a proof thet repository contains tests. Nobody naviagtes to TestCase.java to find them :)
For your case you can simply guess that tests would be named like *Rename*Test. Just type it (even without asterisks) in Go To Class.
Or you could notice java-tests module next to the java-impl one where RenameJavaVariableProcessor is located and 'refactoring' package in it.
An do not use mouse and context menu. Remember shortcuts. I suggest to print Help | Default Keymap Reference.

0
Comment actions Permalink

I already have the keymap; I wrote my instructions in mouse/context menu terms so that the instructions would be OS independent (since I am using a Mac, it would be Alt-Cmd-B to go to Implementation(s) and Shift-Cmd-T to go to Test). I assume that is what you were doing as well; may I remind you that you also instructed in these terms: "You can navigate to any test class or method and run it from context menu." ;)

Thank you for the tip on finding tests with Go To Class. That is indeed a simpler way to find pertinent tests.

0

Please sign in to leave a comment.