-
Notifications
You must be signed in to change notification settings - Fork 111
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
Performance improvement of unit tests: Remove delays and inject dependencies #14822
Open
staskus
wants to merge
24
commits into
trunk
Choose a base branch
from
fix/11228-performance-improvement-of-slow-tests-2
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+356
−216
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
staskus
added
status: do not merge
Dependent on another PR, ready for review but not ready for merge.
status: draft
This is a draft, still need more work but can be reviewed and commented if asked.
labels
Jan 8, 2025
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
|
Make viewDidAppear of HubMenuViewModel async which allows the tests to avoid timeouts and more importantly isInverted calls to assert that somehow is not called. It improves the speed of the tests dramatically.
staskus
force-pushed
the
fix/11228-performance-improvement-of-slow-tests-2
branch
from
January 9, 2025 07:39
eb19e33
to
e25dedd
Compare
…ing mocked store response Some tests are slowed down since they rely on a real store to retrieve data
Use Combine instead to remove ambiguity and only wait for validation as long as needed
staskus
changed the title
Fix/11228 performance improvement of slow tests 2
Performance improvement of unit tests: Remove delays and inject dependencies
Jan 10, 2025
staskus
force-pushed
the
fix/11228-performance-improvement-of-slow-tests-2
branch
from
January 10, 2025 10:58
e1c7e04
to
f245506
Compare
…ure all the tests complete resource loading
staskus
force-pushed
the
fix/11228-performance-improvement-of-slow-tests-2
branch
from
January 10, 2025 16:58
152c872
to
9b372f0
Compare
staskus
force-pushed
the
fix/11228-performance-improvement-of-slow-tests-2
branch
from
January 10, 2025 18:19
c1793ce
to
ba142d2
Compare
staskus
added
type: task
An internally driven task.
category: unit tests
Related to unit testing.
and removed
status: do not merge
Dependent on another PR, ready for review but not ready for merge.
status: draft
This is a draft, still need more work but can be reviewed and commented if asked.
labels
Jan 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #11228
Context: pdfdoF-64g-p2#comment-7238
Description
This is a continuation of #14802 to investigate the reasons of slow unit tests and look for solutions.
I haven't found more all-encompassing widely applied solutions. Therefore this PR has a moderate average speed execution improvement from around 50ms to 40ms..
Jetpack Setup ViewModel Enhancements:
delayBeforeRetry
to theJetpackSetupViewModel
and updated its initialization to include this property. This change allows for configurable retry delays during Jetpack setup. [1] [2] [3] [4]JetpackSetupViewModelTests
to include the newdelayBeforeRetry
parameter in the test cases. [1] [2] [3] [4] [5] [6]Push Notification Background Synchronizer Refactoring:
PushNotificationBackgroundSynchronizerProtocol
and updatedPushNotificationBackgroundSynchronizer
to conform to this protocol.PushNotificationBackgroundSynchronizerFactory
and its corresponding protocol to handle the creation of synchronizer instances.PushNotificationsManager
to use the new factory for creating background synchronizers. [1] [2]Hub Menu ViewModel Enhancements:
HubMenuViewModel
to makeviewDidAppear
,refreshGoogleAdsCampaignCheck
, andrefreshBlazeEligibilityCheck
asynchronous functions. Added a helper extension to handle these asynchronous calls. [1] [2] [3]Remote Order Synchronizer Enhancements:
debounceDuration
property toRemoteOrderSynchronizer
to allow configurable debounce intervals for sync requests. [1] [2]Steps to reproduce
Testing information
ConfigurableBundleProductViewModelTests
test_bundleItemViewModels_have_correct_quantity_when_parent_order_item_quantity_is_more_than_one
in CI runs that I cannot quite figure out. It runs super-fast locally but slows down significantly on the CI. I will make sure this branch is stable and has a few consecutive successful runs on CI before merging.Screenshots
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: