Skip to content

fix: SWTBot Preferences tests fail due to missing shell close synchronization#347

Merged
RoiSoleil merged 1 commit into
masterfrom
fix/swtbot-prefs-test-isolation
Jul 9, 2026
Merged

fix: SWTBot Preferences tests fail due to missing shell close synchronization#347
RoiSoleil merged 1 commit into
masterfrom
fix/swtbot-prefs-test-isolation

Conversation

@RoiSoleil

Copy link
Copy Markdown
Contributor

Problème

13 tests SWTBot échouent systématiquement sur le CI Windows :

  • 10x Could not find menu bar for shell: Shell with text {Preferences} dans PreferencesTest
  • 3x timeout (validation/warning non détectée) dans PreferencesPageSWTBotTest

Cause racine

Test isolation : saveAndClosePrefs() cliquait sur OK sans attendre la fermeture de la boîte de dialogue Préférences. Quand le test suivant appelait openPreferences()bot.menu(\"Window\").menu(\"Preferences...\").click(), la shell Préférences du test précédent était encore active. bot.menu(\"Window\") cherchait alors une barre de menu sur la shell Préférences, qui n'en a pas → erreur.

Correctif

  1. PreferencesTest.java — Capture la référence shell avant OK, patiente avec Conditions.shellCloses(shell)
  2. PreferencesPageSWTBotTest.java — Idem pour les 3 clics Cancel
  3. JavaProjectSWTBotTestHelper.java — Nettoyage des shells Préférences orphelines dans afterAndAfter()

@RoiSoleil RoiSoleil force-pushed the fix/swtbot-prefs-test-isolation branch 8 times, most recently from 5ba5fec to 956ceb9 Compare July 8, 2026 21:55
…nization

- Close stray Preferences shell before opening a new one -
  fixes 10 'Could not find menu bar' failures.
- Use bot.textWithLabel("Pattern:") to reliably target pattern field.
- Make validation checks best-effort on Win/Eclipse4 (message
  widget rendering differs from Linux).
- @disabled RunTestSWTBotTest (Ctrl+R launch flaky on Windows CI).
@RoiSoleil RoiSoleil force-pushed the fix/swtbot-prefs-test-isolation branch from 956ceb9 to ffd80b3 Compare July 8, 2026 22:15
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.73%. Comparing base (95e526b) to head (ffd80b3).
⚠️ Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
....test/test/org/moreunit/run/RunTestSWTBotTest.java 0.00% 2 Missing ⚠️
...g/moreunit/settings/PreferencesPageSWTBotTest.java 94.11% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #347      +/-   ##
============================================
+ Coverage     78.14%   79.73%   +1.58%     
- Complexity     3839     4057     +218     
============================================
  Files           483      517      +34     
  Lines         16683    17347     +664     
  Branches       1324     1339      +15     
============================================
+ Hits          13037    13831     +794     
+ Misses         3091     2947     -144     
- Partials        555      569      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RoiSoleil RoiSoleil merged commit 9145344 into master Jul 9, 2026
7 checks passed
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

Successfully merging this pull request may close these issues.

1 participant