Description
Since the forked repository was mostly produced with AI tools, we need to establish a robust unit testing architecture within the src/test directory. Unlike instrumentation tests (which require an emulator), these tests will target our business logic, ViewModels, and UseCases to provide rapid feedback during development.
Technical Focus
Location: app/src/test/...
Target: Core logic, Utility classes, ViewModels, and Repository layers.
Constraints: No Android dependencies (use Mocking for Context, Looper, etc.).
Implementation Checklist
Dependency Configuration
Add JUnit 5 or JUnit 4 to build.gradle.
Add MockK (preferred for Kotlin) or Mockito for dependency mocking.
Add Coroutines Test library for handling runTest and Dispatchers.
Add Turbine (if using Kotlin Flows).
Architecture Setup
Create a BaseTest class if common setup (like InstantTaskExecutorRule) is needed.
Define a testing strategy for Dependency Injection (e.g., passing mocks to constructors).
Priority Test Areas
ViewModels: Test StateFlow updates and event handling.
UseCases/Interactors: Verify business rules and data flow.
Mappers: Ensure API entities are correctly converted to Domain models.
Utils: Validate helper functions and extension methods.
Testing Workflow
By keeping these tests in the test folder, we ensure the following execution flow:
Developer writes code + tests.
Gradle executes ./gradlew test.
JVM runs tests without needing an APK or Emulator.
Result: Near-instant validation of logic.
**Description**
Since the forked repository was mostly produced with AI tools, we need to establish a robust unit testing architecture within the src/test directory. Unlike instrumentation tests (which require an emulator), these tests will target our business logic, ViewModels, and UseCases to provide rapid feedback during development.
**Technical Focus**
Location: app/src/test/...
Target: Core logic, Utility classes, ViewModels, and Repository layers.
Constraints: No Android dependencies (use Mocking for Context, Looper, etc.).
**Implementation Checklist**
1. Dependency Configuration
- [ ] Add JUnit 5 or JUnit 4 to build.gradle.
- [ ] Add MockK (preferred for Kotlin) or Mockito for dependency mocking.
- [ ] Add Coroutines Test library for handling runTest and Dispatchers.
- [ ] Add Turbine (if using Kotlin Flows).
2. Architecture Setup
- [ ] Create a BaseTest class if common setup (like InstantTaskExecutorRule) is needed.
- [ ] Define a testing strategy for Dependency Injection (e.g., passing mocks to constructors).
3. Priority Test Areas
- [ ] ViewModels: Test StateFlow updates and event handling.
- [ ] UseCases/Interactors: Verify business rules and data flow.
- [ ] Mappers: Ensure API entities are correctly converted to Domain models.
- [ ] Utils: Validate helper functions and extension methods.
**Testing Workflow**
By keeping these tests in the test folder, we ensure the following execution flow:
1. Developer writes code + tests.
2. Gradle executes ./gradlew test.
3. JVM runs tests without needing an APK or Emulator.
4. Result: Near-instant validation of logic.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
Since the forked repository was mostly produced with AI tools, we need to establish a robust unit testing architecture within the src/test directory. Unlike instrumentation tests (which require an emulator), these tests will target our business logic, ViewModels, and UseCases to provide rapid feedback during development.
Technical Focus
Location: app/src/test/...
Target: Core logic, Utility classes, ViewModels, and Repository layers.
Constraints: No Android dependencies (use Mocking for Context, Looper, etc.).
Implementation Checklist
Create a BaseTest class if common setup (like InstantTaskExecutorRule) is needed.
Define a testing strategy for Dependency Injection (e.g., passing mocks to constructors).
Testing Workflow
By keeping these tests in the test folder, we ensure the following execution flow: