testdrive 0.1.0 copy "testdrive: ^0.1.0" to clipboard
testdrive: ^0.1.0 copied to clipboard

Flutter SDK for TestDeck. Captures HTTP, logs, navigation, and exceptions from debug builds.

TestDrive Changelog #

0.1.0 #

Initial release.

Capture #

  • HTTP via HttpOverrides — every dart:io HttpClient is wrapped: method, URL, headers, request body, response status/headers/body, and duration. Capture is pre-TLS, so cert-pinned endpoints work.
  • LogsdebugPrint is wrapped automatically; TestDrive.log(message, level:, tag:, payload:, error:, stack:) for explicit structured entries; TestDrive.developerLog(...) as a drop-in for dart:developer.log (forwards to the real call and maps the integer level + name to a LogLevel/tag).
  • NavigationTestDrive.navigator() is a drop-in NavigatorObserver capturing push / pop / replace / remove with route names and arguments.
  • ErrorsFlutterError.onError and PlatformDispatcher.instance.onError are chained so Dart exceptions surface in the TestDeck desktop Errors tab; previous handlers still fire.

Transport #

  • NDJSON-over-TCP to 127.0.0.1:9876 (configurable), with a hello handshake carrying a wire-protocol version for forward compatibility.
  • 128-event reconnect buffer with full-jitter exponential backoff (1s → 30s cap) — the app is never blocked when the desktop isn't running.
  • Rate limiter — a default 200 events/s cap (configurable via maxEventsPerSecond, 0 to disable) protects the transport from a debugPrint flood.

Robustness #

  • Encode-safe emit — non-encodable events (e.g. a payload holding a non-JSON value) are dropped at emit time and never buffered, so they can't wedge the queue; an encode failure never tears down a healthy socket.
  • No "pending forever" — response emission fires on the first of stream done, error, or subscription cancel, so requests never stick in a pending state in the desktop.
  • Size-capped bodies — a stream tee captures up to 1 MB (configurable) without ever disturbing the app's own stream consumers.
  • Honest stack traces — log entries use the attached error's own stack (or an explicit one), never substituting TestDrive's own frames.
  • Stack cap — exception stacks are capped at 64 KB with a sentinel.
  • Non-JSON nav args fall back to the runtime type name instead of crashing the host app.
  • detach() restores all previously installed globals.

Zero dependencies #

  • Depends only on Dart SDK libraries plus Flutter.

Example app #

  • Minimal example wiring TestDrive.init() with HTTP capture, structured logs, developerLog, and a NavigatorObserver.

Platform support #

  • Android: transport via adb reverse (TCP loopback)
  • Web: not supported (dart:io HttpOverrides is unavailable on TestDrive Web)
0
likes
160
points
6
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter SDK for TestDeck. Captures HTTP, logs, navigation, and exceptions from debug builds.

Repository (GitHub)
View/report issues

Topics

#debugging #networking #logging #devtools

License

MIT (license)

Dependencies

flutter

More

Packages that depend on testdrive