Test intentions missing

Having a problem with the editor context menu. Goto..Test. For some reason it's only showing an option for "Create New Test..." it's not picking up the Test class it just created five minutes ago. This Test creation then fails because the Test class already exists. I've tried making the source and trying Goto Test again, but it made no difference.

I also can't seem to access the Test intentions for creating stubs for the class or method. The intentions are missing from the alt+insert generation menu? (ref: Creating Tests topic in the IDEA help).

Is there a prerequisite condition for these options to appear? IDEA seems happy to run junit4 tests and coverage for my project. Just not show any of the testing intentions or navigation to work as expected?

IDEA 12.1.1. (stock JRE) on Windows 7. I don't appear to have any test/junit plugins installed save the bundled one.


Issue is similar to http://stackoverflow.com/questions/8161058/intellij-mvn-project-test-classes-not-functioning but I've got the test folders marked up as such.

Guess the references to Generate..Test in the bundled IntelliJ Help is out-of-date. Pretty sure I always use 'Navigate' or 'Goto' actions, though now it's not working I was questioning myself.

Does my project need a recognised testing framework dependedancy for this to work? I do have them, but this project uses Apache Ivy / IvyIDEA not explict jar dependencies nor Maven POMs. It's also an Eclipse project, though the Eclipse plugin creates IDEA modules so this shouldnt matter.


Hi Richard,
1. IDEA is able to find your tests if they are named accordingly: it searches for all classes with names matching ".*" + klassName + ".*" and then accept only test classes. BTW The test won't be recognized as test if dependencies on junit/testng is not found. If your tests are named according to these rules and tests are runnable (IDEA suggest to run test configuration over them), please file a request with sample names/content
2. "Generate|Test Method/Setup/Tear Down" should be available in the generate menu in the editor: Alt-Insert.

To summarize: New test class is generated by Goto|Test and new test method is generated by Code|Generate.



The tests name pattern is standard. The Test class itself IDEA created via the Goto Test.. intention. The problem here is when I repeat the action it can't find the Test class it created and attempts to create a new class in the space location with the same name, which of course fails. So I can only create Test classes not Navigate to the existing Test sources.

I still don't see anything on the alt+insert / generate menu? I'll try adding an explict project library for junit to see if that helps work around IvyIDEA.


As you don't get generate menu seems that IDEA doesn't see any test framework attached. Does the jar appears in File|Project Structure dialog and is not highlighted there?


Tried adding a junit library, but it hasn't helped with the missing generate... items. Attached screenshot of the alt+insert menu I see when selecting on a public method of the class under test.

Also tried turning off all other custom plugins. All except IvyIDEA that is. Code won't compile without that and it's a big, complicated project. Might try that on a small test project instead.


Generate menu works inside test class only. Seems that http://youtrack.jetbrains.com/issue/IDEA-90247 would address your needs.
As for Goto|Test: could you please specify what is your class name is as well as the created test name. Thanks


Oh so test method stubs are not implemented by default. I've been doing that with IDEA for years, so I suspect I'm missing some custom plugin from my IDEA 12 config. Pretty sure it too attached to the Goto Test.. Navigation. Used to ask if I wanted a method stub with or without throwing execption. Which sounds very junit3-ish. Maybe it was years ago, have been using IDEA since version 2.

The Goto Test, creation of a Test class seems a bit shakey. Sometimes it fails to recognise Test classes it's created. If I delete the stub and repeat the procedure it seems to work. The failure seems intermittant and I can't see any reason why it can't find the classes when it fails. They're all in the test folder with the expected name.

Try again with the exact same name and it works and I can Navigate to the class. Wondering if it was timing related to the addtion of the extra junit library this morning (which duplicates my IvyIDEA junit configuration).


When you create a new test class it's possible to choose methods to generate tests for. It's a built-in functionality and use your file-templates for tests.


But I take it if the Test class already exists you can't add new method stubs? I'm not too concerned as a test per method is a bit dated in the test annortations world. Suspect this might be why I stopped using this junit plugin (that and junit4 syntax).

I can't declare a code template for the Test class created can I? Only for new Test classes in this project I mean? Want to add a bunch of static imports for junit, mockito & hamcrest matchers I commonly use.

The Goto Test... default way of creating Test classes seems to behave more consistently since adding the explict Junit library. Our Ant build does wipe out all lib folders as part of the build process. It does this before it resolves them again from our internal artifactory repo. I know this process is a bit hard on IDEA/IvyIDEA, but I'm in the minority of IDEA users here (solo user). Wonder if this churn is realted to it's intermittant missing Goto Test... navigation behaviour..?


Please sign in to leave a comment.