testmate 1.0.0 copy "testmate: ^1.0.0" to clipboard
testmate: ^1.0.0 copied to clipboard

A smart test logger for Dart & Flutter with CSV/JSON reporting.

๐Ÿงช TestMate #

TestMate is a developer-first test logger library for Dart and Flutter projects that helps you generate rich test execution reports with minimal setup.
It captures detailed results from your unit and integration tests including:

  • โœ”๏ธ Pass/fail status
  • ๐Ÿ•’ Start & end timestamps
  • ๐Ÿ“„ Exception and stack trace info
  • ๐Ÿ“ฆ Output values of test results
  • ๐Ÿงพ Optional CSV, JSON, or plain-text logs

โœ… Features #

  • Plug-and-play usage with package:test
  • Auto-captures test success/failure
  • Built-in exception and stack trace logging
  • Generates logs in .json, .csv, or .txt
  • Auto-names report files using test suite and datetime
  • Supports generic result types with custom serializers

๐Ÿš€ Getting Started #

1. Add the dependency #

dependencies:
  testmate: ^1.0.0

### 2. Import in your test file
```dart
import 'package:testmate/testmate.dart';

3. Example Usage #

final logger = TestLogger();

test('returns valid data', () async {
  final start = DateTime.now();

  try {
    final result = await myService.getData();
    expect(result.isSuccess, isTrue);

    logger.logSuccess(
      testName: 'returns valid data',
      startTime: start,
      result: result,
      resultSerializer: (r) => r.toString(),
    );
  } catch (e, st) {
    logger.logFailure(
      testName: 'returns valid data',
      startTime: start,
      exception: e,
      stackTrace: st,
    );
    rethrow;
  }
});

tearDownAll(() async {
  await logger.save('test_output/my_test_log.json'); // optional path
});


### 4. Output Example
```json
{
  "testName": "returns valid data",
  "startTime": "2025-05-28T18:17:56.123Z",
  "endTime": "2025-05-28T18:17:56.123Z",
  "status": "passed",
  "message": "Test passed.",
  "result": "result",
  "exception": null,
  "stackTrace": null
}

Csv Example

Test Name,Start Time,End Time,Status,Message,Result,Exception,Stack Trace
returns valid data,2025-05-28T18:17:56.123Z,2025-05-28T18:17:56.123Z,passed,Test passed.,result,null,null
0
likes
130
points
12
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A smart test logger for Dart & Flutter with CSV/JSON reporting.

License

MIT (license)

Dependencies

flutter, test

More

Packages that depend on testmate