Hi friends! Sorry for the newbie question: I have ...
# random
p
Hi friends! Sorry for the newbie question: I have this library targeting Java 11 bytecode. When trying to upgrade JUnit to 6, I notice the run fails because it uses the Java 11 toolchain (their latest version requires Java 17). Is there a way to specify a Java 11 toolchain for build and a Java 17 toolchain for tests? Thanks!
o
Out of curiosity: What motivated you to upgrade to JUnit 6?
p
Honestly, we wanted to upgrade to JUnit 6 to keep our tools updated with the latest versions. 😁 We had a complex project that made it hard to migrate plugins and dependencies, and we kept running into bugs from older versions. It was... annoying to say the least. 😅 So, we chose to speed up our upgrades. Also, I’m trying to use JUnit as little as possible and focus on the
kotlin.test
framework for our tests (this will probably happen with the library in which I asked this question).
o
Thanks! I was asking because there might have been something in JUnit 6 that I had overlooked. If you're using
kotlin.test
on the JVM it's really just a thin layer translating to JUnit, so you'll be sticking with that. In case you missed it: Elena recently posted an article on JUnit 6 with Kotlin. If at some point you are looking for more productive testing made easy, you might want to consider testballoon TestBalloon (I'm the author).
gratitude thank you 1
h
JUnit 6 supports suspend test functions out of the box
o
That's what's announced (I did not yet check it out), but what's the quality of that support? Do they catch stray coroutines and exceptions? Do they provide a background scope? Would you go below the level of support you have with
runTest
?
p
Thanks, Oliver! I've tried TestBalloon in a sample project and enjoyed a lot. I will give it a shot in one of our projects and report back. 🙂
thank you color 1
🚀 1
e
JUnit 6's suspend test functions are just
runBlocking
under the covers, I don't think there's much reason to use them
2
I'd suggest using toolchain 17 throughout your project, or simply no toolchain and requiring a newer JDK, and setting target/release on the main sourceset if that's what you want to publish
✔️ 1
🚀 1
o
FWIW, I'm using compat-patrouille and try not to worry about toolchains.