dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.42k stars 986 forks source link

Add retry mechanism for clipboard tests #12229

Closed LeafShi1 closed 1 month ago

LeafShi1 commented 1 month ago

Refer to PR #12087

In order to confirm that clipboard operation can be executing more stable, we consider add retry mechanism for clipboard tests

JeremyKuhne commented 1 month ago

The right way to handle this is to make sure they are all in the same test collection fixture. Sleeping before testing won't help. This is a place we need a retry mechanism.

JeremyKuhne commented 1 month ago

Anything using drag/drop APIs also cannot be run asynchronously and should be in the same collection.

JeremyKuhne commented 1 month ago

[UISettings(MaxAttempts = )] should let you do retries. It was added to Xunit.StaFact last year, need v1.2.46-alpha, which we're already consuming.

paul1956 commented 1 month ago

@JeremyKuhne is there a recommend value to MaxAttempts for clipboard tests. All clipboard test are in at least 4 different classes but all Sequential tests are in the one Collection(“Sequential”), this includes unrelated tests for WebBrowser.

JeremyKuhne commented 1 month ago

3 is probably reasonable to start, but we can go higher in this particular case (OLE).

Tanya-Solyanik commented 1 month ago

@LeafShi1 - could you please verify if all clipboard tests, even from other test assemblies, are using the same mechanism.