Skip to content
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

Add basic reporting to the test runner #624

Merged
merged 8 commits into from
Nov 23, 2022

Conversation

bartekpacia
Copy link
Contributor

@bartekpacia bartekpacia commented Nov 18, 2022

Fixes #598

Also mostly fixes _ #561, but #561 is a bit broader, so I'm not closing #561

Screenshot 2022-11-23 at 1 46 30 PM
Screenshot 2022-11-23 at 1 58 52 PM
Screenshot 2022-11-23 at 2 17 42 PM

@github-actions github-actions bot added the package: patrol_cli Related to the patrol_cli package label Nov 18, 2022
@bartekpacia bartekpacia force-pushed the feature/add_test_reporting branch from fbc5f2b to 4cc8c64 Compare November 23, 2022 12:15
@bartekpacia bartekpacia changed the title add basic reporting to TestRunner Add basic reporting to the test runner Nov 23, 2022
@bartekpacia bartekpacia marked this pull request as ready for review November 23, 2022 13:06
@bartekpacia bartekpacia force-pushed the feature/add_test_reporting branch 2 times, most recently from 99b8868 to 4c0eccf Compare November 23, 2022 13:07
@bartekpacia bartekpacia force-pushed the feature/add_test_reporting branch from 4c0eccf to 0a8ab25 Compare November 23, 2022 13:07
@bartekpacia bartekpacia force-pushed the feature/add_test_reporting branch from 087efff to ef9bb0b Compare November 23, 2022 13:16
Comment on lines +233 to +236
late TestRunnerResult result;
unawaited(() async {
result = await testRunner.run();
}());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other tests below use regular awaits to get the results – much better since you won't run into the risk of the log output not catching up with the intermediate delays

Copy link
Contributor Author

@bartekpacia bartekpacia Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm doing it this way because of https://github.com/dart-lang/fake_async/issues/51. If you know a solution to this ("How to await function inside of fakeAsync()), then I'd be happy if you shared it.

BTW the delays are entirely controlled by the fake async, so if the log output "won't catch up", then it's a bug and it's good that tests will fail in that case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like expectLater won't work the way you want?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, it doesn't. See this commit where I tried this out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have an idea how to make this work, I'll be happy to hear it.

Comment on lines +168 to +170
targetRunResults.add(
TargetRunResult(target: target, device: device, runs: targetRuns),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's probably not that much of an issue here, but having TargetRunResult as an Equatable and then mutating its fields seems like a risky maneuver

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? I don't think it breaks Equatable's contract.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok. Besides the fact that i do not like mutability at all, but whether it is Equatable or not doesn't change anything here.

Comment on lines +168 to +170
targetRunResults.add(
TargetRunResult(target: target, device: device, runs: targetRuns),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok. Besides the fact that i do not like mutability at all, but whether it is Equatable or not doesn't change anything here.

Comment on lines +233 to +236
late TestRunnerResult result;
unawaited(() async {
result = await testRunner.run();
}());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like expectLater won't work the way you want?

@bartekpacia bartekpacia merged commit a479922 into master Nov 23, 2022
@bartekpacia bartekpacia deleted the feature/add_test_reporting branch November 23, 2022 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: patrol_cli Related to the patrol_cli package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Brief test run results summary
4 participants