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
spek
  • r

    robstoll

    02/07/2018, 1:53 PM
    or TempDirectory in Junit5?
    r
    • 2
    • 2
  • j

    jacob

    02/23/2018, 5:14 AM
    Are there any resources on how to use spek with suspend functions?
    r
    p
    l
    • 4
    • 6
  • j

    Jesper Hasselström

    02/23/2018, 9:59 AM
    Hi, has anyone had any success running all Spek tests with right click -> “Run all tests” in IntelliJ? Our spek tests aren’t being recognized that way.
    r
    • 2
    • 2
  • j

    jk

    02/23/2018, 10:15 AM
    that works ok for me
    j
    • 2
    • 4
  • d

    Dominik.sittel

    02/23/2018, 2:24 PM
    Problems to get spek running with mockito
    r
    g
    • 3
    • 12
  • r

    rrva

    02/23/2018, 2:39 PM
    I have a large number of data converter tests to write (model transformations). What is a good way to structure the tests for compactness and maintenance? Now I am using data classes with I can call
    copy()
    on to create different input to the test cases. Anything else? Examples appreciated!
    r
    • 2
    • 3
  • j

    jk

    02/24/2018, 6:16 PM
    Did you install the spek plugin? https://plugins.jetbrains.com/plugin/8564-spek
    c
    r
    • 3
    • 3
  • j

    jk

    03/07/2018, 12:40 PM
    @Hugo looks like you probably need to add the junit platform plugin and set it up: http://spekframework.org/docs/latest/#_gradle
    h
    r
    • 3
    • 2
  • j

    janvladimirmostert

    03/08/2018, 10:15 AM
    Any suggestions for a mocking tool that can fully mock Hiberbate and work well with Spek? Mockito seems to want all classes made open which is not ideal.
    r
    j
    • 3
    • 3
  • g

    gildor

    03/08/2018, 10:18 AM
    Mockito support inline-mocking, that allows to mock final classes
    l
    • 2
    • 2
  • o

    Oleksii Malovanyi

    04/04/2018, 2:29 PM
    Also,
    memoized
    is not documented (and doesnt work with
    CachingMode.GROUP
    for
    on
    ) on 1.1.5 – is it intended to use only starting from 2.x release?
    r
    • 2
    • 5
  • r

    radityagumay

    04/07/2018, 4:53 AM
    https://github.com/raniejade/spek-idea-plugin/issues/64#issuecomment-379229935
    r
    • 2
    • 6
  • r

    radityagumay

    04/09/2018, 6:59 AM
    @raniejade hi, do you guys know how to create similar @Rule in spek?
    r
    • 2
    • 3
  • v

    v79

    04/20/2018, 5:59 PM
    This might be a daft question, but how do I run Spek tests from the gradle command line?
    gradlew clean test
    reports
    5 actionable tasks: 5 executed
    (there are 5 test files) but there's no console logging, even when tests fail. The tests run in IntelliJ as expected.
    f
    r
    • 3
    • 6
  • r

    radityagumay

    04/21/2018, 2:42 AM
    in above implementation i lost of my
    whenever
    or
    on
    block. because
    repository.fetchWeather() willReturnSingle weatherData // this weatherData from fixture
                    
                    presenter.fetchWeather()
    should be done in whenever or on block
    a
    • 2
    • 4
  • k

    kingsley.gomes

    04/26/2018, 11:59 AM
    Here’s my test class
    @RunWith(JUnitPlatform::class)
    class AccountCheckViewModelTest : Spek({
    
        include(RxSchedulersOverrideRule)
    
        val httpException = mock<HttpException> {
            on { code() }.thenReturn(400)
        }
    
        given(" account check") {
            var accountCheckRequest = mock<CheckExistingAccountRequest>()
            var accountCheckResponse = mock<CheckExistingAccountResponse>()
            var webService = mock<IAPICalls>()
    
            val accountCheckViewModel = spy(VMAccountCheck(webService))
    
            beforeEachTest {
    
                accountCheckRequest = mock<CheckExistingAccountRequest>() {
                    on { email }.thenReturn("foo@mail")
                }
    
                accountCheckResponse = mock<CheckExistingAccountResponse>() {
                    on { firstName }.thenReturn("foo")
                    on { email }.thenReturn("foo@mail")
                }
    
                webService = mock<IAPICalls> {
                    on { checkExistingAccount(accountCheckRequest) }.thenReturn(Flowable.just(accountCheckResponse))
                }
             }
            on("api success") {
                accountCheckViewModel.checkIfAccountExists(request = accountCheckRequest)
    
                it("it:: should call live data with first name as foo") {
                   verify(accountCheckViewModel, times(1)).updateLiveData(accountCheckResponse.firstName, accountCheckResponse.email, null)
                }
            }
        }
    and associated stacktrace : https://pastebin.com/gy6dLtGg
    r
    • 2
    • 2
  • c

    christophsturm

    04/26/2018, 4:17 PM
    what is everybody’s favorite assertion lib?
    r
    j
    +4
    • 7
    • 13
  • s

    satejs

    04/27/2018, 6:21 AM
    When I run
    gradle test
    , is it possible to get a break up of which tests have failed? Additionally, when I run
    gradle test
    for the second time, it doesn't run the tests again. Could someone help with this?
    g
    r
    • 3
    • 8
  • r

    rafal

    05/21/2018, 1:24 PM
    Is is possible to use Spek 2.x in JavaScript modules?
    r
    • 2
    • 4
  • d

    dave08

    05/30/2018, 5:09 AM
    Like fast/slow or db dependant... is there a way to tag speks and run only selected tags from gradle command line (like when running CI pipelines) @raniejade
    r
    • 2
    • 5
  • d

    dave08

    05/30/2018, 1:54 PM
    Is there a way to override a
    memoized
    val
    declared in
    given
    inside
    on
    ?
    r
    • 2
    • 1
  • r

    rook

    06/01/2018, 3:13 PM
    Maybe a silly question, but when are
    beforeGroup
    and
    afterGroup
    called? In previously working tests, I’m suddenly getting an error in my
    afterGroup
    block that seems to indicate it’s being run before my
    beforeGroup
    has been run
    beforeGroup {
      presenter.takeView(view) //this opens a dao connection
    }
    
    afterGroup {
      presenter.dropView(view) //this closes the dao connection
    }
    
    //error generated: kotlin.UninitializedPropertyAccessException: lateinit property dao has not been initialized
    r
    • 2
    • 2
  • d

    dave08

    06/05/2018, 3:54 PM
    How does
    memoized
    work? I have something like this:
    class Test : Spek {
         val something by memoized { mockk<ISomething>() }
    
        given("do this") {
             every { something.doThis() } returns true
    
            on("that happened") {
                   it("verify") {
    .....
    }
    The something doesn't have the value true I gave it on
    given
    ... I tried using other caching strategies, but natta...
    r
    • 2
    • 7
  • g

    gabriel.pereira.au

    06/08/2018, 12:32 AM
    Is there any way to configure it for AS 3.1 or 3.2 yet?
    r
    r
    • 3
    • 4
  • q

    quiqua

    06/09/2018, 8:44 PM
    Hello! How would I apply a JUnit Rule with Spek? Example:
    internal class StatsViewModelSpek : Spek({
        describe("a StatsViewModel") {
            beforeEachTest {
                // Junit Rule to apply 
                InstantTaskExecutorRule()
            }
            context("") {
                val stats = Stats()
                on("create") {
                    it("should initialize without problems") {
                        val statsViewModel = StatsViewModel(stats)
                    }
                }
            }
        }
    })
    This returns
    java.lang.RuntimeException: Method getMainLooper in android.os.Looper not mocked
    , because I use
    LiveData
    inside that viewModel
    • 1
    • 2
  • r

    robfletcher

    06/25/2018, 9:40 PM
    Would it make sense to remove the 1.1.19 artifacts from Bintray & JCenter? If you resolve dependencies using
    latest.release
    or
    +
    in Gradle that’s the version you’ll get because 1.1.19 looks higher than 1.1.5 even though it’s a year older. With Gradle’s new dependency locking feature this is more noticeable (because using dynamic versions like that is no longer necessarily an easy way to shoot yourself in the foot). I notice that version was not synced to Maven Central so it’s only on mutable repos.
    r
    • 2
    • 1
  • r

    robfletcher

    06/26/2018, 5:20 PM
    which means you’re not really using wildcards at all
    g
    • 2
    • 1
  • c

    christophsturm

    06/28/2018, 9:20 AM
    why is 1.1.5 newer than 1.1.20?
    s
    • 2
    • 1
  • r

    raniejade

    07/03/2018, 9:18 AM
    Hey guys, I'm on the final stretch on doing the first alpha release. Visit http://spekframework.netlify.com/ for the WIP documentation site
    🎉 10
    r
    • 2
    • 4
  • h

    Hamza

    07/07/2018, 5:22 PM
    can’t use any \@mock annotations as the docs told me to do with mocked vars. is that ok?
    r
    • 2
    • 1
Powered by Linen
Title
h

Hamza

07/07/2018, 5:22 PM
can’t use any \@mock annotations as the docs told me to do with mocked vars. is that ok?
r

radityagumay

07/14/2018, 5:24 PM
use nharman lib
View count: 1