https://kotlinlang.org logo
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
benchmarks
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
confetti
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
lincheck
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
Title
d

dave08

03/24/2020, 8:55 AM
Good morning @dmcg! I'm trying to get minutest up in a microservice, but I'm getting no tests found...
Testing started at 10:53 AM ...
> Task :cleanTest
> Task :kaptGenerateStubsKotlin UP-TO-DATE
> Task :kaptKotlin UP-TO-DATE
> Task :compileKotlin UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :kaptGenerateStubsTestKotlin
> Task :kaptTestKotlin
w: [kapt] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor (NON_INCREMENTAL), javaslang.match.PatternsProcessor (NON_INCREMENTAL).
> Task :compileTestKotlin
> Task :compileTestJava NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :test FAILED
~~~ Project Configuration ~~~
-> Parallelism: 1 thread
-> Test order: LexicographicSpecExecutionOrder
-> Soft assertations: False
-> Write spec failure file: False
-> Fail on ignored tests: False
-> Extensions
  - io.kotlintest.extensions.SystemPropertyTagExtension
  - io.kotlintest.extensions.RuntimeTagExtension
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [controller.SomeManagerControllerTest](filter.includeTestsMatching)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 4s
9 actionable tasks: 5 executed, 4 up-to-date
With JUnit5
d

dmcg

03/24/2020, 9:01 AM
You’re extending JUnit5Minutests? Try putting a plain old @Test fun in the same class and see if that is run
d

dave08

03/24/2020, 9:02 AM
Yes, I extended that. and even old
@Test
doesn'
doesn't work
I had kotlintest there too, so maybe it's causing problems?
d

dmcg

03/24/2020, 9:03 AM
Then I’d say you have a bigger problem than minutest! Is all the junit engine stuff in place in your Gradle build?
d

dave08

03/24/2020, 9:03 AM
testImplementation("io.kotlintest:kotlintest-runner-junit5:3.4.1")

    testImplementation("io.kotlintest:kotlintest-runner-junit5:3.4.1")

    testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.2")
    testImplementation("dev.minutest:minutest:1.11.0")
    testImplementation("io.strikt:strikt-core:0.24.0")
    testImplementation("io.mockk:mockk:1.9.3")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.2")
    testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.3.2")
val test by tasks.getting(Test::class) {
    useJUnitPlatform { }
}
In kotlin dsl
d

dmcg

03/24/2020, 9:04 AM
I know that Kotlintest has some issue - can you try without it
d

dave08

03/24/2020, 9:08 AM
still not working 😧
I don't really know what this means:
No tests found for given includes: [controller.SomeManagerControllerTest](filter.includeTestsMatching)
Do I need some extra configs?
It seems like Intellij has junit jupiter (api/engine) 5.6.0, platform (commons/engine/launcher) 1.6.0 in its dependency list (newer than what you have on the site), could that be the problem?
oops wrong import for
@Test
...
Looks like kotlintest was the problem... but it's still funny that intellij shows
minutests()[1][1]
as the
test
name...
Is there a bug in gradle 6.2.2 for getting test names @dmcg?
d

dmcg

03/24/2020, 10:04 AM
Between JUnit and Gradle yes. If you run tests in IntelliJ with the IntelliJ runner not the Gradle runner they show up ok
for me!
d

dave08

03/24/2020, 10:12 AM
Ok thanks, I'll give it a try!
It works nicely 😃 ! But is there any way to get rid of the extra minutests() nesting?
d

dmcg

03/24/2020, 3:52 PM
There is the Minutest engine!
d

dave08

03/24/2020, 3:53 PM
?
d

dmcg

03/25/2020, 9:02 AM
@natpryce wrote an engine that uses the JUnit 5 test discovery but not runner. Maybe he can explain how to use it?
n

natpryce

03/25/2020, 9:20 AM
The MinutestEngine plugs into the JUnit runner, giving you nested tests and suites
The TestEngine API is the “official” way to extend JUnit 5 for different test frameworks
d

dave08

03/25/2020, 9:23 AM
So how is it used with Minutest?
n

natpryce

03/25/2020, 9:25 AM
You need to tell one of the layers of JUnit 5 to use the Minutest engine. You can configure it in Gradle. Also in the IntelliJ test runner config dialog.
In gradle you add the config :
useJunitPlatform {
   includeEngines("junit-jupiter", "junit-vintage", "minutest")
}
to your junit config block
However, it’s experimental so be warned it may not do everything you need. It could do with someone to look after it hint hint :-D
d

dave08

03/25/2020, 9:34 AM
Right now, I have that config without includeEngines inside, it still runs the tests but includes:
TestClass
|_ minutest()
   |_Context
     |_Test
minutest() looks a bit funny there and wastes one indenting.
n

natpryce

03/25/2020, 9:35 AM
That looks like the JUnit5 support. The minutest engine expects tests to be written as top-level functions.
d

dave08

03/25/2020, 9:45 AM
You mean just
fun someClassTest() = rootContext {
...
}
at the top level?
with no class around it
n

natpryce

03/25/2020, 9:57 AM
Yes
It had to be annotated I recall
Let me take a look on GitHub to remind myself
No, no annotations needed.
The test engine picks up top-level function that return a root context
d

dave08

03/25/2020, 10:02 AM
Nice 😃! So what kind of quirks could there be here?
n

natpryce

03/25/2020, 10:03 AM
Not sure. I’ve not worked on Minutest for quite a long time, and Duncan has focused on the JUnit5 Jupiter integration rather than the test engine.
It might be that you need to annotate functions to get IntelliJ to recognise them as tests in the code editor
d

dave08

03/25/2020, 10:04 AM
Ok, thanks!
d

dmcg

03/25/2020, 12:05 PM
Yes, getting IntelliJ to recognise them as runnable was the block I stumbled over last night
n

natpryce

03/26/2020, 4:23 PM
If you run all the tests, then you can run individual tests from the tree of tests in the IntelliJ test runner (which is an improvement on when running Minutest from JUnit 5 or JUnit 4).
d

dmcg

03/26/2020, 4:23 PM
I think that I did get that working for JUnit5
Sorry 😉
n

natpryce

03/26/2020, 4:24 PM
Even for tests within subcontexts?
d

dmcg

03/26/2020, 4:25 PM
I think so, away from non-bank computer ATM
n

natpryce

03/26/2020, 4:28 PM
I recall that annotating top-level functions with
@Testable
made IntelliJ treat them as runnable test methods
(And I assume any annotation that is itself meta-annotated with
@Testable
would work)
d

dmcg

03/30/2020, 8:43 AM
Oooh - let me have a look at that (in my copious free time)