Skip to content

Testing

Testing guide for Toss development.

Terminal window
cd rust_core
cargo test
Terminal window
cd flutter_app
flutter test
Terminal window
make test-all

Located in rust_core/src/**/tests/:

  • Network Tests: P2P, relay, mDNS
  • Crypto Tests: Key exchange, encryption
  • Protocol Tests: Message serialization
  • Storage Tests: Database operations

Located in flutter_app/test/:

  • Widget Tests: UI component tests
  • Service Tests: Service layer tests
  • Integration Tests: End-to-end tests

Target coverage: 70%

Check coverage:

Terminal window
cd rust_core
cargo tarpaulin --out Html
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_function() {
assert_eq!(function(), expected);
}
}
void main() {
testWidgets('Widget test', (WidgetTester tester) async {
await tester.pumpWidget(MyWidget());
expect(find.text('Hello'), findsOneWidget);
});
}

E2E tests require FFI bindings:

Terminal window
cd flutter_app
flutter test integration_test/app_test.dart

Tests run automatically on:

  • Every push to main/develop
  • Every pull request
  • Nightly builds

See .github/workflows/ci.yml for details.