-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No tests were found
when trying to run JUnit tests with Scala 2 or WIP Scala 3 extension
#18373
Comments
Okay so it looks like it may be something in the implementation here that is impacting it? (I'm not really sure though, it could actually be something else entirely or in the base JUnit5 package) Sorry for the ping, but: @stuartwdouglas I'm happy to try to help fix whatever weirdness is going on here myself, but Quarkus is a very large project and I don't have any of the background context. Git blame says you're the fella to talk to about this file -- do you think you might be able to share any thoughts or context? Would be super appreciated, I really want to publish my Scala 3 support extension but I don't know how useful it will be until tests work (at even some basic level). I think this is an issue with the current Scala 2 support as well so would be a sweet bonus to get that patched up =D quarkus/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java Lines 462 to 594 in 3f74eee
Edit: I decompiled the Scala class bytecode with Recaf, expecting there to be a large difference between Java that might give a clue, but confusingly it's identical to a Java implementation except for the swapping of |
This is because the test method ends up looking like:
And deep inside JUnit it will silently ignore methods annotated with @test that return a value other than void. |
IMHO silently ignoring this is a JUnit 5 issue, do you want to file an issue with them? |
I've been bitten by this in past as well... And it's just a bad default... |
Hey thank you for the reply @stuartwdouglas! 🙏
@Test
public ValidatableResponse testHelloEndpoint() { I thought it might be something like this but it happens even for test cases in which I just do this: @QuarkusTest
class SomeTest:
@Test
def testThing() = assert(false) And that comes out as: @QuarkusTest
public class SomeTest {
@Test
public scala.runtime.Nothing$ testThing() {
return scala.runtime.Scala3Runtime$.MODULE$.assertFailed();
}
} In this scenario, it's because again, it's a Just want to try to see if I understand it right. EDIT: Oh wow, you're absolutely right! I checked the decompiled version of this working test from their So if YES!! 🥳 🎉 💯 🏆 🎊 Quarkus endpoints and tests working with Scala 3! |
So there is no problem here, sorry for filing an issue and the ping. This is (if I am allowed to hold this opinion) an instance of really poor UX/DX on the side of JUnit5, as Stuart and Georgios both stated above. I am happy to close this, finalize + submit my PR for Scala 3 support, and follow up with an issue on the JUnit repo that links back to this as evidence of why the current behavior is an awful default to have 😅 |
Zulip thread: https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/.22No.20Tests.20Found.22.2C.20last.20issue.20for.20Scala.203.20support
Describe the bug
Go to https://code.quarkus.io/ and create a new Maven application with just the Scala extension
Try to run
mvn test
ormvn quarkus:test
The
maven-scala-plugin
will detect the presence of the Scala test files and compile them, but Quarkus/JUnit 5 will report there being no tests.I believe this may be something specific to the way Quarkus deals with tests. I thought it might be a JUnit bug, and was going to file an issue there, but I downloaded their
junit5-jupiter-maven
starter, and tried to reproduce this, but had no issues:The
pom.xml
being used here is:Output of
uname -a
orver
MSYS_NT-10.0-21382 DESKTOP-88A51E5 3.1.7-340.x86_64 2020-10-23 13:08 UTC x86_64 Msys
Output of
java -version
JDK 11 and JDK 16
GraalVM version (if different from Java)
GraalVM 21.2.0-dev
Quarkus version or git rev
2.0.0-FINAL
Build tool (ie. output of
mvnw --version
orgradlew --version
)The text was updated successfully, but these errors were encountered: