Junior — Middle
What components or modules do you usually check with unit tests?
sobes.tech AI
Answer from AI
Unit tests in Android are usually written to verify individual components to ensure they work correctly in isolation from other parts of the application. Most often, they test:
- ViewModel — testing business logic and UI state without dependence on the Android Framework.
- Repository — testing data access logic, such as to a database or network.
- Utility classes and methods — functions that perform calculations or transformations.
- Use Cases / Interactors — separate business operations.
Unit tests should not depend on the Android SDK (e.g., Activity, Fragment), for which instrumental tests are used. Unit tests help quickly identify errors in logic and ensure code stability during changes.