Has anyone successfully run an Android Instrumente...
# multiplatform
z
Has anyone successfully run an Android Instrumented Test from their
androidTest
source set? I'm trying to write UI tests in
commonTest
that will run on android/iOS
e
I think to run instrumented tests, they have to be in the
androidAndroidTest
folder, but I haven’t had a lot of time to look into that.
z
is that a separate source set for instrumented tests? do you remember where you read about it?
e
Yes, it’s another source set. I read about it here in the channel if you search you’ll see posts about it and a post about an issue I ran into with it.
z
Oh I kinda remember that post, did you ever solve your issues or find a workaround?
e
no, I haven’t had a chance to look into it further
search
androidAndroidTest
and you’ll see quite a few people talking about (and the terrible source set name, lol)
z
haha yeah when I first read that I thought you'd just typo'ed
while chasing various things, I renamed my android app folder from
AndroidApp
to
app
as I thought I recalled that
app/src/androidTest
is actually a "special" path and once I did, trying to assemble my connected tests exploded with conflicts with some of the usual suspects (Duplicate class org.apache.maven.*)
Is this similar to what you ran into as well?
e
Yeah, same behavior pretty much, just different duplicate classes. My instrumentation tests run if I comment out all dependencies under
androidTest
and my unit tests run if I comment out all the dependencies under
androidAndroidTest
Not sure if I’m going to actually keep looking into that issue, I’ve since started restructuring what I have into a shell generated by the KMM SDK
might run into the same thing there, but hopefully not 🤞
@zsperske I migrated all my code into a project generated by the KMM SDK, and added my test dependencies / android test dependencies back one by one and am now running both with no duplicate issues.
z
hell yeah, congrats
i'm hoping to also have my project run on web, not sure if KMM makes that impossible but I should take a look
e
you can definitely add a js target source set to the shared module generated by KMM
not sure if it’s the folder structure or just something different in the auto generated build files that got things to work, though
z
interesting
i wish jetbrains had given us some more guidance on what the future is. is KMM going to be their focus? or is it going to exist side by side with support for the other platforms?
(not expecting you to know)
e
yeah I feel similarly. Though if I had to guess, I feel KMM is more about IDE tools for Android Studio* and easing mobile development and it will exist side by side or under KMP as a whole since it uses the same modules and libraries
121 Views