Reputation: 3717
I have been trying to run junit test but facing this issue constantly. I tried to look for answers on the internet but nothing helped.
]1
Upvotes: 16
Views: 33433
Reputation: 471
For me it was because two tests had the same name and namespace.
What actually happened: deleting a folder to which a class was pointing, convinced(?) PHPStorm to create a copy of the folder of the class.
Upvotes: -1
Reputation: 422
JUnit 5 and/or Intellij needs an extra dependency to be able to run tests:
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.9.2</version>
<scope>test</scope>
</dependency>
Upvotes: 0
Reputation: 12032
If there is an error e.g.
"
CommandLineWrapper
is ill-suited for launching apps on Java 9+..."
Then, try the following workaround in IntelliJ IDEA:
Run -> Edit configurations -> select the failed running config -> Shorten command line: @argfile (Java 9+) -> OK
Upvotes: 8
Reputation: 545
For IntelliJ 2019 and above go to :
Settings-> Build,Execution,Deployment -> Build Tools -> Maven -> Running Tests
and
Uncheck argLine
Upvotes: 6
Reputation: 1
For me also, the problem was that I made a change in the dependecies and the dependecy updated was incompatible in the SBT project.
Upvotes: 0
Reputation: 8641
For me the problem was that I had some incompatible/old dependencies in my SBT project.
I updated the versions of every 3rd party in the SBT config and running ZIO tests in IntelliJ started working.
Upvotes: 0
Reputation: 259
I had previously installed zulu and Oracle Java and then switched between the two quite a bit. I ended up having many JDKs
Here's what helped me.
In intelliJ, go to Run, the Edit Configurations. In the Run/Debug Configurations window, under Build and run section, select 'Java Bundled'.
To make sure this applies for all tests, click on the edit template icon (the spanner), select JUnit and then in the Build and run section select 'java Bundled'
Make sure all the configurations under JUnit has 'java Bundled' as well
Click Apply and Ok. Try to run the tests now and it should probably work.
Upvotes: 1
Reputation: 174
I had same issue but it has been resolved by updating the Intellij latest version 2020.3. Now i am able to run the test without any error. Please check below link for latest Intellij versions https://www.jetbrains.com/idea/download/
Upvotes: 0