"No tests were found" happens at random
Answered
I was happily working on my project just now, when I attempted to right-click the root of my project structure, and "Run 'All Tests'", when I got "No tests were found". I had done just the same thing 10 minutes prior, so I can't imagine why this is happening.
In addition, none of my scratches works either. Almost all imports now says "does not exist". I have attempted "Invalidate caches and restart" (several times) to no avail. What am I doing wrong?
This is my build.gradle:
plugins {
id 'org.springframework.boot' version '2.2.1.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group 'self.me'
version '1.0-SNAPSHOT'
//sourceCompatibility = 1.8
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
}
repositories {
mavenCentral()
}
test {
useJUnitPlatform()
}
dependencies {
compile group: 'org.jetbrains', name: 'annotations', version: '16.0.2'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// Feed parsing
compile group: 'org.jsoup', name: 'jsoup', version: '1.12.1'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
// Video parsing - FFMPEG wrapper
compile group: 'net.bramp.ffmpeg', name: 'ffmpeg', version: '0.6.2'
// SpringBoot
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.flywaydb:flyway-core'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
// Testing
def junit_version = '5.4.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junit_version
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junit_version
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: junit_version
testImplementation group: 'commons-io', name: 'commons-io', version: '2.6'
}
Please sign in to leave a comment.
May you share a sample project where the issue could be reproduced? You can share it privately as it described here:
https://intellij-support.jetbrains.com/hc/en-us/articles/206869619-Uploading-Large-Files-for-JetBrains-Support-Team
it happened to me too, tests not found.
i checked by project structure and noticed that i have groovy reference under libs, i removed it and tests are functional again
This happened to me after recently upgrading to UE 2019.3.3 from UE 2019.3.2
It happens for all unit tests, JUnit 4 and Spock.
It does not happen at random, it just happens always :-(
It worked in UE 2019.3.2.
I think I could give steps to reproduce the issue
prerequisite conditions
1. you have Spring Project configured ad the following (I will put my exact case it, might reproduce on other cases)
2. you go to test method or class and click on the test button to run/debug the test and, and chose run(it doesn't matter)
observe that IntelliJ will compile the test code and run it without problems
3. don't change the code and try to run the test again (whether from the button or test tab that appeared)
observe that IntelliJ will give you "no test were found
observe also if you change the code (whether the API and test method), it will recompile and test will work again
forget to mention IntelliJ setup, hope this info below be enough
IntelliJ IDEA 2019.3.3 (Ultimate Edition)
Build #IU-193.6494.35, built on February 11, 2020
Runtime version: 11.0.5+10-b520.38 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-88-generic
please contact me if you need more info
Hello,
Could you please check the issue with the latest stable build?
Also happens in my project: one test class is found, the other is not found.
It's not machine dependent, the exact same thing happens on a separate machine with the same installation.
JUnit 5 and Kotlin.
IntelliJ IDEA 2020.1 (Ultimate Edition)
Build #IU-201.6668.121, built on April 8, 2020
Runtime version: 11.0.6+8-b765.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1973M
Cores: 8
Non-Bundled Plugins: ru.trylogic.idea.gitlab.integration, mobi.hsz.idea.gitignore, org.jetbrains.plugins.go, com.intellij.kubernetes, org.jetbrains.kotlin
Michael,
Is it possible to provide sample project example for investigation?
UPDATE: Sorry it has been a minute. This problem cropped up in 2019.3.2, and after going round and round with it for months, I gave up, and stopped unit testing my project. My tests weren't that good anyway.
I recently decided to start rewriting most of my test suite, and so had to re-add JUnit to my Gradle build. Herein I discovered the problem: in this post: https://stackoverflow.com/a/60259274/4871490 the author mentions, "Since JUnit 5.4.0 there is aggregate artifact with both api and engine dependencies." If you look at my build.gradle above, I have:
TL;DR: Replacing these lines with:
has enabled me to get back to unit testing. HTH.
Yaroslav Bedrov - I can send you a link to the repository, if you tell me where to send it to.
Tomas' solution doesn't work for me as I use neither gradle nor maven to build the project, just a plain IntelliJ project.
Update: I tried Tomas' solution by converting to gradle. This did not solve the problem.
Hey Yaroslav Bedrov Michael Qvortrup, is this solved? I'm currently facing this issue. I'm using the latest Ultimate Edition. Could you please help me?
Hello Inriantyrp,
If possible please create an issue at the YouTrack (https://youtrack.jetbrains.com/) providing a sample project where the problem is reproduced for you. Thank you
I had the same experience. Without changing anything to the tests I could not run any test. I then tried a mvn clean install and all the test did run. But most importantly: the clean install also solved the problem, I can now run my tests again from the IDE.
OK, that did not really solve the problem. I could run the tests from the IDE only once and then the problem reoccurred. I can still run my tests with Maven. In IntelliJ there is a "Class not found" message for the first test it should handle.
Hello Jan,
Can you please provide a sample project to reproduce? Is the issue experienced with the latest IntelliJ IDEA v2020.1.1 (https://www.jetbrains.com/idea/download)? Thank you
Hello Olga,
Yes, I am using the latest version of the IDE. I can send the current project (about 150 classes) if you supply me with an address to send it to. Currently I can test separate classes and separate packages but not a complete set (except via Maven). I should add that my project has two test sources: one for unit tests and one for integration tests, but this approach has not been a problem in the past.
Jan,
If possible can you please file an issue here: https://youtrack.jetbrains.com/issue
attaching the project to it (it can be attached privately as well)
or project can also be uploaded here: https://uploads.services.jetbrains.com/
(please share the name of the archive after upload if you chose the second variant). Thank you
I was about to upload my project but it appears the problem is gone. Since the last time the problem occurred I did add two new testclasses, apart from that I did not create changes in the project (except just working on parts of my code). If the problem occurs again I will make a copy and send it.
Hello, I have the problem with the latest version of Ide IntelliJ. I upload the project CucumberBasic.rar in https://uploads.services.jetbrains.com/.
Thanks!
Facing this issue now too in a multi-module project. The weird thing is it happens only in one module, the application module. Tests of the library are running like expected.
A gradle refresh of the whole project however did the trick for now
Hello Rosamariaceraosorio,
You project works correct for me with IntelliJ IDEA v2020.1.2 (https://confluence.jetbrains.com/display/IDEADEV/IDEA+2020.1+latest+builds).
If possible can you please check this version and, in case the issue is still reproduced, share the idea.log file (Help | Show Log in Finder). Thank you
Hello Marianklueh,
Please tell if the issue is reproduced for you with IntelliJ IDEA v2020.1.2 (https://confluence.jetbrains.com/display/IDEADEV/IDEA+2020.1+latest+builds)?
If yes, can you please share the project sample you experience the issue with. It can be attached privately to the issue created at the YouTrack (https://youtrack.jetbrains.com/) or shared via https://uploads.services.jetbrains.com/. Thank you
Hola Olga Klisho,
Here's the idea.log because in my project the issue still there with the latest build version:
2020-05-15 12:07:17,175 [ 674872] INFO - rationStore.ComponentStoreImpl - Saving Project (name=CucumberBasic, containerState=ACTIVE, componentStore=C:\Users\Usuario\IdeaProjects\CucumberBasic) RunManager took 16 ms
2020-05-15 12:10:17,746 [ 855443] INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS)
2020-05-15 12:10:17,748 [ 855445] INFO - j.compiler.server.BuildManager - Using preloaded build process to compile C:\Users\Usuario\IdeaProjects\CucumberBasic
2020-05-15 12:10:17,836 [ 855533] INFO - lij.compiler.impl.CompilerUtil - COMPILATION FINISHED (BUILD PROCESS); Errors: 0; warnings: 0 took 99 ms: 0 min 0sec
2020-05-15 12:10:17,840 [ 855537] INFO - n.CucumberJavaRunConfiguration - detected cucumber-java version: 4
2020-05-15 12:10:17,854 [ 855551] INFO - s.CompilerReferenceServiceBase - backward reference index reader is opened
2020-05-15 12:10:18,265 [ 855962] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA 2020.1.2/plugins/java/lib/jps-launcher.jar;C:/Program Files/Java/jdk1.8.0_251/lib/tools.jar
2020-05-15 12:10:18,309 [ 856006] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2020-05-15 12:10:18,310 [ 856007] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation
2020-05-15 12:10:18,310 [ 856007] INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Please tell what can I do to configure and it's works. Thanks
Rosamariaceraosorio,
Can you please share the full output from the console after test run (with the classpath) and the screenshot of the run configuration that you run for test. Does it include following program argument: --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm4SMFormatter --name "^Login with correct user and pass$" ?
Testing started at 3:09 PM ...
"C:\Program Files\Java\jdk1.8.0_251\bin\java.exe" -Dorg.jetbrains.run.directory=C:\Users\Usuario\IdeaProjects\CucumberBasic\src\test\java\Features "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.2\lib\idea_rt.jar=60302:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_251\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_251\jre\lib\rt.jar;C:\Users\Usuario\IdeaProjects\CucumberBasic\target\test-classes;C:\Users\Usuario\IdeaProjects\CucumberBasic\target\classes;C:\Users\Usuario\.m2\repository\io\cucumber\cucumber-java\4.2.3\cucumber-java-4.2.3.jar;C:\Users\Usuario\.m2\repository\io\cucumber\cucumber-core\4.2.3\cucumber-core-4.2.3.jar;C:\Users\Usuario\.m2\repository\io\cucumber\cucumber-html\0.2.7\cucumber-html-0.2.7.jar;C:\Users\Usuario\.m2\repository\io\cucumber\gherkin\5.1.0\gherkin-5.1.0.jar;C:\Users\Usuario\.m2\repository\io\cucumber\tag-expressions\1.1.1\tag-expressions-1.1.1.jar;C:\Users\Usuario\.m2\repository\io\cucumber\cucumber-expressions\6.2.0\cucumber-expressions-6.2.0.jar;C:\Users\Usuario\.m2\repository\io\cucumber\datatable\1.1.12\datatable-1.1.12.jar;C:\Users\Usuario\.m2\repository\io\cucumber\datatable-dependencies\1.1.12\datatable-dependencies-1.1.12.jar;C:\Users\Usuario\.m2\repository\io\cucumber\cucumber-junit\4.2.3\cucumber-junit-4.2.3.jar;C:\Users\Usuario\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\Usuario\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\Usuario\.m2\repository\org\junit\jupiter\junit-jupiter-api\5.7.0-M1\junit-jupiter-api-5.7.0-M1.jar;C:\Users\Usuario\.m2\repository\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar;C:\Users\Usuario\.m2\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;C:\Users\Usuario\.m2\repository\org\junit\platform\junit-platform-commons\1.7.0-M1\junit-platform-commons-1.7.0-M1.jar;C:\Users\Usuario\.m2\repository\org\slf4j\slf4j-api\1.7.5\slf4j-api-1.7.5.jar;C:\Users\Usuario\.m2\repository\org\slf4j\slf4j-simple\1.7.5\slf4j-simple-1.7.5.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.2\plugins\junit\lib\junit-rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.2\plugins\cucumber-java\lib\cucumber-jvmFormatter.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.2\plugins\cucumber-java\lib\cucumber-jvmFormatter4.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.1.2\plugins\cucumber-java\lib\cucumber-jvmFormatter3.jar" cucumber.api.cli.Main --plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm4SMFormatter --glue Steps C:/Users/Usuario/IdeaProjects/CucumberBasic/src/test/java/Features/Login.feature
Exception in thread "main" java.lang.IllegalArgumentException: Unsupported scheme: C:/Users/Usuario/IdeaProjects/CucumberBasic/src/test/java/Features/Login.feature
at cucumber.runtime.io.MultiLoader.resources(MultiLoader.java:28)
at cucumber.runtime.model.FeatureLoader.loadFromFeaturePath(FeatureLoader.java:41)
at cucumber.runtime.model.FeatureLoader.load(FeatureLoader.java:35)
at cucumber.runtime.model.FeatureLoader.load(FeatureLoader.java:21)
at cucumber.runtime.FeaturePathFeatureSupplier.get(FeaturePathFeatureSupplier.java:23)
at cucumber.runtime.Runtime.run(Runtime.java:67)
at cucumber.api.cli.Main.run(Main.java:26)
at cucumber.api.cli.Main.main(Main.java:8)
Process finished with exit code 1
Hello Rosamariaceraosorio,
Thank you for the provided information, the issue is reproduced for me as well on Windows OS, please follow the bug report already created for this case: https://youtrack.jetbrains.com/issue/IDEA-210990.
Please try adding "file:" before the path as the temporary workaround:
Thanks you Olga Klisho, please let me know when it's fixed. I'm working now adding "File:" before the path.
Greetings.
I'm experiencing this same problem on Mac and I don't have the "Feature or folder path" option as shown above.
Hello Michael Iles,
Can you please describe the issue in more details? Do you work with Cucumber tests? If possible please share the sample project where the issue is reproduced (you may attach the project to the issue created at https://youtrack.jetbrains.com/ or upload it to http://uploads.services.jetbrains.com and share the name here).
Thank you
Be sure that your tests methods are not private