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
  • x

    xenomachina

    09/18/2020, 5:52 PM
    It used to be possible to have subclasses of the various Spec classes, and IntelliJ would "see" the individual tests. It looks like that's no longer the case, though. We have a subclass of FunSpec that we often use (mostly sets defaults our team expects, and adds some helper methods), and using it, IntelliJ doesn't show a run button (green triangle) next to tests, but if I change it to use FunSpec directly they appear. I think back when this worked was before the kotest plugin (somehow it was just using IntelliJ's JUnit support, I guess?). Is using a custom subclass of Spec just not supported, or is this a bug, or am I doing something wrong?
    s
    l
    • 3
    • 12
  • m

    mitch

    09/18/2020, 10:15 PM
    Hey @sam any suggestions on how i can somehow tell kotest intellij plugin to pick up surefire and failsafe maven configs? I noticed when i try running the unit tests it starts running the integration tests as well because it's under the same package name (despite it being organised in two different folders). We're probably doing the wrong thing altogether so what's your suggestions? Maybe Tags?
    s
    • 2
    • 3
  • a

    acando86

    09/21/2020, 5:03 PM
    Anyone has successfully managed to make usage of the kotest gradle plugin https://github.com/kotest/kotest-gradle-plugin to run jvm unit tests in an android kotlin simple project (not android instrumented tests in a device)? I've configured
    plugins {
        id("io.kotest") version "0.1.3"
        id("com.android.application")
        kotlin("android")
        kotlin("android.extensions")
    }
    in my project (single module for now, it's just to experiment with it), but when running
    gradle kotest
    i get
    Could not determine the dependencies of task ':app:kotest'.
    > Task with path 'classes' not found in project ':app'.
    gradle test
    (with java5 runner) works just fine.
    s
    • 2
    • 11
  • r

    rpillay

    09/22/2020, 4:29 AM
    Hi - Is there any documentation of how to use the property based functionality (eg. checkAll) with the AnnotationSpec style?
    s
    • 2
    • 2
  • w

    why

    09/22/2020, 12:26 PM
    Hi, when I add this :
    implementation("io.kotest:kotest-property:4.2.5")
    to my commonTest sourceSet, I get this error when I gradle sync : Could not resolve io.kotest:kotest-property:4.2.5. the goal is to add Kotest to my multi-platform common module (commonTest)
    a
    s
    • 3
    • 6
  • a

    Animesh Sahu

    09/24/2020, 4:00 AM
    Hello, somebody know how can we run Android Instrumented Tests (in androidTest directory) with kotest?
    l
    • 2
    • 6
  • j

    Jorrit

    09/24/2020, 11:23 AM
    IDEA shows the option to only run previously failed tests, but my tests are progressive/dependent on eachother. Is there a way to disable this / ensure all tests always run?
    s
    m
    • 3
    • 10
  • s

    Slackbot

    09/24/2020, 2:13 PM
    This message was deleted.
    a
    s
    • 3
    • 5
  • a

    alexfacciorusso

    09/25/2020, 11:25 AM
    Hi everyone! I am trying to initialise a
    BehaviorSpec
    . Since I need to perform some actions before the spec is initialised by using a custom Listener, but it doesn’t seem to work. Here’s an example:
    class DashboardViewModelTest : BehaviorSpec({
        listeners(
            MyListener
        )
    
        // [I need a listener (or multiple listeners) to be executed immediately here]
    
        val myClassUnderTest = MyClassUnderTest(...)
    
        Given("Something") {...}
        Given("Something else") {...}
    
        // [And then I need the same listener to de-initialise my stuff here]
    })
    How can I have something like that? Of course if I create a wrapping Given, for example, the listeners actually get triggered, but I was trying to avoid a further nesting level with something like Given(“My class initialised”), it seems redundant to me.
    w
    • 2
    • 16
  • m

    mitch

    09/26/2020, 9:04 PM
    @sam PR's up 😆 https://github.com/kotest/kotest/pull/1733
    s
    • 2
    • 14
  • a

    Animesh Sahu

    09/27/2020, 2:00 PM
    Not completely sure if its related to kotest or not, sb suggested to cross-post here. If sb know about this lemme know 👀
    s
    • 2
    • 2
  • s

    Sourabh Rawat

    09/27/2020, 8:40 PM
    Hi @kotest-team, can you tell me why you moved from dokka to javadoc? Asking cuz curiosity and for my projects.
    l
    s
    • 3
    • 5
  • k

    kopper

    09/30/2020, 11:08 PM
    G'day! In IntelliJ, in the project left panel, when I right click on a package and select
    Run -> All tests (kotest)
    the Kotest plugin runs all the tests defined in that package ignoring the specific directory I am in (in my case src/test/kotlin whereas we have also integration tests in src/it/kotlin). What is the best way for me to create a test suite consisting of only unit tests excluding integration tests?
    s
    • 2
    • 24
  • j

    Javier

    10/02/2020, 10:02 AM
    Is there a way to do "1".shouldBeLessThan("5", myComparator) I can only see that I can use my comparator in equals/notEquals
    s
    c
    • 3
    • 6
  • k

    Kavita

    10/02/2020, 5:46 PM
    Hello everyone, I am facing one issue related to test cases. My Android project has more than 250 tests. Most of them include API mocking & some of them are unit tests. In Android Studio when I run the individual test class, all tests in that class succeed. But when I run the entire test package(altogether), some of the tests fail randomly. The project has 
    MockWebSerever
     & 
    Awaitility
     to handle API mocking & async operation. The 
    .gradle
     file also has Android Orchestrator & clearPackageData declared. Still, the issue persists. Can someone help me to fix this issue? My gradle, plugin & java version:
    s
    • 2
    • 4
  • u

    Umalog

    10/03/2020, 11:06 PM
    Hi everyone! Сan you tell me how you can set up a kotest to run from a test task? kotest-gradle-plugin is not what I want) "useJUnitPlatform()" - in build.gradle is specified
    s
    • 2
    • 5
  • a

    Ahmed Mourad

    10/04/2020, 7:42 PM
    How do I configure Robolectric tests? Doing this doesn't seem to work:
    @Config(sdk = [Build.VERSION_CODES.O_MR1])
    @RobolectricTest
    class SomeTest : DescribeSpec({ ... })
    w
    s
    • 3
    • 8
  • w

    why

    10/04/2020, 9:46 PM
    Hi guys, what do you think about this, it should fail right?
    listOf<Int>(1) shouldBe listOf<Int>()
    s
    • 2
    • 6
  • a

    alexfacciorusso

    10/05/2020, 10:51 AM
    Ok regarding the Robolectric extension, let’s go by small steps. First thing first, I’ve noticed it isn’t generating in the latest versions of the library (the last extension version available in the maven repo is the
    4.0.1
    ). I’ve created a PR to re-include the plugin in the project artefacts generation, unless there was a reason why it wasn’t included anymore (@sam to confirm). The PR is this one, it includes also some further fixes and optimisations in the Gradle file. After that, I will try to reproduce the bugs about Robolectric itself, although from some comments I understand it might be not as immediate to fix them.
    s
    • 2
    • 17
  • a

    alexfacciorusso

    10/06/2020, 5:45 PM
    Good news, I’ve managed to get a Robolectric test to work with a local updated version of the Kotest Robolectric extension. Work in progress about both Robolectric and Android support for it, I hope to release PRs at a certain point!
    🎉 3
    l
    • 2
    • 4
  • j

    Jim

    10/07/2020, 5:20 PM
    Hi there, this is kinda out of left field but something I've been thinking about for a few days and kotest seems like my best bet. I have a set of junit tests that end up spending a lot of time waiting for things using failsafe's retry. Since kotest uses suspend functions (and so do my test methods I'm using for my e2e testing) I was wondering about the feasibility of extending kotest to wrap each test case in a function that returns a deferred test result, something like:
    val tests: List<TestCase>
    suspend fun executeAsync(testCase: TestCase...): Deferred<TestResult>...
    fun doIt() = tests.map { executeAsync(it) }.awaitAll() // or just start them instead
    If my failsafe retries were kotlin's
    delay
    then my other tests would run whatever they can instead of waiting for each test case to complete serially, at least that's the way I understand it.
    s
    • 2
    • 105
  • g

    Gilles Barbier

    10/08/2020, 11:03 AM
    Any clue?
    s
    • 2
    • 8
  • s

    sam

    10/08/2020, 2:45 PM
    @alexfacciorusso is working on re-releasing our roboelectric plugin, and we're trying to decide where is best to locate it. So does anyone have any opinions on the following options: 1. release as part of the main project 2. separate repo, same version 3. separate repo, different versioning, with normal module names 4. separate repo, different versioning, kotestx module names
    a
    c
    +2
    • 5
    • 27
  • p

    Peter

    10/08/2020, 4:59 PM
    wondering if anyone else is experiencing unusably slow IntelliJ performance, especially in kotest specs (WordSpec in this case)? by slow I mean more than a minute for type completion to pop up … on a machine with i9900k CPU & 64GB RAM (4GB heap for IntelliJ)
    s
    w
    t
    • 4
    • 40
  • p

    phil-t

    10/09/2020, 11:56 AM
    How can I store a value which can be accessed in multiple tests? I have several files each containing a StringSpec class with tests in it, and have added a project level config with a beforeAll function in it, which is being called before tests run. I'm currently trying to add a variable in that listener which can then be accessed by any of the tests, but not sure how to do this or what is the best way (I'm quite new to Kotlin). Can anyone help to point me in the right direction please?
    s
    • 2
    • 4
  • c

    christophsturm

    10/09/2020, 1:13 PM
    does kotest support something like minutest’s fixture? http://oneeyedmen.com/my-new-test-model.html
    s
    • 2
    • 1
  • j

    Jim

    10/09/2020, 4:47 PM
    I'm looking for a way to use the config on FunSpec style, is that possible?
    "danger will robinson".config(enabledIf = disableDangerOnWindows) {
      // test here
    }
    s
    • 2
    • 8
  • s

    sam

    10/11/2020, 7:47 PM
    https://dev.to/kotest/kotest-release-4-3-2768
    t
    j
    • 3
    • 12
  • s

    sam

    10/11/2020, 7:48 PM
    https://twitter.com/_sksamuel/status/1315378828521484290
    🔝 2
    🎉 2
    b
    • 2
    • 9
  • j

    Jim

    10/12/2020, 10:24 PM
    I have an analog to Arrow's
    Either
    type, and I'd really like to do something like
    val actual: <Unit, Errorish> = doThing()
    
    withClue(lazy { "doThing error: ${actual.errorOrNull()?.message}" }) { 
      actual.isOk shouldBe true
    }
    Is this possible and I'm just not seeing a way in the current matchers? Basically I don't want to try to get the error message unless there's an error in my value
    s
    • 2
    • 18
Powered by Linen
Title
j

Jim

10/12/2020, 10:24 PM
I have an analog to Arrow's
Either
type, and I'd really like to do something like
val actual: <Unit, Errorish> = doThing()

withClue(lazy { "doThing error: ${actual.errorOrNull()?.message}" }) { 
  actual.isOk shouldBe true
}
Is this possible and I'm just not seeing a way in the current matchers? Basically I don't want to try to get the error message unless there's an error in my value
for context I can't use v0.x.x and therefore the kotest arrow integration until v1.0.0 which hopefully is coming soon per: https://www.47deg.com/blog/arrow-0-11-0-release/
s

sam

10/12/2020, 10:31 PM
A clue that takes a lazy might be very nice
j

Jim

10/12/2020, 10:34 PM
another thing for 4.4? 😈
s

sam

10/12/2020, 10:34 PM
You're keeping me busy
j

Jim

10/12/2020, 10:34 PM
😂 😅
Thought was brought to you by inspiration from kotlin's
require
and
assert
Although it looks like asClue will pop every clue instead of only doing it when it fails, so it might need to be something similar to a clue, but not exactly
🤔
s

sam

10/12/2020, 10:38 PM
asClue on lazy will work
j

Jim

10/12/2020, 10:46 PM
(lazy { computeErrorMessage() }).asClue { 
  thing shouldBe true
}
like that?
s

sam

10/12/2020, 10:47 PM
I mean that will work once we add it
j

Jim

10/12/2020, 10:47 PM
ah 👍
s

sam

10/12/2020, 11:05 PM
https://github.com/kotest/kotest/issues/1766
j

Jim

10/13/2020, 3:46 PM
Is ErrorCollector part of the public facing api? I feel like changing pushClue to accept a Lazy<T> instead of a T is a breaking change
s

sam

10/13/2020, 4:02 PM
It's not public, or shouldn't be
its used internally
j

Jim

10/13/2020, 4:10 PM
gotcha 👍
🤞 https://github.com/kotest/kotest/pull/1772
View count: 4