https://kotlinlang.org logo
z

zsperske

09/02/2020, 6:04 PM
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

Evan

09/02/2020, 6:06 PM
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

zsperske

09/02/2020, 6:07 PM
is that a separate source set for instrumented tests? do you remember where you read about it?
e

Evan

09/02/2020, 6:08 PM
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

zsperske

09/02/2020, 6:09 PM
Oh I kinda remember that post, did you ever solve your issues or find a workaround?
e

Evan

09/02/2020, 6:10 PM
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

zsperske

09/02/2020, 6:11 PM
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

Evan

09/02/2020, 8:37 PM
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

zsperske

09/03/2020, 11:59 PM
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

Evan

09/04/2020, 12:02 AM
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

zsperske

09/04/2020, 12:02 AM
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

Evan

09/04/2020, 12:06 AM
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
27 Views