Problems with IntelliJ 2019.3 (Ultimate) and running jUnit build
Hi,
I have complex project and recently upgraded from 2019.2 to 2019.3 ultimate edition. I have several unit tests in this project. But something has changed since the upgrade. Now, if I want to run or debug a unit test in the IntelliJ, it waits a long time before the test is executed. I was surprised, but when I clicked on the "build" tab, I saw a full project build was "running" before the unit test being executed.
If I open the debug configuration window for my unit test, then I can see a "Build" step added in the "Before launch" section. If I remove that build step, then it becomes fine. But if I change something in the test class or in the class being tested, then it doesn't take any effect.
As I remember the previous version, it was enough to save the changes and I your run the test. The full project wan't built, I guess. I hadn't got to wait that long.
Is there any setting where I can set the required behaviour?
Any help would be appreciated!
Thank you!
Please sign in to leave a comment.
Do you use Maven or Gradle project?
Does it help if you change these options?
Hi Serge!
Thanks for the help! I use Maven. And the mentioned setting was ticked. After clearing it, it works fine, more precisely, it works, how it worked before. It looks the update made that checkbox selected.
Thanks again!
I now have the same issue after I updated from 2019 to 2020...
And the checkbox fixes the issue but in my oppinion the reason isn't solved with that...
If I right click on a class and select "Run XyzUnitTest" I want to realy get into the JUnit Runner Window because thats the reason I clicked on it...
But instead because of failing tests the Window does not open... Then why have the JUnit Runner in the first place if a failing maven test blocks it away.
I think Jetbrains should reconfigure the JUnit Run Configuration Template so that there is no "Build" in Before Launch but "Build, no error"
But I just notice that then it would even try to run the test if compilation would fail...
Hmm... but disabling the maven option is no good solution in my opinion.
Hello Tom-Henry Coursow,
Can you please describe in more details what behaviour do you expect to be changed?
Do you want to build the project with Maven and run the tests with IntelliJ Junit runner?
Seems that the current behaviour corresponds to the settings defined.
Please clarify. Thank you
Hi Olga,
I work with a comercial maven project setup which has about 1100 maven modules so it's a dependency and plugin hell :D
Most modules use JUnit Tests.
So if I changed some code... before doing a long time full build on the root project with maven clean install, I do a clean install on the modified modules first.
If they fail because of failing Unit Tests... I don't like to spot and hunt the errors by the maven output log...
So I just navigate to the File or sometimes the whole module and right click on it and press "Run XyzTest" / "Run all Tests" so that IntelliJ runs the Failing Tests again so that I can hunt the errors with better Test by Test output support so that I can click on the diffrent tests and see only the results I want.
So in case that it's something more diffecult I can do the same thing again with "Debug XyzTest" / "Debug all Tests".
I also do this when I do the full build and it fails... I then try to run the failing test with a JUnit Run configuration via right click.
But using the "Delegate IDE Build to Maven" option this does not work anymore... As the Maven Build fails because of failing tests and does not continue / open / start the JUnit Test runner with detailed seperated Test info...
Is it a bit more clear or is there still some information missing?
Best regards,
Tom
Hi Tom,
>And the checkbox fixes the issue but in my oppinion the reason isn't solved with that...
>But using the "Delegate IDE Build to Maven" option this does not work anymore... As the Maven Build fails because of failing tests and does not continue / open / start the JUnit Test runner with detailed seperated Test info...
>Hmm... but disabling the maven option is no good solution in my opinion.
Not sure I understand the problem. The Delegate IDE build/run actions to Maven option has always worked this way: when you have it enabled IDE uses Maven to build project and running the application and tests. When you have it disabled: IDE uses IDE's own builder and runner. And you should see the standard JUnit test results view as you always had had.
Why disabling the option does not help in your case? Note that with it disabled you are getting the previous behavior back.
I am facing the same issue. The code -> test cycle should be a quick one for TDD. In intellij I could run an individual test repeatedly after making minor changes frequently and it used to work fine but now each time I run the test it builds the whole project which takes like 5-10 mins and this is major blocker for TDD development. I am not sure what changed but something has. Is there any way you could go through changes around this functionality and see what has changed. I have below settings (unchanged)
EDIT:
The compiler was set to 'Ajc' in settings. Ajc compiler took eternity building on each run. After selecting 'javac' it is now working fine just like before. May be this could help others.