Quantcast
Channel: JetBrains Developer Community : All Content - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5481

Run Single Test Case with Maven

$
0
0

I cannot figure out how to configure IntelliJ's convenient "run from here" style test runner to work seemlessly with Maven.

 

I understand that I can execute all of a maven project's unit/integration tests by running the Maven Build for a given phase under Maven Projects, but I want finer granularity control than that.

 

Without Maven, you can right-click on a test class/method in IntelliJ and select "Run..." (or "Debug..." for that matter) and it automatically compiles and runs just what you've selected. When I try to do this with a Maven project, it fails because it tries to build using IntelliJ (and our build is much too complicated for that to work).

 

How can I configure the handy "run unit test from here" functionality to run the maven test/integration-test build phase for the containing project by default? Manually creating a Run/Debug Configuration every single time I want to test a method/class, for each method/class I want to test, is beyond tedious. I usually just give up and run my tests with maven directly from the command line.

 

Any help/suggestions are greatly appreciated.

 

Thanks!


Viewing all articles
Browse latest Browse all 5481