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 support for basic test lifecycle callbacks #1721

Merged
merged 25 commits into from
Oct 13, 2023
Merged

Conversation

bartekpacia
Copy link
Contributor

@bartekpacia bartekpacia commented Sep 19, 2023

This PR resolves #1503.

Possible concerns, defused

Problem: PatrolBinding.ensureInitialized() adds a setUp and a tearDown.
Answer: Yes, but PatrolBinding is a singleton (like all bindings), and its initialization happens in the generated test_bundle.dart.

Problem: Reporting results back to the native side depends on tearDown
Answer: Yes, but tearDown execute in the reverse order, so the first tearDown that PatrolBinding adds executes the last. This is what we want.

Problem: What if an exception in thrown inside setUp or tearDown?
Answer: The subsequent setUps and the test won't be executed. TearDowns will be executed. A failure will be present in the native report.

@github-actions github-actions bot added package: patrol Related to the patrol package (native automation, test bundling) package: patrol_cli Related to the patrol_cli package labels Sep 19, 2023
@bartekpacia bartekpacia changed the base branch from master to develop September 20, 2023 08:03
@github-actions github-actions bot removed the package: patrol_cli Related to the patrol_cli package label Sep 20, 2023
@bartekpacia
Copy link
Contributor Author

The playground in test/callbacks_test.dart has been moved to a gist.

@bartekpacia bartekpacia changed the title Add support for test lifecycle callbacks Add support for basic test lifecycle callbacks Sep 28, 2023
@bartekpacia bartekpacia changed the base branch from develop to master October 2, 2023 17:26
@bartekpacia bartekpacia changed the base branch from master to develop October 2, 2023 17:52
@bartekpacia bartekpacia force-pushed the develop branch 2 times, most recently from 1e08984 to 45701f6 Compare October 12, 2023 18:15
Base automatically changed from develop to master October 12, 2023 18:23
@bartekpacia bartekpacia changed the base branch from master to develop October 13, 2023 16:50
@bartekpacia bartekpacia marked this pull request as ready for review October 13, 2023 16:52
@bartekpacia bartekpacia merged commit dd2ddc0 into develop Oct 13, 2023
8 of 10 checks passed
@bartekpacia bartekpacia deleted the lifecycle_callbacks branch October 13, 2023 16:54
@bartekpacia bartekpacia mentioned this pull request Oct 25, 2023
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: patrol Related to the patrol package (native automation, test bundling)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Dart-side test lifecycle callbacks
2 participants