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

    Nikky

    12/21/2018, 10:21 AM
    its just a small spek i have written quite a while ago to see how it works.. but i know that that should probably not happen
    h
    2 replies · 2 participants
  • p

    piclem

    12/21/2018, 7:58 PM
    any news on updating the intellij plugin for spek? 😄
    ☝️ 1
    p
    2 replies · 2 participants
  • j

    johannes.lagos

    12/27/2018, 10:49 AM
    Anyone have been lucky to use Spek2 for Espresso testing?
    r
    1 reply · 2 participants
  • s

    Sergio Crespo Toubes

    12/28/2018, 4:09 PM
    Any good tutorial of spek2???
    r
    3 replies · 2 participants
  • m

    mmaillot

    01/10/2019, 1:01 PM
    Hi, I have this test:
    object SplashScreenPresenterTest: Spek({
        describe("SplashScreen presenter") {
    
            lateinit var viewMock: SplashScreenView
    
            describe("on no migration running") {
    
                val loadApplicationStateMock = mock<LoadApplicationState> {
                    onBlocking { invoke(any()) } doReturn ApplicationState.MIGRATION_CLASSIC
                }
                val splashScreenPresenter = SplashScreenPresenter(viewMock, loadApplicationStateMock)
                it("should route to standard welcome screen") {
                    runBlocking {
                        splashScreenPresenter.loadState()
                        verify(viewMock, times(1)).moveToClassicMigrationScreen()
                    }
                }
            }
    }
    I want to use viewMock in multiple describe. I use verify, so I need to reset the mock for each describe. How can I init my viewMock for each describe?
    r
    2 replies · 2 participants
  • d

    dzaitsev

    01/11/2019, 9:40 AM
    Hey. I’ve been using Spek for a year and pretty happy with it. Recently we started migration to Spek 2 and faced several issues. 1. ⚠️ Our tests are green if we run them from Android Studio, but ≈80% of them become red if we run tests from Gradle. We get lots of `java.lang.VerifyError`s. Therefore we can’t gather jaCoCo coverage. 2. To be able to run tests from IDE we have to annotate speks with
    @RunWith(JUnitPlatform::class)
    but it requires us to change kotlin dependency from
    kotlin-stdlib-jdk7
    to
    kotlin-stdlib-jdk8
    because it needs streams. Any advice? spek 2.0.0-rc.1, kotlin 1.3.11, AS 3.4 Canary 10, Gradle 5.1
    r
    11 replies · 2 participants
  • s

    snowe

    01/15/2019, 12:38 AM
    I've spent 30 minutes on it and haven't gotten anywhere.
    r
    17 replies · 2 participants
  • m

    mmaillot

    01/16/2019, 9:25 AM
    The plugin seems not compatible with the new version of Android Studio (3.3). The green arrow to launch tests is showed but when I click on it, I have the
    Nothing here
    message. I can run my test with gradle.
    r
    13 replies · 2 participants
  • m

    mmaillot

    01/18/2019, 1:18 PM
    Is it possible to run all tests from Android Studio? If I right click on test folder then click on
    Run 'Spek tests in....'
    , I got an error:
    Test framework quit unexpectedly
    without more information
    r
    4 replies · 2 participants
  • c

    charleskorn

    01/20/2019, 10:10 PM
    Are there any plans for Spek to support Kotlin/Native?
    r
    1 reply · 2 participants
  • m

    mp

    01/29/2019, 9:55 AM
    hi there want to understand state of spek and related staff can anyone share blogpost or tweets about any release plans etc. tnx!
    s
    r
    4 replies · 3 participants
  • s

    snowe

    01/29/2019, 4:28 PM
    or even compose better functionality instead of inherit.. It seems hard with the way that it's all run in a block.
    r
    t
    10 replies · 3 participants
  • s

    snowe

    01/31/2019, 1:50 AM
    Spek fails to run in gradle, but succeeds in intellij. any thoughts?
    -.txt
    r
    n
    13 replies · 3 participants
  • s

    snowe

    02/01/2019, 5:44 AM
    has anyone had any success running
    pitest
    with spek? I get
    10:42:19 PM PIT >> INFO : Sending 86 test classes to minion
    10:42:19 PM PIT >> INFO : Sent tests to minion
    10:42:20 PM PIT >> INFO : MINION : 10:42:20 PM PIT >> INFO : Checking environment
    10:42:20 PM PIT >> INFO : MINION : 10:42:20 PM PIT >> INFO : Found  0 tests
    10:42:20 PM PIT >> INFO : MINION : 10:42:20 PM PIT >> INFO : Dependency analysis reduced number of potential tests by 0
    10:42:20 PM PIT >> INFO : MINION : 10:42:20 PM PIT >> INFO : 0 tests received
    r
    2 replies · 2 participants
  • t

    tapchicoma

    02/01/2019, 1:13 PM
    is it possible to run Spek test n-times?
    r
    4 replies · 2 participants
  • r

    raniejade

    02/04/2019, 7:00 AM
    Hey all! After a long and very slow development, I'm happy to announce that Spek 2 is out. Highlights of the changes can be found here: https://github.com/spekframework/spek/releases/tag/2.0.0.
    😍 1
    🎉 19
    👍 1
    s
    1 reply · 2 participants
  • n

    Nikky

    02/06/2019, 4:56 AM
    i updated to 2.0.0 and i got this:

    https://i.imgur.com/SkeXjL8.png▾

    Feb 06, 2019 5:52:02 PM org.junit.platform.launcher.core.DefaultLauncher handleThrowable
    WARNING: TestEngine with ID 'spek2' failed to discover tests
    java.lang.IllegalStateException: it.javaClass.`package` must not be null
    	at org.spekframework.spek2.junit.SpekTestEngine.discover(SpekTestEngine.kt:51)
    	at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:168)
    	at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:155)
    	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
    	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:102)
    	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:82)
    	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:78)
    	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    	at com.sun.proxy.$Proxy2.stop(Unknown Source)
    	at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:132)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:498)
    	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175)
    	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157)
    	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
    	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    	at java.lang.Thread.run(Thread.java:745)
    or maybe its not really related.. but the error seems to make no sense
    t
    3 replies · 2 participants
  • a

    alilosoft

    02/09/2019, 5:07 AM
    Hi, are there any plans to continue spring support extension
    r
    1 reply · 2 participants
  • a

    alilosoft

    02/10/2019, 9:47 PM
    Hi, I was playing with Spek the last two days, and I run into some problems, and I'm confused. The first problem is related to running tests: I wrote some Speks and JUnit tests just as a demo, when I run the tests with IntelliJ everything was ok!, but when I try to run the tests with Gradle then only the Speks are discovered but JUnit tests are not 😭 When I remove
    includeEngines("spek2")
    from my gradle build then all the tests run fine 👍 So my question: Is this behavior intended or is it a bug? My second problem is related to MockK:
    r
    d
    7 replies · 3 participants
  • a

    alilosoft

    02/10/2019, 10:06 PM
    @raniejade Thanks for the clarification I have another issue with MockK, I tried to write a sample test using MockK and Spek and the test run correctly with gradle test, but when I try to run the test with Spek plugin in IntelliJ I get an exception, and I'm not sure if the problem is in MockK or in Spek plugin???
    r
    3 replies · 2 participants
  • a

    alilosoft

    02/10/2019, 10:32 PM
    @raniejade Sorry, but I have another concern 🤔 Is it possible to write [TestFX](https://github.com/TestFX/TestFX) tests with Spek?
    r
    6 replies · 2 participants
  • c

    christophsturm

    02/13/2019, 12:44 PM
    pitest has a plugin for junit5 so that should just work
    s
    r
    10 replies · 3 participants
  • r

    rook

    02/15/2019, 7:08 PM
    NoClassDefFoundError
    It looks like I’m missing a dependency or something?
    r
    39 replies · 2 participants
  • t

    tapchicoma

    02/18/2019, 9:54 AM
    Is it a lot of work to also publish plugin to canary versions of Android Studio? Would be nice to have versions to canary builds as well.
    r
    2 replies · 2 participants
  • s

    Slackbot

    02/21/2019, 8:28 PM
    This message was deleted.
    r
    p
    2 replies · 3 participants
  • p

    pavel

    02/21/2019, 8:57 PM
    Is there a way to get it by
    Scenario
    instead?
    t
    r
    3 replies · 3 participants
  • s

    Shan

    02/23/2019, 11:52 PM
    https://stackoverflow.com/questions/54847416/warning-testengine-with-id-spek2-failed-to-discover-tests-with-gradle-v5-2-1 posted on Stack as well if anyone wants to answer there instead 👍
    r
    10 replies · 2 participants
  • s

    Shan

    03/05/2019, 7:19 AM
    Is there a Spek equivalent of KotlinTest's "eventually" method? https://github.com/kotlintest/kotlintest/blob/master/doc/nondeterministic.md
    r
    1 reply · 2 participants
  • r

    raniejade

    03/23/2019, 1:54 AM
    Quick poll. Do you depend on the laziness of
    memoized
    on your tests? https://github.com/spekframework/spek/pull/660 came up to eagerly evaluate
    memoized
    during the execution phase instead of evaluating on access. Options: :yes:, 🇳🇴 and 🙃 if you didn’t know that
    memoized
    is lazy.
    🙃 4
    🇳🇴 3
    g
    n
    4 replies · 3 participants
  • s

    svenjacobs

    03/28/2019, 2:02 PM
    Hi all, is there a way in Spek 2.0 to run some test initialization code once before all tests (of all groups) are run? So something like
    beforeGroup
    but with a greater scope?
    r
    12 replies · 2 participants
Powered by Linen
Title
s

svenjacobs

03/28/2019, 2:02 PM
Hi all, is there a way in Spek 2.0 to run some test initialization code once before all tests (of all groups) are run? So something like
beforeGroup
but with a greater scope?
r

raniejade

03/28/2019, 11:32 PM
Can you post a snippet on what you are trying to achieve?
s

svenjacobs

03/29/2019, 10:53 AM
Please see here https://github.com/rewe-digital/katana/blob/master/core/src/test/kotlin/org/rewedigital/katana/InjectionTests.kt#L18 This works however I would like to execute this line once before all tests from all groups are run.
r

raniejade

04/02/2019, 8:26 AM
@svenjacobs your doing the correct way, you can move the
beforeGroup
inside
desribe("Injection")
which will be only executed for that group.
s

svenjacobs

04/02/2019, 8:41 AM
@raniejade However as I said earlier 😉 I want this code to be run only once before all groups. Not just this test group, but all other test groups, too.
https://github.com/rewe-digital/katana/tree/master/core/src/test/kotlin/org/rewedigital/katana
r

raniejade

04/02/2019, 9:28 PM
then having on the root scope is fine. You get an extra execution for the root scope, is that ok?
s

svenjacobs

04/03/2019, 7:11 AM
How do I declare a root scope? Can you please show an example?
r

raniejade

04/03/2019, 9:29 PM
you’re already doing it 🙂 declaring a
beforeGroup
just before the first describe. Just realised that I have a typo in my previous reply 😂
then having on the root scope is fine -> then having one on the root scope is fine
s

svenjacobs

04/04/2019, 9:49 AM
But how can I assure that the test group with
beforeGroup
is run as the first test when I run
./gradlew test
? Are they called in alphabetical order? So will
A_Test.kt
run before
B_Test.kt
? And what if an order is not guaranteed?
r

raniejade

04/04/2019, 11:20 AM
beforeGroup
is not global and won’t affect other classes.
class A: Spek({
  beforeGroup { ... }
})

class B: Spek({
  beforeGroup { ... }
})
beforeGroup
on
A
and
B
are isolated.
s

svenjacobs

04/04/2019, 11:27 AM
I know but I need a global solution
r

raniejade

04/04/2019, 9:34 PM
there’s no global solution. You can create an extension then just invoke it on all of your tests.
View count: 1