

These will encapsulate all the possible scenarios for these methods. callback_remoteSuccess_getUser_successįollowing the naming convention of given_when_then. Suspend functions aren't yet supported on iOS. My Android app will use the suspend function, and my iOS app will use the callback function. The callback returns an IOResult, which encapsulates success and error states. One provides a suspend function and one provides a callback approach. We have two methods, both providing a way of getting a User. Meaning you only have to write your tests once, rather than writing platform-specific tests.

Kotlin provides some common test dependencies to enable you to write multiplatform tests. Implementation ":kotlin-test-annotations-common:$kotlin_version" Implementation ":kotlin-test-common:$kotlin_version" Testing within Kotlin Multiplatform is well supported and will feel very familiar. I want to ensure the only thing I am testing is the class(es) I intended. I use the Given When Then approach to testing across all our Small, Medium and Large tests.

It also needs to work under a variety of conditions.

You want to ensure the code you write behaves as expected. Use premade themes to get started quickly, or create your own visual style down to the very pixel.A how-to guide on writing tests within Kotlin Multiplatform. Component-level reuseīuild your UIs with customizable widgets that you can use on all of your target platforms. Easily access the full capabilities of every platform, just like native applications. Use a wide variety of production-ready Kotlin libraries and frameworks that make it easy to be productive from the get-go and get support from a helpful and welcoming developer community! Easy integration with every platformīuilding on top of Kotlin Multiplatform means not having to compromise on using platform-specific features and APIs. Use the same familiar APIs from Jetpack Compose to build user interfaces for all platforms. Save yourself the effort of keeping different UIs in sync, and get your app into the hands of your users more quickly. Build your user interface once, and use it on all platforms – Android, iOS, web, and desktop.
