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
testing
  • s

    Steve

    02/07/2020, 2:20 AM
    Do you use the ActivityTestRule to start the particular activity, or are you just starting the app like normal?
    l
    • 2
    • 1
  • n

    napperley

    02/17/2020, 2:23 AM
    What Kotlin testing libraries/frameworks are available for testing Common modules?
    n
    p
    • 3
    • 4
  • j

    Joffrey

    03/16/2020, 9:43 AM
    Has anyone had issues with
    assertFailsWith
    ? When using it in a multiplatform project, I can consistently reproduce an issue on the JS platform (everything is fine on JVM). When I use
    assertFailsWith(SomeException::class)
    everything works as expected (the exception is thrown, the test pass). When I use
    assertFailsWith<SomeException>
    variant, the test fails as if no exception was thrown by the block. Only a couple of my tests work properly no matter the form used, but all the others fail consistently with the 2nd form and succeed with the 1st form, and I have no idea how this is possible, both are inline functions calling the same 3rd function… I really don’t get it.
    • 1
    • 2
  • d

    Daniele Segato

    09/09/2020, 8:58 AM
    In Mockito I used to do stuff like this:
    `when`(api.method())
                .then { throw anError }
                .thenReturn(something)
    which basically meant: first time it is called throw
    anError
    , second time return
    something
    Is there a way to do something like this with MockK?
    • 1
    • 1
  • d

    Daniele Segato

    01/22/2021, 4:54 PM
    I would I go about to unit test this function?
    fun createCoroutineScope(): CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
    So in my test I have to check if the returned
    CoroutineScope
    is using a
    SupervisedJob
    or a particular
    Dispatcher
    how do I do that?? (or any other property of the context/scope) For instance, say I wanna write an unit test that force me to create a
    CoroutineScope(SupervisorJob())
    @Test
    fun createCoroutineScope_produce_a_supervisor_job() {
      val scope = createCoroutineScope()
      val job = scope.coroutineContext[Job]
      assertTrue(job is SupervisorJob) // can't do
    }
    SupervisorJob
    is not an interface or a class, it's a top level function. It's implementation tells me nothing about what kind of job it is or how it handle children. The implementation is private. I cannot find a way to force me to write that code from an unit test, can anyone enlighten me? (I've asked this in #getting-started but I realized it is better suited here + I asked it better here)
    • 1
    • 1
  • a

    Andrew Ebling

    02/15/2021, 10:21 AM
    I want to test that calling a given method on my subject/unit under test calls a given method on a mock, with any lambda as an argument. However if I do this:
    subject.openThePodBayDoors()
    
    verify(mockDoorManager).completion(Mockito.any())
    ...then I get an error:
    java.lang.IllegalStateException: Mockito.any() must not be null
    ...even though I have written the production code which should make this test pass. I’ve been googling “kotlin mockito match any lambda” etc. and can find complex tests with
    LambdaMatcher
    but all I want to do is check that the method was called with some lamba - I don’t even care what it does for this test. There must be a simple solution for this I’m missing, surely?
    • 1
    • 2
  • n

    Nikolay Kasyanov

    03/03/2021, 11:21 AM
    hey folks, am I getting this right that whenever a
    kotlin-test-junit
    dependency is added,
    junit
    should also be added explicitly?
    • 1
    • 1
  • s

    sendoav

    03/29/2021, 2:55 PM
    Hi All, after upgrading build gradle tools from 4.0.2 to 4.1.0 my jacoco coverage reports state zero percentage of coverage, anyone experiencing the same issue? I'm using jacoco plugin 0.8.6
    🙋‍♂️ 1
    m
    • 2
    • 1
  • c

    Chris Jobling

    05/21/2021, 3:38 PM
    Good Morning / Good Afternoon. We are looking to do end-to-end testing for our Kotlin microservices. We have previously used https://cucumber.io/docs/installation/kotlin/ and i am wondering if anyone has used any different tools/tech which could be of advantage to us. Thanks
    m
    • 2
    • 1
  • t

    Tobi M.

    11/24/2021, 9:12 AM
    Which library are you using for snapshot testing in Kotlin, if any? 🙂
    p
    • 2
    • 3
  • c

    Colton Idle

    02/04/2022, 2:30 PM
    I have a plain old little java library with about 20 unit tests, but now I want to just change one variable for the tests so that I have 40 tests (its the same 20 tests, ran twice, with different inputs). How can you do that with kotlin + gradle?
    a
    m
    • 3
    • 8
  • c

    Colton Idle

    02/07/2022, 9:42 PM
    Running tests stopped showing results in the test result pane. All I get now is the gradle run pane. Any way to get it back? (edited) i.e. this pane is missing when running my tests. I tried invalidate/restart with no luck
    m
    • 2
    • 1
  • b

    Big Chungus

    06/22/2022, 8:20 PM
    message has been deleted
  • o

    oianmol

    10/28/2022, 7:05 AM
    Hi 👋 folks! How do you create a test suite for kotlin common tests ?
  • l

    Landry Norris

    11/17/2022, 3:07 PM
    Is there anything built in to check if a String matches a regex? I know I could assertTrue with a Regex, but I’d like the output to give me the failing string and the regex if it fails.
  • t

    teddy

    12/02/2022, 12:29 AM
    Anyone has any idea to write a unit test for this ViewModel file? I appreciate if you can give me an example code or any keyword for me to search the issue? Thank you very much
  • n

    Narayan Iyer

    12/14/2022, 1:02 PM
    Hello friends, is there a test automation framework in Kotlin like Cypress (http://cypress.io)?
    b
    • 2
    • 1
  • b

    Big Chungus

    02/20/2023, 10:00 AM
    Has anyone figured out how to write dynamic tests on native? I'm fine with using undocumented/unstable/internal APIs if that helps.
Powered by Linen
Title
b

Big Chungus

02/20/2023, 10:00 AM
Has anyone figured out how to write dynamic tests on native? I'm fine with using undocumented/unstable/internal APIs if that helps.
View count: 3