Luke
01/14/2022, 9:54 PMinfix fun <A : CharSequence> A?.shouldMatch(regex: String): A
infix fun <A : CharSequence> A?.shouldMatch(regex: Regex): A
Is there a reason for having only the negation for the String parameter?Tadeas Kriz
01/16/2022, 11:06 AMiossimulatorarm64
binariessam
01/16/2022, 9:43 PMMichael Vandendriessche
01/19/2022, 2:09 PMtestImplementation 'io.kotest:kotest-runner-junit5-jvm:5.1.0'
testImplementation 'io.kotest:kotest-assertions-core-jvm:5.1.0'
Currently my test dependencies look like this (yes with all the comments... don't worry, I didn't commit it yet)
// testImplementation 'junit:junit:4.12'
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.1.0'
testImplementation 'io.kotest:kotest-assertions-core-jvm:5.1.0'
// testImplementation 'io.kotest:kotest-assertions-json-jvm:5.1.0'
testImplementation 'io.kotest.extensions:kotest-extensions-robolectric:0.5.0'
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" // M: Why do I need this? ask in the kotlin kotest channel
// testImplementation 'org.json:json:20180813' // M: needed for using JSONObject in unit tests, which is part of the android framework
// testImplementation 'com.googlecode.json-simple:json-simple:1.1.1' // M: needed for using JSONObject in unit tests, which is part of the android framework
// testImplementation 'org.robolectric:robolectric:4.6' // M: use kotest robolectric instead
// testImplementation "de.mannodermaus.gradle.plugins:android-junit5:1.8.2.0"
// (Required) Writing and executing Unit Tests on the JUnit Platform
// testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.2"
// testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.2"
// (Optional) If you need "Parameterized Tests"
// testImplementation "org.junit.jupiter:junit-jupiter-params:5.8.2"
// androidTestImplementation 'com.android.support.test:rules:1.0.2'
// androidTestImplementation 'com.android.support.test:runner:1.0.2'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
I'm using robolectric here because I wanted to test something with json but apparently that's part of the android platform and couldn't get it to work by including json dependencies separately.
I had to include the kotlin-reflect library, however I'm not doing any reflection. Why do I need this dependency? Where is it using reflection?
At this moment I'm having following error about androidx.
This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
The following AndroidX dependencies are detected: androidx.test:monitor:1.4.0, androidx.annotation:annotation:1.1.0
Where is androidx used? Why do I need to add this? I do not see any references to androidx in our codebase. I suppose I will add it but I want to understand it.
I was wondering if I also should include the mannodermaus plugin for junit5 and the junit dependencies or those are covered by kotest already or are those not relevant for kotest?
Most of my android knowledge dates from around 2015. If someone can shed more light on the things above, that would be great!
I'm happy to be working on Android again! 😄Rajkumar Singh
01/20/2022, 12:15 AMdave08
01/23/2022, 2:17 PMNo instrumentation registered! Must run under a registering instrumentation.
... I'm using kotest 4.6.4 and tried the 0.5.0 and 0.4.0 extensions...dave08
01/25/2022, 11:53 AMKarlo Lozovina
01/25/2022, 11:32 PMo1 shouldBe o2
(o1 == o2) shouldBe true
Mervyn McCreight
01/26/2022, 6:54 PM5.1.0
I noticed that the documentation points out a deprecated way to add the junit_xml reporter to the ProjectConfig.
I opened a PR here: https://github.com/kotest/kotest/pull/2801Mervyn McCreight
01/28/2022, 1:44 PMparallism
to something else than 1.
It worked before - is anyone having the same problem, or is this something specific to the project I am working in? 🤔LeoColman
01/29/2022, 11:55 AMjmfayard
01/31/2022, 10:27 AMchristophsturm
02/01/2022, 11:57 AM[engine:failgood]/[class:...]/[class:...]
I think kotest should just run no tests when the uniqueid selector is used with a different engine.Joel Hess
02/01/2022, 9:37 PMjava.lang.NoClassDefFoundError: kotlinx/coroutines/test/TestDispatcher
all over the place when i run my test set. Using Kotlin 1.6.10. I don’t have anything that is explicitly drawing in that coroutine package.dimsuz
02/03/2022, 11:16 AMwithData
, unresolved reference. Was there an api change? This is 5.1.0
class JobFlowCombinatorsTest : ShouldSpec({
context("state merging") {
withData() {}
}
should("correctly combine states") {
withData() {}
}
})
tim
02/08/2022, 1:02 PMPitel
02/08/2022, 1:33 PM@RobolectricTest
class RoboTest : StringSpec( {
"test" {
println(1111111)
delay(500)
println(22222)
1 + 1 shouldBe 2
println(3333)
}
})
But it never finishes! It prints 11111 and then just hangs. Any idea why?nelson ramirez
02/08/2022, 5:27 PMjava.lang.IllegalStateException: No instrumentation registered! Must run under a registering instrumentation.
I searched around for an example project or usage and came up blank. Is there a sample project out there?Mini
02/08/2022, 7:12 PMkierans777
02/08/2022, 11:30 PM> Task :my-library:linkDebugTestIosX64 FAILED
e: Could not find "io.kotest:kotest-assertions-api" in [ ... ]
FAILURE: Build failed with an exception.
// kotestVersion = "5.1.0"
commonTest {
dependencies {
implementation "io.kotest:kotest-framework-engine:${rootProject.ext.kotestVersion}"
implementation "io.kotest:kotest-assertions-core:${rootProject.ext.kotestVersion}"
implementation "io.kotest:kotest-property:${rootProject.ext.kotestVersion}"
implementation "io.kotest.extensions:kotest-assertions-arrow:1.2.2"
runtimeOnly "io.kotest:kotest-assertions-api:${rootProject.ext.kotestVersion}"
}
}
dimsuz
02/09/2022, 12:24 PMtestCoroutineScheduler
in commonMain
in a KMP project and it seems that it is defined only form jvm projects.
Is there some reason to restrict to jvm-only?nelson ramirez
02/09/2022, 4:32 PMPhilipp Mayer
02/11/2022, 10:25 AMorg.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.2
(even though we specified the dep as 1.6.0) and Kotest required 1.6.0
. Having both 1.6.0
and 1.5.2
of corouitnes-core
on the classpath seems not to work.
Did anybody else run into this problem? Right now downgrading to 5.0.3
is the only solution I could find.
Any help is appreciated.
Thanks!charleskorn
02/12/2022, 2:59 AMshouldContain
, but the assertion failure messages only include the first five elements. Is there a reason for this? It’d be great if the error included the full list, or if there was some way to configure this behaviourBenni
02/13/2022, 6:22 PMUnknownClass.Kotest > UnknownClass.initializationError FAILED
java.lang.UnsupportedClassVersionError at ClassLoader.java:-2
(see log here). I am using Kotlin 1.6.2 and Kotest 5.10 (see versions here) I am a little unclear how to debug this and any pointers are greatly appreciated.LeoColman
02/13/2022, 11:46 PMPitel
02/14/2022, 9:19 AMandroidTest
)? I don't need to test UI, just Room database. It seems my tests are not even run. Or maybe it does, I don't know. But the result of connectedDebugAndroidTest
is success, even when there is a test that must be definitely failing.phil-t
02/14/2022, 12:12 PMnullableThing?.shouldBe(something) // This works
nullableThing?.shouldBeGreaterThan(something). // This doesn't work
If nullableThing is null the safe call stops the assertion from being called, so the tests passes when it shouldn’t.
I found two ways to fix this but neither seem ideal to me:
• Add another assertion to check that the thing isn’t null e.g. nullableThing shouldNotBe null
• Use !!.
instead of ?.
but this gives a null pointer exception when the test fails which could lead to confusion
Is there a better way to deal with assertions on nullable variables?Dan T
02/15/2022, 2:50 PMwithEnvironment
on JDK 17.
java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Map java.util.Collections$UnmodifiableMap.m accessible
at SystemEnvironmentExtensions.kt:115
.
I can get around the issue by adding --add-opens java.base/java.util=ALL-UNNAMED
, but I'm wondering if there's a different path forward for this feature that doesn't require the workaround.?mitch
02/16/2022, 10:23 AMorg.junit.platform.commons.JUnitException: TestEngine with ID 'kotest' failed to execute tests
Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
mitch
02/16/2022, 10:23 AMorg.junit.platform.commons.JUnitException: TestEngine with ID 'kotest' failed to execute tests
Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
sam
02/16/2022, 11:00 AMmitch
02/16/2022, 11:15 AMsam
02/21/2022, 11:38 AMmitch
02/21/2022, 11:51 AM