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

Unstable unit tests that need to be disabled and fixed #11227

Open
12 of 20 tasks
LeafShi1 opened this issue Apr 17, 2024 · 6 comments
Open
12 of 20 tasks

Unstable unit tests that need to be disabled and fixed #11227

LeafShi1 opened this issue Apr 17, 2024 · 6 comments
Assignees

Comments

@LeafShi1
Copy link
Member

LeafShi1 commented Apr 17, 2024

Disable failing tests and open tracking bugs

  1. When test fails in the CI or PR build, open a bug for each test fail to investigate the test further and add a disabled-test label to the bug.
  2. Disable test by adding a [skip] attribute, If only a specific theory data causes the failure, comment that data out.
  3. Add a link to the tracking bug to the SkipAttribute of the comment line.
  4. Collect all data relevant to the failure into the bug.
  5. Try to root-cause the flakiness, and fix these tests:
    • Replacing SendInput or cursor-positioning steps with direct method invocations, or by sending WM_COMMAND
    • If UI element is easily identifiable, for example by and accessible name, or we have access to the AccessibleObject, we can use UIA
      APIs to invoke methods
    • Add logging if possible.
    • If the test must use SendInput, then make sure it is moved to the UI Integration tests assembly

The following unit tests exist flaky issues:

  • System.Windows.Forms.Tests.ImageCollectionTests.ImageCollection_Item_Get32bppColorDepth_Success(pixelFormat: Format1bppIndexed, pixel00Color: Color [Empty], givenPixel10Color: Color [Empty], expectedPixel10Color: Color [A=255, R=0, G=0, B=0])
  • System.Windows.Forms.Tests.ToolTipTests.ToolTip_SetToolTip_TabControl_DoesNotAddToolForTabControlItself
  • System.Windows.Forms.Tests.ToolTipTests.ToolTip_WmShow_Invokes_AnnounceText_WithExpectedText_ForTabControlTabs
  • System.Windows.Forms.Tests.DataGridViewTests.DataGridView_OnColumnHeadersHeightChanged_InvokeWithHandle_CallsColumnHeadersHeightChanged(columnHeadersWidthSizeMode: EnableResizing, columnHeadersVisible: True, eventArgs: null)
  • System.Windows.Forms.UITests.ButtonTests.Button_CancelButton_EscapeClicksCancelButtonAsync
  • System.Windows.Forms.UITests.ButtonTests.Button_DialogResult_SpaceToClickFocusedButtonAsync
  • System.Windows.Forms.UITests.ButtonTests.Button_Hotkey_Fires_OnClickAsync
  • System.Windows.Forms.UITests.ButtonTests.Button_Press_Enter_Fires_OnClickAsync
  • System.Windows.Forms.UITests.ListViewTests.ListView_Group_NavigateKeyboard_SucceedsAsync
  • System.Windows.Forms.UITests.NumericUpDownTests.NumericUpDownAccessibleObject_Focused_ReturnsCorrectValueAsync
  • System.Windows.Forms.Tests.CheckBoxRendererTests.CheckBoxRenderer_DrawCheckBox_OverloadWithSizeAndText
  • System.Windows.Forms.Tests.TextBoxBaseTests.TextBoxBase_ClearUndo_CanUndo_Success
  • System.Windows.Forms.Tests.ToolStripTests.ToolStrip_WndProc_InvokeMouseActivate_Success
  • System.Windows.Forms.Tests.ToolStripTests.ToolStrip_WndProc_InvokeMouseActivateWithHandle_Success
  • System.Windows.Forms.Tests.DataGridViewTests.DataGridView_ColumnHeadersHeight_SetWithHandle_GetReturnsExpected(columnHeadersWidthSizeMode: AutoSize, columnHeadersVisible: True, autoSize: True, value: 4, expectedValue: 18, expectedInvalidatedCallCount: 0)
  • System.Windows.Forms.Tests.DataGridViewTests.DataGridView_ColumnHeadersHeight_SetWithParentWithHandle_GetReturnsExpected(columnHeadersWidthSizeMode: AutoSize, columnHeadersVisible: True, autoSize: True, value: 4, expectedValue: 18, expectedInvalidatedCallC
  • System.Windows.Forms.Tests.MenuStripTests.MenuStrip_WndProc_InvokeMouseActivate_Success
  • System.Windows.Forms.Tests.MenuStripTests.MenuStrip_WndProc_InvokeMouseActivateWithHandle_Success
  • System.Windows.Forms.Tests.TextBoxBaseTests.TextBoxBase_Copy_PasteNotEmptyWithHandle_Success
  • System.Windows.Forms.Tests.TextBoxBaseTests.TextBoxBase_Paste_InvokeNotEmpty_Success
@paul1956
Copy link
Contributor

Tests involving shared resources like Clipboard are also flaky when run in parallel.

@LeafShi1
Copy link
Member Author

Tests involving shared resources like Clipboard are also flaky when run in parallel.

The current list is Flaky problems that have appeared in PR builds in the past two weeks. Regarding the Clipboard-related errors you mentioned, if we encounter them in subsequent pipelines, I will update them in the issue list.

@weltkante
Copy link
Contributor

Tests involving shared resources like Clipboard are also flaky when run in parallel.

In the past we tried to ensure those aren't run in parallel by adding annotation attributes to the test classes preventing that.

@paul1956
Copy link
Contributor

@weltkante
Do you have example of required annotations?

One issue with Clipboard is there are tests in different test classes using it is that possible or do they all need to be in same class?

@weltkante
Copy link
Contributor

@weltkante Do you have example of required annotations?

One issue with Clipboard is there are tests in different test classes using it is that possible or do they all need to be in same class?

Couldn't quickly find it regarding clipboard, but WebBrowser tests had the same issue (WebBrowser control didn't like being run from multiple UI threads and caused memory corruption) - see #3429

You basically put a [Collection("...")] attribute on the class with a string token and tests from all classes using the same collection string are run sequentially (tests within a class a run sequentially anyways).

@paul1956
Copy link
Contributor

@weltkante thanks I found this when looking at Collection and it seems to address the whole issue even with tests writing in C# AND Visual Basic

<Collection("Clipboard Tests")>
<CollectionDefinition("Clipboard Tests", DisableParallelization:=True)>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants