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

A property-based testing framework for Dart with powerful generators and shrinking capabilities

example/example.dart

import 'package:property_testing/property_testing.dart';

void main() async {
  // Using the new PropertyTestRunner with an email generator
  final runner = PropertyTestRunner(Specialized.email(), (email) {
    // You can add property assertions here
    assert(email.contains('@'), 'Email should contain @');

    // Example property test
    final parts = email.split('@');
    assert(parts.length == 2, 'Email should have exactly one @');

    // Property: email should have local part and domain
    assert(parts[0].isNotEmpty, 'Local part should not be empty');
    assert(parts[1].isNotEmpty, 'Domain should not be empty');
  }, PropertyConfig(numTests: 100));

  final result = await runner.run();
  if (!result.success) {
    print(result.report);
  }
}
0
likes
150
points
191
downloads

Publisher

unverified uploader

Weekly Downloads

A property-based testing framework for Dart with powerful generators and shrinking capabilities

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

meta, server_testing, test

More

Packages that depend on property_testing