-
Notifications
You must be signed in to change notification settings - Fork 975
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
#7320 Fixing flaky ComboBox unit test #7323
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
new stable unit test ComboBox_Select_Item_By_Key without InputSimulator.SendAsync;
👍
Both ways seem to work, but the new unit test seems more convenient and efficient (there is only one test with WinFormsTheory. It doesn't require the asynchronicity and doesn't generate a form). We should leave only one.
Works for me. Happy for the UI integration tests to go if we get the same test coverage.
src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/ComboBoxTests.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBoxTests.cs
Outdated
Show resolved
Hide resolved
9a88a5e
to
59f5a5e
Compare
Removed old integration tests ComboBox_Select_Item_By_DownArrowKeyAsync and ComboBox_Select_Item_By_UpArrowKeyAsync in UIIntegrationTests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
|
||
public void AddItems(int numToAdd) | ||
{ | ||
for (int i = 0; i <= numToAdd; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it adds numToAdd + 1 items
for (int i = 0; i <= numToAdd; i++) | |
for (int i = 0; i < numToAdd; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We add 10 items. Then we select a first item with the index 0 and after that we simulate the down key pressure. The first item selected with the key will have the index 1. So we need one more item as a starting item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though comboBox.AddItems(expectedKeyPressesCount+1);
would be better. Thus we will be adding the exact number of items given in the argument.
59f5a5e
to
bbf7ead
Compare
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBoxTests.cs
Show resolved
Hide resolved
bbf7ead
to
d4b2748
Compare
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Fixes #7320
Proposed changes
Customer Impact
Regression?
Risk
Test methodology
Test environment(s)
Microsoft Reviewers: Open in CodeFlow