Skip to content

Add documentation how to setup for android #481

Open

Description

@Inky-developer

Your library looks really nice! Unfortunately I could not figure out how to set it up for android projects. Could you add some documentation for that?

Activity

  1. nedtwigg commented on Oct 11, 2024

    @nedtwigg
    Member

    I have never developed for android, but I am about to do some tinkering with Quest 3 apps, so I'm curious about this too.

    I would expect that it would just work, but I suppose there might be some complexity with shuttling snapshot data from the simulator back to the dev environment. Can you post some info on your setup / stacktraces?

  2. Inky-developer commented on Oct 11, 2024

    @Inky-developer
    Author

    I think the main problem is that android uses junit4 by default (and I could not figure out how to make junit-vintage work).

    Apart from that, the quick start guide suggests this code:

    tasks.test {
      useJUnitPlatform()
      environment(properties.filter { it.key == "selfie" }) // optional, see "Overwrite everything" below
      inputs.files(fileTree("src/test") { // optional, improves up-to-date checking
        include("**/*.ss")
      })
    }
    

    However, the member test of tasks cannot be resolved.
    I can get this code to compile by using tasks.withType<Test> instead, but I don't know if that is correct, and the test still fails with Could not start Gradle Test Executor 5.

  3. nedtwigg commented on Oct 13, 2024

    @nedtwigg
    Member

    There are three paths:

    1. use Kotest and selfie-runner-kotest
    2. use JUnit5 and mannodermaus/android-junit5
    3. write a JUnit4 runner for Selfie

    I'm a fan of Kotest anyway, so I'll probably be using kotest-android and selfie-runner-kotest. Let me know if you try any of these and how it goes!

  4. Inky-developer commented on Oct 13, 2024

    @Inky-developer
    Author
    1. Kotest is not an option I think, because it does not support robolectric (Which is very important, as it allows running android integreation tests as normal unit tests): I found this repository, but it is archived unfortunately
    2. This works somewhat, however, I run into trouble again when using robolectric. Robolectric requires annotating the test class with @RunWith(RobolectricTestRunner::class) and if I do that, selfie won't work on that class anymore.
    3. That would probably be the simplest solution from a users perspective, but probably a lot of effort to write

    So it seems like I can't really use this library without getting rid of robolectric :(
    But thanks a lot for your comments!

  5. nedtwigg commented on Oct 15, 2024

    @nedtwigg
    Member

    Thanks for looking into these! Agreed, seems like Selfie doesn't offer a satisfactory experience for Android right now. I expect this will change soon, when we make progress on this it will get reported here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions