Set Up Snapshots for Kotlin MultiplatformBETA

Set up visual regression testing for Kotlin Multiplatform apps using Android and Apple snapshot workflows.

Snapshots compares images of your app's UI across changes to help catch visual regressions. For Kotlin Multiplatform apps, generate images using tooling for your app's UI, then upload them to Sentry.

Choose the workflow that matches the UI you want to test:

App UIWorkflow
Android views or Jetpack ComposeFollow the Android Snapshots guide to generate images from previews or existing Paparazzi or Roborazzi tests.
Apple UI, including SwiftUI previewsFollow the Apple Snapshots guide to generate images with SnapshotPreviews, swift-snapshot-testing, or another image-producing tool.

For the Android workflow, configure the Sentry Android Gradle Plugin in the Android application module. The KMP Gradle plugin does not provide the sentry.snapshots configuration.

Generate images locally with your chosen tool, then follow Uploading Snapshots to upload the generated image directory with sentry-cli, or use the upload task described in the Android guide. The shared guide covers image formats, stable filenames, and optional metadata.

Keep images for different platforms or rendering configurations in separate paths so they have distinct identities when uploaded together. Use the same rendering environment for baseline and subsequent images to avoid unrelated visual differences.

Generate fresh images and upload them on pull requests and your base branch. Follow Integrating Into CI for the shared workflow and GitHub checks.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").