Thread
#compose
    s

    streetsofboston

    3 years ago
    Currently, in a lot of our Android apps, our ViewModels emit sealed data-class instances that closely match the UI (Views), minimizing the code in the UI (Activities, Fragments). These sealed data-classes are very easy to test in plain unit-tests, since they have no dependencies on the Android platform. My question is: Will/does Compose generate instances of classes that are very easy to unit-test as well?
    r

    romainguy

    3 years ago
    Which generated instances are you talking about? @Model classes?
    s

    streetsofboston

    3 years ago
    Yep. The
    @Model
    classes and maybe even
    Compoments
    or other variations of a composable functions. Would it be possible to write plain unit tests to inspect/assert/verify those?
    r

    romainguy

    3 years ago
    @Model classes are just data classes (or should be)
    For testing in general we have something called Semantics that will also be used for a accessibility and other tasks that require extracting information from the UI (assistants)
    l

    Leland Richardson [G]

    3 years ago
    testing composables should not require any android platform dependencies, so this will be preserved, yes. For testing them, we will be providing some test contexts to compose into and then assert on the result, however if the trees you are producing have android views (as opposed to just compose UI), then you will still have to have an android platform dependency
    s

    streetsofboston

    3 years ago
    Thank you, @romainguy and @Leland Richardson [G] !