testWithRandom method
void
testWithRandom(
- String description,
- TesterWithRandom<T> body, {
- String? testOn,
- Timeout? timeout,
- dynamic skip,
- dynamic tags,
- Map<String, dynamic>? onPlatform,
- int? retry,
})
Implementation
@isTest
void testWithRandom(
String description,
TesterWithRandom<T> body, {
String? testOn,
test_package.Timeout? timeout,
dynamic skip,
dynamic tags,
Map<String, dynamic>? onPlatform,
int? retry,
}) {
// How many random values the test needs shouldn't change what other inputs
// are chosen. Otherwise, if a test fails, you edit the content and then the
// test succeeds, you're not sure what made the test succeed:
//
// - Maybe you fixed the root problem.
// - Or you changed some calls to the random instance, causing the faulty
// input to never be generated in the first place.
final random = explore.random.nextRandom();
test(
description,
(a) => body(a, random.nextRandom()),
testOn: testOn,
timeout: timeout,
skip: skip,
tags: tags,
onPlatform: onPlatform,
retry: retry,
);
}