Skip to content

Unit Testing

Tim Chow edited this page Apr 22, 2025 · 2 revisions

All classes and functions that contain logic should have unit test coverage. Running unit tests is one of the CI checks. So unit tests in all modules must pass before a PR is merged.

Unit tests adhere to the following pattern:

  • Written in Kotlin
  • Use Mockk for mocking dependencies for tests
  • Test function names are wrapped in backticks to allow for the inclusion of spaces
    • Test function names follow a Given / When / Then format
  • Example function name: fun `when launch is called and Failure is returned, then app switch failed analytics event is sent`()
  • Test Classes are appended with UnitTest Example: PayPalLauncherUnitTest

Example unit test class: AnalyticsApiUnitTest.kt

Clone this wiki locally