Saturday, August 17, 2013

How to debug Maven tests in IntelliJ IDEA


In this blog post I'll describe how to debug Maven test in IntelliJ IDEA.




1. Create run configuration
First you need to create a run configuration that for JUnit tests in your project. Select menu item "Edit Configurations..." under "Run" menu. You will see the following window:


Now click the add button with the "+" icon and select "JUnit". The configuration for running JUnit tests will appear. Fill the fields in the appeared form in the following way:


Name - arbitrary name of the run configuration
Package - name of the package where sources of you projects reside
Search for tests - where sources from the specified package will be searched.

2. Start debugging
Now you can set a breakpoint and start debugging. To start debugging click "Debug <SelectedName>" under the "Run" menu.

That's all.
Have a good day.

4 comments:

  1. If I'm not mistaken that's far from running a Maven test. I'd have expected a tutorial on how to debug a test with "mvn test". So if you keep "make" you'll compile with your selected IDE compiler, which is not necessarily the Maven compiler.

    I'm not seeing anything about Maven here actually.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as
    Splitwise
    appvn

    ReplyDelete
  4. Congratulation for the great post. Those who come to read your Information will find lots of helpful and informative tips.
    home tutor in mumbai


    ReplyDelete