Olek Brzozowski
08/29/2022, 7:54 AMctrl + arrow up / down
to go to previous / next test.
Is there the same option for kotest? I use free spec 😉Gavin Ray
08/31/2022, 6:24 PMVictor Cardona
09/08/2022, 3:36 AMAdam S
09/10/2022, 7:34 AMNathan Bedell
09/10/2022, 3:06 PMVictor Cardona
09/13/2022, 4:20 AMenableOrReasonIf
. I am following the examples in the documentation so I have the following:
val disabledForReasonX: (TestCase) -> Enabled = { Enabled.disabled("...") }
test("...").config(enabledOrReasonIf = disabledForReasonX) { ... }
It seems like enabledOrReasonIf
is only available using StringSpec. How can we do something similar in FunSpec?Olai Solheim
09/14/2022, 1:21 PMRoach
09/15/2022, 9:23 AMIoannis Mavroukakis
09/19/2022, 4:47 PMkotest
and I am happy with it thus far, except for one little thing that I cannot wrap my head around.
class DummySpec : FreeSpec(
{
val mockedBeeper = mockk<Beeper>()
beforeTest {
clearAllMocks()
println("mock cleared")
}
"beeper will beep" - {
"when the stars have aligned" - {
every { mockedBeeper.beep(any()) } returns "mocked beep"
"and the moon is high" {
mockedBeeper.beep(true) shouldBe "mocked beep"
}
}
}
},
)
class Beeper {
fun beep(shouldBeep: Boolean): String = if (shouldBeep) {
"BEEP"
} else "shhhhh"
}
this will clear the mock
three times, once for each line in the test spec. Is there anyway to use beforeTest
but limit it to be executed only for the top test method? Thanks!xenomachina
09/19/2022, 9:45 PMMinjae Lee
09/20/2022, 7:48 AMio.kotest.engine.extensions.ExtensionException$BeforeEachException: java.lang.NoSuchMethodError: 'androidx.lifecycle.LiveData androidx.lifecycle.Transformations.distinctUntilChanged(androidx.lifecycle.LiveData)'
io.kotest.engine.extensions.MultipleExceptions: io.kotest.engine.extensions.ExtensionException$BeforeEachException: java.lang.NoSuchMethodError: 'androidx.lifecycle.LiveData androidx.lifecycle.Transformations.distinctUntilChanged(androidx.lifecycle.LiveData)'
This error might be related to Android issues, but I have no idea.
Is there any ways to test for Transformations(livedata) with Kotest?Klitos Kyriacou
09/21/2022, 5:09 PMlistOf(1, 1, 1).shouldContainOnly(1) -- passes (if there was such a function as shouldContainOnly)
listOf(1, 1, 2, 2).shouldContainOnly(1, 2) -- passes
listOf(1, 1, 2).shouldContainOnly(1) -- fails
snowe
09/23/2022, 8:01 PMlistOf(
row(ProductType.Cash, "DFS", listOf(ServicePackage.Base, ServicePackage.BasePlus, ServicePackage.ProtectionPlus), "non-monthly-markets.csv"),
...
).forEach { (productType, market, onlyPackages, filename) ->
"$market - $productType" - {
test here
}
}
run in parallel?
I’ve got
object KotestProjectConfig : AbstractProjectConfig() {
override val parallelism = 3
override val concurrentSpecs: Int = 1
override val concurrentTests: Int = 20
}
but it doesn’t seem to be doing anything.João Gabriel Zó
09/26/2022, 4:58 PM/bin/bash: connect: Cannot assign requested address
/bin/bash: /dev/tcp/localhost/8081: Cannot assign requested address
Ncat: Version 7.70 ( <https://nmap.org/ncat> )
Ncat: Connection to 127.0.0.1 failed: Connection refused.
Nikunj Yadav
09/26/2022, 7:56 PMMarkRS
09/28/2022, 10:53 AMTest events were not received
> Task :<shared module>:compile<flavour>UnitTestJavaWithJavac NO-SOURCE
> Task :<shared module>:test<flavour>UnitTest FAILED
I don't want it flavour specific. I'm not aware of doing anything that would cause that, except have flavours in the project.
I'm using a shouldSpec (irrelevant?) and version 5.4.2.
Does that make it obvious (to you) what I've got wrong?Iliyan Germanov
09/28/2022, 4:15 PMToddobryan
09/29/2022, 4:59 AMArb.bind(Arb.string(), Arb.string()).checkAll { sp1, sp2 ->
None of the following functions can be called with the arguments supplied:
public fun <A, B> Arb.Companion.bind(arbs: List<Arb<TypeVariable(A)>>, fn: (List<TypeVariable(A)>) -> TypeVariable(B)): Arb<TypeVariable(B)> defined in io.kotest.property.arbitrary
public fun <T : Any> Arb.Companion.bind(providedArbs: Map<KClass<*>, Arb<*>>, kclass: KClass<TypeVariable(T)>): Arb<TypeVariable(T)> defined in io.kotest.property.arbitraryToddobryan
09/29/2022, 5:00 AMbind
that take several generators in a varargs-ish way. Do I need to not import something that I am importing or import something that I'm not?Toddobryan
09/29/2022, 5:17 AMGenerator
, i.e.
Arb.bind(Arb.string(), Arb.string()) { s1, s2 -> Pair(s1, s2) }.checkAll { (s1, s2) -> ... }
Sorry for the noise.Olai Solheim
09/29/2022, 12:21 PM[ERROR] 'dependencies.dependency.version' for io.kotest:kotest-assertions-core-jvm:jar is missing. @ line 41, column 21
MarkRS
09/30/2022, 12:12 PMsam
10/03/2022, 7:57 PMBen Woodworth
10/09/2022, 6:29 PMsam
10/10/2022, 1:54 AMabendt
10/11/2022, 2:24 PMJames Eschner
10/11/2022, 2:59 PMenum class Bar {
BAR1, BAR2;
}
data class Foo {
val enumSet: Set<Bar>,
}
val fooArb: Arb<Foo> = Arb.bind<Foo>()
the target size requirement of 43 could not be satisfied after 430 consecutive samples
java.lang.IllegalStateException: the target size requirement of 43 could not be satisfied after 430 consecutive sample
My guess is that this is happening because it is trying to create a set of size 43, which is clearly impossible here. I would think that the arb generation would be smart enough to know that the maximum set size here is the number of enumerations in Bar
.
Thoughts?
* Not a contribution *alex.krupa
10/13/2022, 9:21 AMAbstractProjectConfig
to work. According to the docs, Kotest should automatically find these classes on the classpath and apply their configs to specs. Are there any undocumented requirements for this to work?
For example, should this test case pass?
object KotestConfig : AbstractProjectConfig() {
override val isolationMode = IsolationMode.InstancePerLeaf
}
class KotestConfigSpec : StringSpec({
"uses leaf isolation mode" {
assertEquals(IsolationMode.InstancePerLeaf, isolationMode())
}
})
Ben Woodworth
10/15/2022, 12:21 AMRileyMichael
10/17/2022, 8:47 PMregisterTest
just blocks endlessly. I've thrown together a simple working example and a reproduction. Has there been any significant changes to test registration between 4.x.x and 5.x.x?RileyMichael
10/17/2022, 8:47 PMregisterTest
just blocks endlessly. I've thrown together a simple working example and a reproduction. Has there been any significant changes to test registration between 4.x.x and 5.x.x?sam
10/17/2022, 10:29 PMRileyMichael
10/18/2022, 8:51 PMrunBlocking
within the delegate (which just happened to work prior). The above links should be complete examples, is there anything particular you were wanting me to share?