Reputation: 60788
Eclipse does this very well with its TestNG plugin - I right-click a class I want to test, click "generate test," and a corresponding FooTest.java file will appear in src/test/java
.
So far, IntelliJ seems to have none of this intelligence. When I use Navigate > Test to create a test, I'm supposed to tell it where to create it... and if the test folder doesn't exist yet, I'll have to manually create that and the packages below test/java
as well. This is already really, really hacky-feeling.
Then I have to create a run configuration even though that should have been obvious from when the test class was created. Is there a more streamlined way to do all this?
IntelliJ IDEA 13.1, Community Edition.
Upvotes: 0
Views: 61
Reputation: 27094
Discalimer: I only use IDEA 13 Ultimate (or full, paid version if you like), so details could be different without me being aware...
Anyway: I think some of the problem is that if src/test/java
isn't there when you open the project (you do open project from pom.xml
, right?), IDEA won't configure test folders. It's not enough to simply create the folders afterwards, you also need to re-import the Maven module to get the test folders configured (they'll show up as green in project explorer, module settings etc.), or manually configure them in module settings.
You might have to tell IDEA where to create the test, but when things are properly set up, you should have sensible values pre-set for you, so you can just hit enter without really thinking.
When that is set up and the test class created, you should just have to right-click the class, class name or editor tab, and select Run (there's a shortcut as well, but I don't remember.. ;-). No need to set up a run configuration manually, a temporary one should be created for you when select Run the first time.
Upvotes: 2