JUnit 5 not working with IntelliJ IDEA anymore - java

I had this working 3 day's ago and then since I pulled some code down from me and my buddies git repo, Junit 5 won't work anymore. Like I said, I was able to run Junit unit tests before I pulled from the repo now I can't. Here are print screens with more info.
I have checked the path listed for Junit dependancies and the jar files do exist there. I definitely have Junit on my computer as I had unit tests working before and I did not delete any files since. Any help would be wonderful as I have been wrestling and searching this for some time now.

You should try updating to the latest Intellij 2017.3, as they state that they improved their Junit 5 support.

Related

JUnit tests works in IntelliJ but fails on eclipse and build server

I'm just confused why the same test works in IntelliJ but not in Eclipse or the Azure build server.
It would help to share the code I think, I just fill out a login Page and click some buttons.
For some reason that's to fast for eclipse and the build server, but I why it works normally on IntelliJ?
I'm new to IntelliJ and I also tried to disable the JUnit Plugin, but this won't help because you can't run any test without it.
EDIT: I also tried it in VS Code, with the Extension Pack for Java and it works the same way like in Eclipse.
I don't know what is different to IntelliJ, but something is wrong there.
I don't know the reason but I guess the problem is that IntelliJ is a little bit slower then the other IDE's on executing JUnit tests / or slower when using Appium.

Is JUnit5 backward compatible to JUnit4?

I did google quite a bit; but I could neither find a source saying "of course it is" nor one going "no, it isn't; and here it breaks".
We have about 2000 unit tests of very varying quality, using EasyMock, PowerMock, Mockito; and I am simply wondering: is there a reasonable chance that those 2000 testcases just work when switching to JUnit5; or is that so unlikely that I better not spend a single second trying?
In other words: I am looking for answers that can confirm "yes, it worked for our large code base"; or "no, it is not at all that easy".
As stated by the JUnit 5 User Guide:
Just make sure that the junit-vintage-engine artifact is in your test runtime path. In that case JUnit 3 and JUnit 4 tests will automatically be picked up by the JUnit Platform launcher.
See the example projects in the junit5-samples repository to find out how this is done with Gradle and Maven.
http://junit.org/junit5/docs/current/user-guide/
junit-vintage-engine is for running junit4 or 3 so it looks like it
'JUnit Vintage test engine implementation that allows to run vintage JUnit tests, i.e. tests written in the JUnit 3 or JUnit 4 style, on the new JUnit Platform.'
My current assessment regarding regarding our projects is to stay with JUnit 4.12 for the moment.
As of now, we our build setup is "different" for eclipse and our "backend build"; meaning: we can't use maven/gradle to build within eclipse. And I simply failed to just identify/download the JARs I would need to replace the junit-4.12.jar within our eclipse setup; not even thinking about also providing some (but which) other JARs in order to have JUnit 5 available.

Cannot run junit tests in IntelliJ

I am trying to run some junit tests within Intellij 14 on Windows 7. I have run these tests before, many many times, without issue.
Yesterday, I started getting the error on SOME tests only:
java.lang.SecurityException: sealing violation: package xxx is sealed
I cannot google up a satisfactory answer to this. I initially thought it was something odd that suddenly went wrong in intellij 15, so I reverted back to 14 (cleaned up the settings folder too) but same issue.
Same tests, run from Linux using an ant script and the same jar file run just fine.
What does this error mean and what must I do to fix it?
It sounds like you could have a class that is being packed into multiple jar. Do you have a production jar and maybe a test jar which share some class between them?

Intellij test run history

What I miss the most in IntelliJ compared to Eclipse is the test run history window. Does anything like this exist in IntelliJ? I didn't find it anywhere so far and have looked a few times at least.
In our project we have ~500 integration test cases which take like 5 minutes to run from IDE. Often I have a situation where for e.g. 5 tests fail in 2-3 different classes. I fix something, that should remove failures from first test suite, rerun it to see if it helped and I must rerun all 500 tests to see which classes contained failures earlier. That is really painful. In eclipse I would just lookup those in test history, repair them also and finally run all 500 to check if nothing new camed up.
Is there a plugin out there or do I miss something obvious?
I use IntelliJ 13.
You can right-click a tab with test results and select the "Pin Tab" option from the context menu. Then further test executions will not overwrite this tab, and you can still refer to it to see which other tests you need to fix.
On the current version of Intellij (2016), you have now a way to reimport older test Result. On the runner tab, click on the button "Import test Results", and select the one you want
EDIT : In the latest version, you have a "Recent Tests" action which allow you to see older test result without a need to open the rest windows. Shortcut Ctrl+Shift+Semicolon
You can also click the "Test History" button to see the old tests result.
Not relevant for Idea 13, but in 2021 this functionality is present in Idea.
https://www.jetbrains.com/help/idea/viewing-and-exploring-test-results.html#view-previous
Yes, given that you are using the IntelliJ test runner (rather than running the tests via maven), you can use the Rerun Failed Tests function.
https://www.jetbrains.com/idea/help/rerunning-tests.html
Edit: based on your comment, can I suggest you run the single test you are working on in "debug" mode, this won't erase the history of your compelte test suite, and you can do that in in combination with the Rerun Failed Tests as needed.

Where is Junit's Tools-> create unit test in NB 7.3.1

I have recently installed NB 7.3.1, and installed the JUnit plugin. In the old days, JUnit was bundled with NetBeans. I used it all that time.
I want to use it now, but I can't find any command, button, tool, etc to cause Netbeans to create the shell unit tests for me.
What am I doing wrong? How do I find it?
Thx
Make sure you have a test folder. Go to your project properties, and under Sources, in Test Package Folders, make sure you have at least one folder where you want to put your test sources.
If the button is still greyed out after that, you can go to File > New File > Unit Tests > JUnit Test. If it gives you an error message, it may help you solve the problem.

Categories

Resources