Skip to content

Make testRandomizeOrderingSeed public on Engine #1543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/test_core/lib/src/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Runner {
var engine = Engine(
concurrency: config.concurrency,
coverage: config.coverage,
randomizeOrderingSeed: config.testRandomizeOrderingSeed);
testRandomizeOrderingSeed: config.testRandomizeOrderingSeed);

var sinks = <IOSink>[];
Reporter createFileReporter(String reporterName, String filepath) {
Expand Down
13 changes: 6 additions & 7 deletions pkgs/test_core/lib/src/runner/engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Engine {
///
/// If null or zero no shuffling will occur.
/// The same seed will shuffle the tests in the same way every time.
int? _testRandomizeOrderingSeed;
int? testRandomizeOrderingSeed;

/// A pool that limits the number of test suites running concurrently.
final Pool _runPool;
Expand Down Expand Up @@ -204,10 +204,9 @@ class Engine {
///
/// [concurrency] controls how many suites are loaded and ran at once, and
/// defaults to 1.
Engine({int? concurrency, String? coverage, int? randomizeOrderingSeed})
Engine({int? concurrency, String? coverage, this.testRandomizeOrderingSeed})
: _runPool = Pool(concurrency ?? 1),
_coverage = coverage,
_testRandomizeOrderingSeed = randomizeOrderingSeed {
_coverage = coverage {
_group.future.then((_) {
_onTestStartedGroup.close();
_onSuiteStartedController.close();
Expand Down Expand Up @@ -308,9 +307,9 @@ class Engine {
if (!_closed && setUpAllSucceeded) {
// shuffle the group entries
var entries = group.entries.toList();
if (_testRandomizeOrderingSeed != null &&
_testRandomizeOrderingSeed! > 0) {
entries.shuffle(Random(_testRandomizeOrderingSeed));
if (testRandomizeOrderingSeed != null &&
testRandomizeOrderingSeed! > 0) {
entries.shuffle(Random(testRandomizeOrderingSeed));
}

for (var entry in entries) {
Expand Down