https://kotlinlang.org logo
#getting-started
Title
# getting-started
v

Valentin Metz

08/30/2020, 9:05 PM
I'm running into an error with my UnitTests. Can't really make sense of the errormessage: - Is this an issue with gradle? The only test atm is a simple @Test assert(true). https://pastebin.com/GZXsiDWL
j

jbnizet

08/30/2020, 9:35 PM
My guess is that you configured gradle to use JUnit 5, but used the JUnit 4 Test annotation, or vice-versa. You should show us the full code of the test (including imports), the test task configuration, and tell us how you execute the test.
v

Valentin Metz

08/31/2020, 1:10 AM
I ran it by clicking the "run" arrow next to the fun() @jbnizet
j

jbnizet

08/31/2020, 5:53 AM
It seems you haven’t configured the test class in the gradle script. So it uses JUnit 4 by default. You need to configure itto use JUnit 5, since, apparently (but you didn’t post your imports so I can only guess based on the BeforeAll annotation), you’re using JUnit 5. See https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html: you must call useJUnitPlatform() as the example shows)
v

Valentin Metz

08/31/2020, 11:09 AM
That and adding a dependancy solved it. Thank you!
👍 1
2 Views