From 3c139515d21c13adb320d3f15a9df53294f58900 Mon Sep 17 00:00:00 2001 From: Timothy <6560631+TimoPtr@users.noreply.github.com> Date: Mon, 26 May 2025 15:55:21 +0200 Subject: [PATCH] Add information about testing-unit Gradle module (#2674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Joris Pelgröm --- docs/android/testing/unit_testing.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/android/testing/unit_testing.md b/docs/android/testing/unit_testing.md index c496e0e6..379eb59b 100644 --- a/docs/android/testing/unit_testing.md +++ b/docs/android/testing/unit_testing.md @@ -35,6 +35,10 @@ The project is configured to use [JUnit 5](https://junit.org/junit5/), which sho When writing unit tests, you often need to isolate the code under test by mocking its dependencies. The project uses [MockK](https://mockk.io/). Use this tool to create mocks or fakes for external dependencies, ensuring that your tests remain focused on the behavior of your code. +### Sharing code between Gradle modules + +The project includes a Gradle module named `:testing-unit` for sharing code across other Gradle modules. Add code to this module if it is used in multiple modules. Make sure that `:testing-unit` remains independent from modules like `:common` to avoid circular dependencies. + ## Testing with Android APIs For cases where your code interacts with Android APIs that cannot be mocked or faked properly, the project includes [Robolectric](https://robolectric.org/). Robolectric allows you to run Android-specific tests in a JVM environment, avoiding the need for an emulator.