How do you share testing utils, like `DummyUser` ...
# getting-started
u
How do you share testing utils, like
DummyUser
functions, which give you User with some default parameter, so you don't have to spell out everything. Or fakes in general like`FakeUserRepository` ? Is regular plain kotlin (jvm) module that's included
testImplementation ":user-test-utils"
the idiomatic way?
s
Sounds like a good fit for the Gradle test fixtures plugin
u
do you mean this? java..eww 😄
j
By the way, in case this was not obvious, if the production classes and the tests that need these utilities live in the same subproject, you could simply define those utilities in your test sources. If you want to share utilities with other subprojects, then yes you can create a separate subproject, or use test fixtures in your subproject and consume them from the others (I have personally never used the test fixtures plugin myself).
u
yes this is meant to share fakes across modules, currently I do it in the "plain" jvm module way, it works - but looking if there's a standard way
I heard about the fixtures, but for some reason in android (AGP) context, which doesn't apply in jvm plugin-ed modules
do you guys really use the java named thing?
j
As I said, I don't
u
how do you share test stuff then? plain jvm module?
j
Yes as I described above, same as what you described in your first post
u
okay so it's not so weird then, thank you!
👍 1
c
Gradle Test Fixtures doesn't like KMP 😕