https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
kotest
  • b

    bbaldino

    07/13/2020, 5:41 PM
    I'm seeing that when I add kotest 4.1.1 as a dep I'm failing to resolve
    com.github.ajalt.clikt:clikt:2.6.0
    ...anyone else seeing that?
    s
    • 2
    • 29
  • b

    bbaldino

    07/13/2020, 8:25 PM
    I just noticed that
    shouldThrow<SomeException>
    won't match if a sub-type of
    SomeException
    is thrown. But when I try and test with code equivalent(?) to what's in
    shouldThrow
    , it does match.
    I'm an idiot. Nothing to see here.
    l
    • 2
    • 3
  • w

    wasyl

    07/14/2020, 9:42 AM
    I asked a while back but didn’t follow up: what was the reasoning to remove
    context
    block in
    DescribeSpec
    ? @sam you mentioned (in https://kotlinlang.slack.com/archives/CT0G9SD7Z/p1593192969030900) that now nested describe blocks are allowed, but they were allowed for almost a year, since 3.4 I think. I’m asking primarily since it’s a bit surprising to see such breaking change between 4.0 and 4.1
    s
    • 2
    • 38
  • g

    Gopal S Akshintala

    07/14/2020, 10:29 AM
    Unable to run Kotest with Kotlin 1.4-M3 My gradle has the latest Kotest dependencies.
    listOf(“runner-junit5”, “assertions-core”, “runner-console”, “property”).forEach {
            testImplementation(“io.kotest:kotest-$it-jvm:latest.integration”)
    }
    I tried with Intellij kotest plugin-1.0.5 as well and getting the below failure:
    StkTrace.log
    s
    • 2
    • 2
  • t

    themishkun

    07/14/2020, 1:04 PM
    Why latest robolectric-extension is
    4.0.1
    version? Is it compatible with kotest
    4.1.+
    ?
    l
    • 2
    • 1
  • s

    Swanand Keskar

    07/14/2020, 3:33 PM
    do we have to add any additional dependency to gradle in order to debug test which have coroutines and suspending functions ?
    s
    • 2
    • 1
  • w

    wasyl

    07/15/2020, 9:29 AM
    What’s the idiomatic way to make list assertions using matchers? That is, having
    List<T>
    and a
    Matcher<T>
    , what’s the best way to check something like
    List<T>.shouldContainInOrder(List<Matcher<T>>)
    ?
    s
    • 2
    • 10
  • j

    jaguililla

    07/19/2020, 9:11 AM
    1. I’m developing a small change in the Kotest settings to allow controlling the case on tests’ names. How can I force settings values on the tests to test each scenario?
    s
    • 2
    • 6
  • j

    jaguililla

    07/19/2020, 9:12 AM
    2. I’m using Kotest in another project, and I’m verifying dependencies there, where may I find the public PGP key to validate Kotest’s dependencies integrity?
    s
    l
    • 3
    • 25
  • t

    thanksforallthefish

    07/20/2020, 1:28 PM
    @LeoColman (and sorry to address you directly) we seem to have a memory problem with
    SpringListener
    . we are still investigating and cannot confirm yet, but looking at the implementation `TestContextManager`s are stored for each Spec but never removed, so that looks like a candidate. For comparison, junit `SpringExtension`removes the context in an
    afterAll
    method (which should equivalent to
    afterSpec
    ). do you think we are wasting time or might we be onto something here?
    s
    • 2
    • 5
  • r

    reevn

    07/20/2020, 2:28 PM
    Hey 👋 Is it expected that
    beforeTest
    of a nested scope is not executed for child scopes when the default isolation mode is chosen? Example:
    // beforeTest on the most outer level at the top of the spec
    beforeTest { ... }
    
    describe("some scope") {
      beforeTest { ... }
    
      // for these tests, the outer level and "some scope" beforeTest functions are executed in order before each test
      it("test a") { ... }
      it("test b") { ... }
    
      describe("some deeper scope") {
        // for all these tests only the top level beforeTest is executed before each one, but the "some scope" one is never executed
        it("test c") { ... }
        it("test d") { ... }
      }
    }
    When I change to
    IsolationMode.InstancePerLeaf
    it works, but I don't really need separate instances, I just need the
    beforeTests
    of each parent to be executed for each test case. If this is a bug, I'm happy to create an issue.
    s
    • 2
    • 4
  • h

    huehnerlady

    07/21/2020, 7:49 AM
    Hi, Just heard a lot of nice things about kotest. Never used it before though. I read about it in the scope of Assertions, but from reading the documentation it sounds like a separate test framework. So is it used instead of Junit5 or together with that?
    ☑️ 1
    w
    • 2
    • 3
  • p

    phil-t

    07/21/2020, 9:15 AM
    Is there a way to output test results as Junit XML files, and is the junitxml extension needed for this?
    s
    • 2
    • 3
  • s

    savrov

    07/21/2020, 12:20 PM
    Hi, is it possible to test an abstract class with kotest?
    w
    m
    s
    • 4
    • 4
  • b

    bbaldino

    07/21/2020, 9:49 PM
    I'm getting complaints about 2
    should
    blocks having the same text for: "duplicated test name" (even though they are within different parent scopes. i.e.:
    "one" {
        "a" {
            should("c") {}
        }
        "b" {
            should("c") {}
        }
    }
    s
    • 2
    • 20
  • t

    thanksforallthefish

    07/23/2020, 11:24 AM
    I had an idea to improve springlistener in some cases where the method name actually matter. https://github.com/kotest/kotest/issues/1591 is it ok? I can work on it (I don’t know when, but it is probably not very urgent), but the question is, does it make sense? probably it needs a flag as well, since only few characters are allowed in method names. Would there be something else to be particular mindful to verify?
    s
    l
    • 3
    • 4
  • r

    reevn

    07/23/2020, 5:26 PM
    Does anybody have some experience working with parallel test execution? Basically we would like to execute multiple specs in parallel to make use of all the cores we have, but we have some test files that do some static mocking, so these files would influence other test files that would run at the same time on a different thread. Is there any way to leverage the tagging system to mark these files to be run sequentially, while all the other tests can make use of parallelism? If not, do you think this might be something worth exploring in the project?
    s
    w
    • 3
    • 34
  • s

    Skolson5903

    07/25/2020, 10:16 PM
    This is an update/repost of prior post on this channel Does anyone know of an example project in Github (or wherever) that successfully uses Kotest in a multiplatform project with IOS and Android as the targets? I have this type of multiplatform project, and can successfully run/debug unit tests using JUnit5 and the basic kotlin.test stuff. But if I add a Kotest class (in this case extending StringSpec) in the same test source directory and in the same package, the IDE shows it as if it should compile fine. Attempting to run or debug the test using the gutter menu fails. For some reason gradle is not compiling the class before the debug run despite a successful build, so the debug attempt fails with a ClassNotFoundException. The build directory "build\tmp\kotlin-classes\debugUnitTest\com\oldguy\io\tests" is where the compiled class should be, but it is not present. Only the unit test class using kotlin.test is present. It is as if the build doesn't realize the Kotest class is a unit test and skips compiling it. This is using 1.4-M3 and Kotest 4.1.2. The test classes are in the top level androidApp module in the src/test tree of this multiplatform project. I haven't been able so far to get unit tests to run in any of the underlying multiplatform modules due to issue https://youtrack.jetbrains.com/issue/KT-40571. Also, if anyone knows a gradle change to get the build to recognize the Kotest class as a unit test and build it, I would appreciate that info as well. Thanks in advance for any info
    l
    s
    a
    • 4
    • 154
  • p

    phil-t

    07/27/2020, 9:08 AM
    I've noticed a problem with Kotest run configurations in IntelliJ - the VM options does not save when storing as a project file, and it sometimes loses its content. Has anyone else noticed this?
    s
    • 2
    • 22
  • c

    Carrascado

    07/27/2020, 5:24 PM
    In fact that 4.1.3 version gives me problems with the Kotest plugin
    s
    • 2
    • 36
  • b

    bbaldino

    07/31/2020, 5:26 PM
    I'm seeing an issue where if I run a single test, it passes, but when I run all the tests, a test fails. I do modify the values of some global variables in the tests (unavoidable, unfortunately), but I run them single threaded and in order. A test set a var at the top of a
    should
    block, and then resets it at the end, so I thought I'd be covered?
    👍 1
    l
    • 2
    • 4
  • a

    arve

    08/02/2020, 12:13 AM
    Whenever a single test fails, gradle (or kotest?) reports two failures. It seems like once there is a failure, "doubles up" as
    executionError
    as if that was an additional failing test. Any idea why? (2 actually failing tests gets reported as 3 failures)
    s
    p
    • 3
    • 4
  • p

    phil-t

    08/04/2020, 4:08 PM
    Is there a way to add information to the assertion failures? For example if I do something like
    errorOccurred shouldBe false
    or
    errorOccurred.shouldBe(false)
    then the assertion failure says something like
    expected:<false> but was:<true>
    Is it possible to add more information to make the problem more clear? If it could display the name of the variable being checked that might be enough.
    s
    • 2
    • 11
  • s

    Skolson5903

    08/04/2020, 5:38 PM
    Config is 1.4.0-rc and the 1.1.0 kotest plugin, and using kotest 4.2.0 snapshot in Android Studio in a multi platform project. if I use the gutter menu to debug a test in a multiplatform module, and the gradle debug build task ":&lt;&lt;moduleName&gt;&gt;:assemble" fails with errors, the debugger is still invoked. Is this a Kotest plugin thing, or a defect elsewhere?
    s
    • 2
    • 2
  • b

    bbaldino

    08/04/2020, 7:27 PM
    Upgrading a repo from kotlintest to kotest, is it possible to do property testing with just a specific set of values? (like kotlintest had)
    s
    • 2
    • 17
  • s

    Skolson5903

    08/05/2020, 5:05 PM
    Config is
    4.2.0.426-SNAPSHOT
    and the 1.1.0 snapshot of the Intellij plugin in Android Studio. Make a unit test using the AnnotationSpec setup.  It looks fine in Android Studio, and gradle compiles it fine, but there is no gutter icon on this style of test in my multiplatform module set of tests.  Other tests in the same module using StringSpec work fine.  Anyone else seen this issue with AnnotationSpec? FYI manually creating a Run configuration for the same unit test class lets runs/debugs work fine.
    s
    • 2
    • 4
  • b

    bbaldino

    08/06/2020, 4:42 PM
    In kotlintest I was able to add arbitrary metadata via the
    testContext
    member in a
    ShouldScope
    , does something equivalent exist in kotest?
    w
    s
    • 3
    • 14
  • t

    torres

    08/10/2020, 8:23 PM
    why is there no plusorMinus() for Long? there is one for Double and Float https://github.com/kotest/kotest/blob/f329f592ce3b285c5d8f1c255098b233e74f477d/kotest-assertions/kotest-assertions-core/src/commonMain/kotlin/io/kotest/matchers/floats/FloatMatchers.kt#L7
    s
    l
    • 3
    • 2
  • b

    bbaldino

    08/13/2020, 6:33 PM
    I'm still seeing
    [ERROR] Failed to execute goal on project jicoco-test-kotlin: Could not resolve dependencies for project org.jitsi:jicoco-test-kotlin:jar:1.1-SNAPSHOT: The following artifacts could not be resolved: com.github.ajalt.clikt:clikt:jar:2.6.0, com.github.ajalt.clikt:clikt-js:jar:2.6.0, com.github.ajalt.clikt:clikt-linuxx64:klib:2.6.0, com.github.ajalt.clikt:clikt-metadata:jar:2.6.0: Could not find artifact com.github.ajalt.clikt:clikt:jar:2.6.0 in jitsi-maven-repository-releases (<https://github.com/jitsi/jitsi-maven-repository/raw/master/releases/>) -> [Help 1]
    when I include the
    kotest-runner-console-jvm
    in my pom and try to compile from the command line. @sam I think you said the need for this dep is going to go away soon (because it will be bundled). Is that right? Has that been released?
    s
    • 2
    • 4
  • k

    kev1n11

    08/16/2020, 9:52 PM
    Hi, is there a way to check if a
    Throwable
    have (deeply) nested cause of type T?
    s
    l
    • 3
    • 2
Powered by Linen
Title
k

kev1n11

08/16/2020, 9:52 PM
Hi, is there a way to check if a
Throwable
have (deeply) nested cause of type T?
s

sam

08/16/2020, 11:57 PM
Not built in
l

LeoColman

08/17/2020, 2:50 AM
But I suppose you can keep checking
shouldThrow<MyAssertion> {
    foo()
}.cause.shouldBeOfType<X>.cause.shouldBeOfType<Y>
View count: 5