Testing
Testing
Section titled “Testing”Testing guide for Toss development.
Running Tests
Section titled “Running Tests”Rust Tests
Section titled “Rust Tests”cd rust_corecargo testFlutter Tests
Section titled “Flutter Tests”cd flutter_appflutter testAll Tests
Section titled “All Tests”make test-allTest Structure
Section titled “Test Structure”Rust Core Tests
Section titled “Rust Core Tests”Located in rust_core/src/**/tests/:
- Network Tests: P2P, relay, mDNS
- Crypto Tests: Key exchange, encryption
- Protocol Tests: Message serialization
- Storage Tests: Database operations
Flutter Tests
Section titled “Flutter Tests”Located in flutter_app/test/:
- Widget Tests: UI component tests
- Service Tests: Service layer tests
- Integration Tests: End-to-end tests
Test Coverage
Section titled “Test Coverage”Target coverage: 70%
Check coverage:
cd rust_corecargo tarpaulin --out HtmlWriting Tests
Section titled “Writing Tests”Rust Test Example
Section titled “Rust Test Example”#[cfg(test)]mod tests { use super::*;
#[test] fn test_function() { assert_eq!(function(), expected); }}Flutter Test Example
Section titled “Flutter Test Example”void main() { testWidgets('Widget test', (WidgetTester tester) async { await tester.pumpWidget(MyWidget()); expect(find.text('Hello'), findsOneWidget); });}Integration Tests
Section titled “Integration Tests”E2E tests require FFI bindings:
cd flutter_appflutter test integration_test/app_test.dartCI/CD Testing
Section titled “CI/CD Testing”Tests run automatically on:
- Every push to main/develop
- Every pull request
- Nightly builds
See .github/workflows/ci.yml for details.
Next Steps
Section titled “Next Steps”- API Reference - API documentation
- Platform Support - Platform-specific details
- Architecture - System design