Gene Cahill

    Gene Cahill

    1 year ago
    I am working on a multi-platform project and in my commonTest it requires Robolectric test runner (i.e. @RunWith(Robolectric::class)) when running the android actual implementation. I’d like to get the benefit of having a single test execute for both android and ios targets without adding android dependencies to commonTest. Is there a clean way to do this?
    ankushg

    ankushg

    1 year ago
    No experience specifically with Robolectric, but maybe you can use expect/actuals to define the annotation and class for Android and make it a no-op for iOS? Here’s an article I wrote about how I got Parcelize to work using similar techniques: https://ankushg.com/posts/multiplatform-parcelize/
    Gene Cahill

    Gene Cahill

    1 year ago
    Yeah that’s exactly what I did. Was just curious if there was a more direct way