Oliver.O
08/29/2021, 8:53 PMsuspend
version of shouldThrow
missing for a reason or should I file an issue?Gavin Ray
08/30/2021, 4:44 PMJavier
09/02/2021, 6:28 PMsam
09/02/2021, 7:13 PMEmil Kantis
09/02/2021, 7:32 PMtest("comparing doubles") {
"3.123456789123457" shouldNotEqualJson "3.123456789123456789123456789"
}
sam
09/10/2021, 12:23 PMmitch
09/11/2021, 1:51 PMtim
09/14/2021, 12:33 PMJoel Hess
09/14/2021, 7:37 PMsuspend fun RecommendationsExhaustedEventRepository.findByCausationIdEventually(causationId: UUID): RecommendationsExhaustedEvent {
return eventually(30.seconds, IllegalStateException::class) {
checkNotNull(
this.findByCausationId(causationId)
)
}
}
and trying to do the same thing with 4.6. FWIW, I’m also fine with leaving the eventually as is, and not moving to the new API, but I get this too: java.lang.NoSuchMethodError: 'java.lang.Object io.kotest.assertions.timing.EventuallyKt.eventually-8-LJAvk(double, kotlin.reflect.KClass, kotlin.jvm.functions.Function1, kotlin.coroutines.Continuation)'
I see that error with Kotlin 1.4.32 and 1.5.30dimsuz
09/15/2021, 2:41 PMconfig=
to checkAll
with two gen-arguments and it started to throw StackOverflowException. I checked in sources and it looks like it does indeed recursively calling itself:
source on github
Shouldn't it call proptest
instead?James Eschner
09/16/2021, 9:06 PMShouldSpec
should
block. Test looks something like this:
class MyTest : ShouldSpec({
val foo = "bar"
should("do something") {
true shouldBe true // place breakpoint here
}
})
If I run the test using the Kotest plugin in debug mode and place a breakpoint at the true shouldBe true
line I don’t see the foo
variable captured in the “Variables” window like I would expect.
I recall being able to debug this relatively recently so I think this is a new issue.
Kotlin version — 1.5.30
IntelliJ version — IntelliJ IDEA 2021.2.2 (Ultimate Edition) Build #IU-212.5284.40
Kotest version — 4.6.1
Kotest plugin version — 1.1.36-IC-2021.1
* Not a contribution *Javier
09/17/2021, 2:59 PMJustin Tullgren
09/17/2021, 4:46 PMJgafner
09/19/2021, 11:25 AMJustin Tullgren
09/23/2021, 11:13 PMSangram Bankar
09/24/2021, 5:02 PMReceived a completed event for test with unknown id '8.4'. Registered test ids: '[8.1, :app:testDebugUnitTest, 8.2]'
Here are my gradle settings
------------------------------------------------------------
Gradle 7.2
------------------------------------------------------------
Build time: 2021-08-17 09:59:03 UTC
Revision: a773786b58bb28710e3dc96c4d1a7063628952ad
Kotlin: 1.5.21
Groovy: 3.0.8
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 11.0.8 (JetBrains s.r.o 11.0.8+10-b944.6916264)
OS: Mac OS X 10.16 x86_64
Guys any help would be appreciated or i have to rewrite all my existing unit tests in the project using junit5 or junit4.
I have also added a detailed explanation https://github.com/kotest/kotest/issues/2331#issuecomment-923422181Philipp Mayer
09/29/2021, 8:51 AMdata class User(
val id: String,
val someTime: LocalDateTime,
val someDetails: SomeDetails,
) {
data class SomeDetails(
val otherId: String,
val otherTime: LocalDateTime,
)
}
val user = User(
id = "1",
someTime = LocalDateTime.now(),
someDetails = User.SomeDetails(
otherId = "a",
otherTime = LocalDateTime.now().plusSeconds(1)
)
)
val otherUser = User(
id = "1",
someTime = LocalDateTime.now().plusHours(1),
someDetails = User.SomeDetails(
otherId = "a",
otherTime = LocalDateTime.now().plusSeconds(22)
)
)
I would like to write a test that ignores both LocalDateTime
fields.
Something in the lines of:
class SomeTest {
@Test
fun `should ignore localdatetime fields`() {
user.shouldBeEqualToIgnoringFields(otherUser, User::someTime, User.SomeDetails::otherTime)
}
}
Is there any matcher that I might have missed when going through the docs?
Thanks in advance!Vector Sigma 800
10/02/2021, 1:25 PMAshish Kumar Joy
10/08/2021, 1:27 AMatara
10/08/2021, 2:51 AMArb.pair(ArbA, ArbB).filter {it.first != it.second}
But then the result is a pair that I need to unpack for the test.
Is there a better way?phil-t
10/08/2021, 3:18 PM.config
to tag my tests, for example:
"my test".config(tags = setOf(TestTag)) {
// Test stuff here
}
warning on .config - This declaration is experimental due to signature types and its usage must be marked (will become an error in 1.6) with '@kotlin.time.ExperimentalTime' or '@OptIn(kotlin.time.ExperimentalTime::class)'
TestTag would be defined like this - object TestTag : Tag()
Is there something else I should be doing to tag my tests instead of using .config
?mitch
10/11/2021, 8:58 PMkotest.extensions.arrow.*
?elect
10/12/2021, 5:21 AMapi("io.kotest:kotest-runner-junit5:4.6.1")
api("io.kotest:kotest-assertions-core:4.6.1")
this used to work in the past, but now it doesnt get picked up any more
init {
val BCN_Epileptic = "BCN_Epileptic.X"
BCN_Epileptic {
...
}
}
It works only if I use instantiate and invoke
on the string itself directly, that is
init {
"BCN_Epileptic.X" {
...
}
}
Javier
10/17/2021, 3:56 AMSangmin Lee
10/17/2021, 11:13 AMcharleskorn
10/18/2021, 4:44 AM./gradlew macosX64Test --tests '*MyTestClass'
and ./gradlew macosX64Test --tests 'MyTestClass'
but in both cases all tests still ranMichael Strasser
10/20/2021, 11:46 AMtypealias Matcher = (String) -> Boolean
data class Thing(matcher: Matcher)
This fails:
it("compares values of function types") {
val testThing = Thing({ it.startsWith("test") })
testThing.matcher shouldBe { it.startsWith("test") }
}
with messages like:
expected:<(kotlin.String) -> kotlin.Boolean> but was:<(kotlin.String) -> kotlin.Boolean>
Lidonis Calhau
10/20/2021, 12:49 PMassertSoftly(foo) {
shouldNotEndWith("b")
length shouldBe 3
}
->
foo shouldBe customAssert
Mervyn McCreight
10/20/2021, 5:49 PMJUnitXmlReporter
in one of my projects.
I set it up according to the documentation, but the final XML files still only contain the leaf name of the tests for nested tests.
What I have seen while debugging that the reporter itself is working correctly and directly after doing the file operations in the reporter the XML files are correct. But something happens afterwards overwriting the XML files from the JUnitXmlReporter
😞
Anyone got an idea or can see the same behaviour?
Im using version 4.6.3
of KoTest.Emil Kantis
10/21/2021, 8:05 AMtest("client-server test") {
listOf(
async { client.sendRequest() }
async {
val req = server.takeRequest()
req.path shouldBe "/api/v1/hello"
}
).joinAll()
}
Emil Kantis
10/21/2021, 8:05 AMtest("client-server test") {
listOf(
async { client.sendRequest() }
async {
val req = server.takeRequest()
req.path shouldBe "/api/v1/hello"
}
).joinAll()
}
Richard Gomez
10/21/2021, 9:43 AMcoroutineScope
will wait for all child coroutines to complete before exiting;`async` is meant to be used with .await()
, so if you don't care about the return value you can just use launch
.
test("client-server test") {
coroutineScope {
launch { client.sendRequest() }
launch {
val req = server.takeRequest()
req.path shouldBe "/api/v1/hello"
}
}
}
Coroutines aren't necessarily the best fit if both sendRequest()
and takeRequest()
are blocking, but it may not matter for a test.Emil Kantis
10/21/2021, 1:20 PM