As kotest IntelliJ plugin does not support common ...
# kotest
v
As kotest IntelliJ plugin does not support common Tests I have kept all my tests in
androidUnitTest
source set But I am not able to run test from the run icon beside test function in Android Studio as well as from the Kotest IntelliJ plugin I get this
EngineException
Anyone knows how to solve this?
k
You should be able to run `commonTest`s through IDE for a particular target (jvm, ios), but afaik right now it only works for entire test suite. Running an individual test doesn't work.
v
@Kirill Zhukov Can you share a sample repo which has kotest in common source set? i was not able to make it work, so i kept tests in androidUnitTest sourceset My project targets Android and iOS
Give a 404
Seems like i have to stick to androidUnitTest as I use MockK and it does not support K/N
90%+ of our tests is in
commonTest
. Our main targets are Android and iOS, but we also have setup to make our code compile for JVM so that we can run tests locally easier and quicker in JVM.
On CI we run
commonTest
and platform specific tests on all targets
Running from IDE works for us if you right click on the test file - allows you to pick a target.
v
Oh i see, Just a question, Is keeping tests in
androidUnitTest
a drawback, I dont want to add another target and unfortunately cannot move to commonTest as MockK does not support
k
same with the gutter
v
Oh i see, isnt running on jvm same as running on android Locally? Do we really need to setup JVM target to run unit tests, if project supports only android and iOS?
k
Is keeping tests in
androidUnitTest
a drawback
I'd say it's better to keep as much common code as possible - if you can't then it might be a sign that you depend too much on some platform specific lib/code
v
I tried using other mocking libraries which support KMP, but they dont work with classes, only support Interfaces Like MockKMP, Mokkery, the Ksp, opening final classes does not work
k
MockK is KMP friendly so you should be able to move to
commonTest
?
Ah, MockK doesn't support iOS target though?
v
it does not, so not able to add it in commonTest
I maybe have to keep it in android side until, mockK support K/N, then move all tests to commonTest
k
That's an option - just need to be careful not to add more platform specific dependencies to tests
v
yup