https://kotlinlang.org logo
Docs
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

    robfletcher

    07/09/2018, 9:00 PM
    Typo in the v2 docs: the dependency should be
    spek-runner-junit5
    not
    spek-junit5-runner
    l
    • 2
    • 1
  • r

    robfletcher

    07/20/2018, 5:22 PM
    Using the Gherkin syntax is
    Given
    not a synonym for
    beforeGroup
    /
    beforeEachTest
    ? It seems like that would make sense. For example it’s where I’d want to initialize mocks.
    r
    • 2
    • 7
  • c

    christophsturm

    07/25/2018, 1:53 PM
    is there a spek plugin that works with idea 2018.2 rc?
    r
    • 2
    • 1
  • r

    robfletcher

    08/14/2018, 6:31 PM
    or
    org.reflections.ReflectionsException: could not create class object from file org/joda/time/tz/data/Etc/GMT-3
    	at org.reflections.scanners.AbstractScanner.scan(AbstractScanner.java:32)
    	at org.reflections.Reflections.scan(Reflections.java:253)
    	at org.reflections.Reflections.scan(Reflections.java:202)
    	at org.reflections.Reflections.<init>(Reflections.java:123)
    	at org.spekframework.spek2.runtime.SpekRuntime.createReflections(SpekJvmRuntime.kt:68)
    	at org.spekframework.spek2.runtime.SpekRuntime.discover(SpekJvmRuntime.kt:29)
    	at org.spekframework.spek2.junit.SpekTestEngine.discover(SpekTestEngine.kt:37)
    	at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:130)
    	at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:117)
    	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
    	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:74)
    	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
    Caused by: org.reflections.ReflectionsException: could not create class file from GMT-3
    	at org.reflections.adapters.JavassistAdapter.getOfCreateClassObject(JavassistAdapter.java:102)
    	at org.reflections.adapters.JavassistAdapter.getOfCreateClassObject(JavassistAdapter.java:24)
    	at org.reflections.scanners.AbstractScanner.scan(AbstractScanner.java:30)
    	... 13 common frames omitted
    r
    a
    • 3
    • 8
  • n

    Nikky

    08/31/2018, 1:25 AM
    while trying out spek 2.0 today for the first time .. quite awesome btw i managged to make idea run out of memory quite often.. that did not use to happen, maybe the plugin is at fault but i had never before idea pop up a warning about running out of memory before
    r
    r
    • 3
    • 5
  • n

    Nikky

    08/31/2018, 6:23 PM
    i basically have
    val entryList by memoized { ... }
    entryList.forEach { entry ->
        it("test a") {
            assert(entry.a)
        }
    }
    which breaks.. instead one has to not change the tests at runtime, which leads to loops inside the
    it
    or is there a third option i am missing ?
    r
    • 2
    • 1
  • n

    Nikky

    09/01/2018, 12:25 PM
    org.junit.platform.launcher.core.DefaultLauncher handleThrowable
    WARNING: TestEngine with ID 'spek2' failed to discover tests
    java.lang.NoClassDefFoundError: kotlin/streams/jdk8/StreamsKt
    when i just tried to upgrade the spek version
    r
    • 2
    • 12
  • h

    hmole

    09/02/2018, 5:22 PM
    Any news on when spek 2.0 will be able to support new
    kotlin-multiplatform
    https://discuss.kotlinlang.org/t/kotlin-1-3-m2-new-multiplatform-projects-model/9264 plugin?
    r
    • 2
    • 1
  • n

    Nikky

    09/06/2018, 6:00 PM
    why not call it test ?
    r
    • 2
    • 3
  • j

    jk2018

    09/24/2018, 8:57 PM
    I based my setup on this: https://github.com/spekframework/spek-android-example
    r
    • 2
    • 2
  • r

    raniejade

    09/30/2018, 6:27 AM
    Hey all, just initiated the
    2.0.0-rc.1
    release - changelog can be found here: https://github.com/spekframework/spek/releases/tag/2.0.0-rc.1.
    👍 3
    r
    • 2
    • 3
  • r

    raniejade

    10/05/2018, 9:11 AM
    Is anyone using Spek 1's
    include
    ? I've removed it in
    2.x
    , but if it is something widely used then I'll bring it back.
    ✋ 1
    t
    • 2
    • 1
  • s

    sebastien.rouif

    10/05/2018, 2:16 PM
    Hey, in the Spek 1.x I used to chain mutiple
    given
    to describe the context. I had a look at the migration steps on https://spekframework.org/migration/#given-on-it it feels like the
    Given
    in the
    Scenario
    is the equivalent of the `given`(s) but it doesn’t seem like I can chain them. Am i correct ?
    r
    • 2
    • 7
  • r

    robfletcher

    10/05/2018, 3:00 PM
    You can’t nest them. That’s certainly a limitation I’ve run into with Spek 2. Frequently there’s a higher level context with multiple lower level contexts. I don’t see a way to do that with given.
    s
    • 2
    • 1
  • l

    Leonell

    10/10/2018, 11:59 AM
    I'm not sure why this happened out of seemingly nowhere, but whenever I click the green arrow to run a test, all I see is "Nothing here". I also keep getting this error.
    r
    • 2
    • 26
  • j

    jasper

    10/10/2018, 11:44 PM
    Caused by: java.lang.ClassNotFoundException: kotlin.io.CloseableKt
    r
    • 2
    • 8
  • s

    Sartori

    10/11/2018, 5:42 PM
    Hi guys, I’m new with Spek, anyone know how I can inject dependency with spring boot application? I`m using Spek version 2. i`m trying like this: @Autowired lateinit var userService: UserService
    -.kt
    • 1
    • 1
  • r

    robfletcher

    10/12/2018, 1:10 PM
    Aspen looks like it solves it the only way I’d imagine you can — a DSL extension that you use in place of Spring’s annotations for injection.
    👍 2
    r
    • 2
    • 1
  • r

    robfletcher

    10/12/2018, 4:48 PM
    Spek
    is the one you want I think. It has 18k downloads compared to 466.
    m
    r
    • 3
    • 2
  • d

    dave08

    10/14/2018, 5:05 PM
    On Spek 1.x and Android, if I run my regular JUnit4 tests, I get
    Empty test suite
    , is this a known issue? Is there some kind of workaround?
    r
    t
    • 3
    • 13
  • j

    jasper

    10/15/2018, 12:05 AM
    Spek: Can I tag tests, so I can say “just run this group” ?
    d
    • 2
    • 2
  • r

    robstoll

    10/21/2018, 11:31 AM
    Does spek 2.0 support the JS platform by now? I saw that kotlin provides an experimental way to plug in custom junit frameworks (don't ask me how though)
    r
    g
    a
    • 4
    • 8
  • r

    robstoll

    10/30/2018, 5:50 PM
    Is there a way to filter the stack which is reported when there is a failure?
    a
    • 2
    • 2
  • m

    marcelo

    11/09/2018, 7:49 PM
    the former version of spek
    Transitvely
    depended on an old version of
    kotlin-reflect
    , is this still the case with
    spek2
    ?
    a
    • 2
    • 4
  • m

    marcelo

    11/19/2018, 4:12 PM
    just upgraded to
    spek2
    and when I ran the tests using gradle but it shows as if I have zero tests when I run it:
    > Task :kotlin:video_renderer:junitPlatformTest
    
    Test run finished after 4 ms
    [         0 containers found      ]
    [         0 containers skipped    ]
    [         0 containers started    ]
    [         0 containers aborted    ]
    [         0 containers successful ]
    [         0 containers failed     ]
    [         0 tests found           ]
    [         0 tests skipped         ]
    [         0 tests started         ]
    [         0 tests aborted         ]
    [         0 tests successful      ]
    [         0 tests failed          ]
    my dependencies file are here:
    ext {
      versions = [
        ...
        spek                          : '2.0.0-rc.1',
      ]
      libraries = [
        ...
        spekApi                         : [
                        dependencies.create("org.spekframework.spek2:spek-dsl-jvm:2.0.0-rc.1") {
                            exclude group: 'org.jetbrains.kotlin'
                        }
                ],
                spekJUnitPlatformEngine         : [
                        dependencies.create("org.spekframework.spek2:spek-runner-junit5:2.0.0-rc.1") {
                            exclude group: 'org.junit.platform'
                            exclude group: 'org.jetbrains.kotlin'
                        },
                ],
    this is the configuration that I have for one of my app:
    apply from: "$rootDir/build-scripts/kotlin-library.gradle"
    
    
    kotlin {
        experimental {
            coroutines 'enable'
        }
    }
    
    dependencies {
        compile project(':kotlin:common:file_utils')
        compile project(":kotlin:render_master:publicapi")
        compile project(':kotlin:couch_api')
        compile project(':kotlin:video_renderer:public_api')
        compile libraries.kotlinStdlib
        compile libraries.slf4j
        compile libraries.kotlinCoroutinesCore
    
        testCompile project(':kotlin:video_renderer')
        testCompile libraries.spekApi
        testCompile libraries.truth
        testRuntime libraries.logback
    }`
    a
    • 2
    • 4
  • s

    Sartori

    11/23/2018, 12:04 PM
    anyone knows if is possible create spek tests inside instrumental scope with espresso ?
    r
    • 2
    • 1
  • d

    dewildte

    11/25/2018, 6:33 PM
    Anybody have Speck working with Android yet?
    r
    • 2
    • 1
  • r

    robstoll

    11/25/2018, 7:46 PM
    is spek2 complaining when an exception occurs during the lookup of tests? spek1 doesn't as far as I can tell and it is sometimes quite annoying. You get a green build because no tests were executed at all
    r
    a
    • 3
    • 4
  • t

    tapchicoma

    12/04/2018, 12:15 PM
    for which cases
    CachingMode.INHERIT
    should be used?
    r
    • 2
    • 1
  • m

    Marc Knaup

    12/12/2018, 1:04 PM
    So, a Spek which generates 27,000
    it()
    blocks is horribly slow when run with Gradle+JUnit (15min) but quite fast when run from IntelliJ using the Spek Framework plugin (2sec). I guess JUnit is doing some setup & teardown behind the scenes for each test generated by
    it()
    . How can I optimize that? Is there a setting in Spek which it passes on to JUnit to tell it to e.g. reuse test container? Or do I need to configure JUnit separately somehow?
    r
    • 2
    • 5
Powered by Linen
Title
m

Marc Knaup

12/12/2018, 1:04 PM
So, a Spek which generates 27,000
it()
blocks is horribly slow when run with Gradle+JUnit (15min) but quite fast when run from IntelliJ using the Spek Framework plugin (2sec). I guess JUnit is doing some setup & teardown behind the scenes for each test generated by
it()
. How can I optimize that? Is there a setting in Spek which it passes on to JUnit to tell it to e.g. reuse test container? Or do I need to configure JUnit separately somehow?
r

raniejade

12/15/2018, 4:28 PM
can you share here a sample test?
nvm, replicated with this:
object LargeTest: Spek({
    repeat(27000) {
        test("test $it") {

        }
    }
})
patch for it: https://github.com/spekframework/spek/pull/548
and sorry for the delayed reply!
m

Marc Knaup

12/15/2018, 4:44 PM
No worries, thanks for checking and fixing! 👍
View count: 3