sam
03/09/2021, 9:04 PMsnowe
03/11/2021, 2:18 AMGopal S Akshintala
03/11/2021, 5:49 AMsnowe
03/11/2021, 5:57 PM./gradlew test
.
For the QuarkusMockTest it shows that 'Test events were not received'.
For all the kotest tests, if you run the individual test (not the whole class) directly in intellij, it throws an error about the property not being initialized.Ihar S
03/12/2021, 1:32 PMIhar S
03/13/2021, 9:39 PMGiven When Then
- it is covered by BehaviorSpec
• Usage of something similar to Data Tables
from Spock but in Kotest - io.kotest.data.forAll
looks similar
Can anyone please point me to any well written example?
Because I end-up with a callback hell
all the time
Thank you in advance!bbaldino
03/15/2021, 6:23 PMio.kotest.matchers.string
isn’t resolving, which is weird, because from what I’ve seen in github it doesn’t look like that changed? I also didn’t see any mention about a dep change for the matchers in the changelog, but maybe I missed that.dave08
03/16/2021, 12:32 PMFábio Carneiro
03/16/2021, 4:42 PMtestImplementation
. Am I missing something obvious?liverm0r
03/17/2021, 12:50 PMwasyl
03/17/2021, 2:09 PMwasyl
03/17/2021, 2:35 PMexpected:<com.example.MyException> but was:<com.example.MyException>
Expected :com.example.MyException
Actual :com.example.MyException
😕wasyl
03/17/2021, 4:56 PMdave08
03/23/2021, 7:30 AMval
s at the class level use the original classloader... is this really the only way, or can this be fixed? It seems it's linked to this issue: https://github.com/android/android-test/issues/409dave08
03/23/2021, 8:58 AMTODO()
in the subject's function being called... by stepping through the code, I see that code is reached, but the test passes... 🤯dave08
03/23/2021, 8:59 AMthanksforallthefish
03/25/2021, 1:51 PMimport io.kotest.core.datatest.forAll
import io.kotest.core.spec.style.StringSpec
import io.kotest.data.Row2
import io.kotest.data.row
import io.kotest.matchers.shouldBe
class ParticipantRoleTest : StringSpec({
"create from string" {
forAll<Row2<String, *>>(
"DamageCauser" to row("DamageCauser", ParticipantRole.DamagingParty),
"Customer" to row("Customer", ParticipantRole.PolicyHolder),
"Unknown" to row("Unknown", ParticipantRole.Other),
"Repairer" to row("Repairer", ParticipantRole.Repairer),
) { (input, output) ->
ParticipantRole.fromString(input) shouldBe output
}
}
})
this does nothing, tests are not executed
but
import io.kotest.core.datatest.forAll
import io.kotest.core.spec.style.FunSpec
import io.kotest.data.Row2
import io.kotest.data.row
import io.kotest.matchers.shouldBe
class ParticipantRoleTest : FunSpec({
context("create from string") {
forAll<Row2<String, *>>(
"DamageCauser" to row("DamageCauser", ParticipantRole.DamagingParty),
"Customer" to row("Customer", ParticipantRole.PolicyHolder),
"Unknown" to row("Unknown", ParticipantRole.Other),
"Repairer" to row("Repairer", ParticipantRole.Repairer),
) { (input, output) ->
ParticipantRole.fromString(input) shouldBe output
}
}
})
generates 4 tests as expectedsam
03/25/2021, 1:58 PMsam
03/25/2021, 1:58 PMjlw
03/30/2021, 9:20 PMJames Eschner
04/01/2021, 4:50 PMTestFactory
and trying to understand the lifecycle. It appears that the beforeTest
/`afterTest` functions are executed but not the `beforeSpec`/`afterSpec` functions. Can someone help me understand why?
Code:
val myTestFactory: TestFactory = shouldSpec {
beforeSpec {
println("beforeSpec")
}
beforeTest {
println("beforeTest")
}
afterSpec {
println("afterSpec")
}
afterTest {
println("afterTest")
}
should("help me understand the factory lifecycle") {
println("during")
}
}
class MyTest : ShouldSpec({
include(myTestFactory)
})
Output:
~~~ Kotest Configuration ~~~
-> Parallelization factor: 1
-> Default test timeout: 600000ms
-> Default test order: Sequential
-> Default isolation mode: SingleInstance
-> Global soft assertations: False
-> Write spec failure file: False
-> Fail on ignored tests: False
-> Spec execution order: SpecExecutionOrder
-> Extensions
- io.kotest.engine.extensions.SystemPropertyTagExtension
- io.kotest.core.extensions.RuntimeTagExtension
- io.kotest.engine.extensions.RuntimeTagExpressionExtension
beforeTest
during
afterTest
MyTest > should help me understand the factory lifecycle PASSED
* Not a Contribution *James Eschner
04/02/2021, 1:14 PMArb.bigDecimal()
. Code:
class MyTest : ShouldSpec({
should("be able to use bigDecimal") {
// It would be great if Arb.bigDecimal() actually worked here :)
checkAll(Arb.bigDecimal()) { bigDecimal ->
true shouldBe true
}
}
})
~~~ Kotest Configuration ~~~
Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
java.lang.NumberFormatException: Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
at java.base/java.math.BigDecimal.<init>(BigDecimal.java:518)
MyTest > should be able to use bigDecimal FAILED
java.lang.NumberFormatException at MyTest.kt:33
Caused by: java.lang.NumberFormatException at MyTest.kt:33
If we look at the implementation of bigDecimal()
I can see why it’s failing, it’s simply taking Arb.double()
and calling the toBigDecimal()
extension function which fails on inputs like Double.NEGATIVE_INFINITY
and Double.POSITIVE_INFINITY
. Is this a bug or am I using Arb.bigDecimal()
incorrectly?
* Not a Contribution *Kweku
04/08/2021, 11:56 PMArb.long
is fine but using it in checkAll
for example or doing something like arb.long.take(1)
results in the exception
I'm using property testing but not the framework.marzelwidmer
04/11/2021, 4:01 PMKMM
generated project from the KMM PluginWizard
I don’t know what I miss… here but I cant get it up&running on AS. https://kotlinlang.slack.com/archives/C3PQML5NU/p1618153601483200?thread_ts=1617926247.459900&cid=C3PQML5NUdave08
04/18/2021, 2:26 PMdave08
04/19/2021, 11:05 AMtest
blocks (using context
just as a textual description), or spread out in the context
blocks (possibly with instancePerLeaf)?vio
04/19/2021, 3:17 PMshouldBeRight { ... }
function:
the error I get:
'java.lang.Object arrow.core.Either$Right.getB()'
java.lang.NoSuchMethodError: 'java.lang.Object arrow.core.Either$Right.getB()'
I have version 4.4.3
for kotest libraries, and updated the intellij kotest plugin (version: 1.1.31-IC-2021.1
)
the shouldBeRight()
function works as expected, only the shouldBeRight { value -> ...}
fails.
Any help is apreciated, thank you!Adam S
04/20/2021, 6:25 PMauthKey
shrinks to 0, and so gives an invalid reason for failure.
test("expect 'actual code is failing', _not_ authKey length error") {
checkAll(
Arb.string(1..10, Arb.alphanumeric()),
) {
authKey,
->
withClue("authKey must have length > 0") {
authKey shouldHaveMinLength 1
}
fail("actual code is failing")
}
}
I’ve tried using Arb.string(1..10, Arb.alphanumeric()).filter { it.isEmpty() },
but then the test loops endlesslyrobstoll
04/21/2021, 5:42 PMJoel Hess
04/26/2021, 1:55 PM4.4.3
with kotlin 1.4.32
and am seeing some method not found exceptions in my build pipeline that I don’t see locally.
java.lang.NoSuchMethodError: 'java.lang.Object kotlinx.coroutines.DelayKt.delay-VtjQ1oo(double, kotlin.coroutines.Continuation)'
at io.kotest.assertions.timing.EventuallyKt.eventually(eventually.kt:123)
at io.kotest.assertions.timing.EventuallyKt.eventually$default(eventually.kt:77)
at io.kotest.assertions.timing.EventuallyKt.eventually-rnQQ1Ag(eventually.kt:48)
Dropping back down to Kotest 4.4.1
seemed to work. Building on Java 11.Joel Hess
04/26/2021, 1:55 PM4.4.3
with kotlin 1.4.32
and am seeing some method not found exceptions in my build pipeline that I don’t see locally.
java.lang.NoSuchMethodError: 'java.lang.Object kotlinx.coroutines.DelayKt.delay-VtjQ1oo(double, kotlin.coroutines.Continuation)'
at io.kotest.assertions.timing.EventuallyKt.eventually(eventually.kt:123)
at io.kotest.assertions.timing.EventuallyKt.eventually$default(eventually.kt:77)
at io.kotest.assertions.timing.EventuallyKt.eventually-rnQQ1Ag(eventually.kt:48)
Dropping back down to Kotest 4.4.1
seemed to work. Building on Java 11.sam
04/26/2021, 2:08 PMJim
04/26/2021, 4:28 PMsam
04/26/2021, 4:28 PMPeter
04/30/2021, 10:59 PMsam
04/30/2021, 10:59 PMJim
04/30/2021, 11:00 PMPeter
04/30/2021, 11:01 PMCaused by: java.lang.NoSuchMethodError: 'io.kotest.assertions.until.FixedInterval io.kotest.assertions.until.FixedIntervalKt.fixed-LRDsOJo(long)'
sam
04/30/2021, 11:02 PMPeter
04/30/2021, 11:02 PMJim
04/30/2021, 11:05 PMsam
04/30/2021, 11:05 PMPeter
04/30/2021, 11:06 PMeventually
seems to be still using kotlin.time.Duration and it’s blowing up at runtime being a value class in kotlin 1.5 - am i doing something wrong?Caused by: java.lang.NoSuchMethodError: 'java.lang.Object io.kotest.assertions.timing.EventuallyKt.eventually-D5N0EJY(long, kotlin.jvm.functions.Function1, kotlin.coroutines.Continuation)'
long
inline class
with 1.4 is not compatible with 1.5 where this particular class was changed to a value class
? that seems alarmingsam
05/05/2021, 5:22 PMJim
05/05/2021, 5:22 PMsam
05/05/2021, 5:22 PMPeter
05/05/2021, 5:23 PM