Add information about testing-unit Gradle module (#2674)

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>
This commit is contained in:
Timothy 2025-05-26 15:55:21 +02:00 committed by GitHub
parent a5037b9f32
commit 3c139515d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.