docs/testing-conventions.md
These conventions keep the client-rewrite suite deterministic, reproducible, and portable across implementations.
| Test type | Location | Naming |
|---|---|---|
| JVM unit and contract tests | app/src/test/ | *Test.kt |
| Shared deterministic fakes and fixtures | app/src/test/**/testsupport/ | Descriptive fixture name |
| Robolectric tests | app/src/test/ | *RobolectricTest.kt |
| Android instrumented tests | app/src/androidTest/ | *InstrumentedTest.kt |
| Coverage-tool tests | tools/coverage/ | test_*.py |
| Interoperability fixtures | app/src/test/resources/contracts/ | Protocol and version in filename |
TEST_SEED for a
specific replay.Test names should describe observable behavior:
@Test
fun `replayed ciphertext is rejected without advancing receive state`() {
// ...
}
Avoid names tied to private methods or temporary implementation structure.
Reusable Kotlin fixtures live under
com.bitchat.android.testsupport. ReproducibleTestSeed resolves
TEST_SEED and provides a reproduction hint:
TEST_SEED=12345 ./gradlew clientRewriteContractTest
Never use production keys, contact information, messages, or other user data in fixtures.
Run the full report and non-regression floor:
./gradlew clientRewriteContractTest
Reports are written to:
app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xmlapp/build/reports/jacoco/jacocoTestReport/html/Check executable production lines changed from the base branch:
COVERAGE_BASE_REF=origin/main ./gradlew checkChangedLineCoverage
Generated resource classes, Compose-generated singleton classes, platform bridges, and vendored Noise code are excluded from first-party coverage metrics.