Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345812 - Unstable UI tests
Summary: Unstable UI tests
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-14 11:32 EDT by Robin Stocker CLA
Modified: 2013-11-21 12:24 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Stocker CLA 2011-05-14 11:32:35 EDT
testFetchFromOrigin sporadically fails on Hudson. We should try to fix it so that Hudson's feedback in Gerrit is actually useful.

Here's the relevant part of the stacktrace:

org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: Could not find widget.
	at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetAppears(SWTBotFactory.java:348)
	at org.eclipse.swtbot.swt.finder.SWTBotFactory.shells(SWTBotFactory.java:112)
	at org.eclipse.swtbot.swt.finder.SWTBotFactory.shell(SWTBotFactory.java:102)
	at org.eclipse.swtbot.swt.finder.SWTBotFactory.shell(SWTBotFactory.java:93)
	at org.eclipse.egit.ui.view.repositories.GitRepositoriesViewFetchAndPushTest.testFetchFromOrigin(GitRepositoriesViewFetchAndPushTest.java:245)

and:

Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 5000 ms.: Could not find shell matching: with text 'Fetch Results: ClonedRepo - origin'
Comment 1 Robin Stocker CLA 2011-05-14 12:57:55 EDT
A not yet quite successful start: http://egit.eclipse.org/r/#change,3419
Comment 2 Dani Megert CLA 2012-09-03 06:21:10 EDT
It's a pain when getting failed tests on unrelated changes. We should either fix the test or disable it.
Comment 3 Robin Stocker CLA 2012-10-27 10:29:08 EDT
Another try:

https://git.eclipse.org/r/8384
Comment 4 Robin Stocker CLA 2012-11-07 09:20:39 EST
The latest failure was from testPushToOriginRemoteNode. My current theory why that fails:

Push itself is done, but the dialog takes its time to be displayed because RefUpdateElement does some rev walking, see getCommits called from getChildren. RefUpdateElement is used in PushResultTable in the result dialog.

I verified that this is called before the dialog is shown, so this could be the remaining problem.

Also, the machine running these seems to be extremely slow or overused :/.

Any ideas how to solve this? Increasing the timeout?
Comment 5 Dani Megert CLA 2012-11-14 04:04:21 EST
(In reply to comment #4)
> The latest failure was from testPushToOriginRemoteNode. My current theory
> why that fails:
> 
> Push itself is done, but the dialog takes its time to be displayed because
> RefUpdateElement does some rev walking, see getCommits called from
> getChildren. RefUpdateElement is used in PushResultTable in the result
> dialog.
> 
> I verified that this is called before the dialog is shown, so this could be
> the remaining problem.
> 
> Also, the machine running these seems to be extremely slow or overused :/.
> 
> Any ideas how to solve this? Increasing the timeout?

I didn't look at the code, so I don't know to which "timeout" you refer. I suggest to simply wait on a specific condition (e.g. dialog correctly displays the items) while still driving the event loop. Here's how we do this in our tests:
http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/tree/org.eclipse.jdt.ui.tests/test%20plugin/org/eclipse/jdt/testplugin/util/DisplayHelper.java
Comment 6 Robin Stocker CLA 2012-11-14 07:59:59 EST
(In reply to comment #5)
> I didn't look at the code, so I don't know to which "timeout" you refer. I
> suggest to simply wait on a specific condition (e.g. dialog correctly
> displays the items) while still driving the event loop. Here's how we do
> this in our tests:
> http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/tree/org.eclipse.jdt.ui.
> tests/test%20plugin/org/eclipse/jdt/testplugin/util/DisplayHelper.java

The SWTBot timeout, which is 10 seconds currently. SWTBot does this already, but it seems the machine is too slow to finish before the timeout.

I pushed a new change which increases the timeout to 20 seconds, maybe that helps:

https://git.eclipse.org/r/8692
Comment 7 Robin Stocker CLA 2013-10-20 20:27:52 EDT
Since the Hudson move, some UI tests have been even more unstable, which is not good. Here's a change series which should improve it (with these changes, I had the first run without failures on my machine):

https://git.eclipse.org/r/17565
https://git.eclipse.org/r/17566
https://git.eclipse.org/r/17567
https://git.eclipse.org/r/17568
https://git.eclipse.org/r/17569
https://git.eclipse.org/r/17570
https://git.eclipse.org/r/17571
https://git.eclipse.org/r/17572
https://git.eclipse.org/r/17573
https://git.eclipse.org/r/17574
Comment 8 Robin Stocker CLA 2013-11-20 17:22:40 EST
The latest initiative made this problem far less severe. There are still some failures from time to time, but they are the minority now. I think we can close this and improve individual tests when needed.
Comment 9 Matthias Sohn CLA 2013-11-21 05:15:22 EST
(In reply to Robin Stocker from comment #8)
> The latest initiative made this problem far less severe. There are still
> some failures from time to time, but they are the minority now. I think we
> can close this and improve individual tests when needed.

I agree, UI tests are pretty stable thanks to the effort you spent on improving them, thanks again for this work :-)

Should we change the configuration of the egit.gerrit build job verifying new changes to fail the build when a UI test fails ? At the moment UI tests failures are reported as UNSTABLE, we could consider to instead FAIL these builds in order to ensure that the stability of the UI tests doesn't degrade over time.
Comment 10 Robin Stocker CLA 2013-11-21 12:24:12 EST
(In reply to Matthias Sohn from comment #9)
> (In reply to Robin Stocker from comment #8)
> > The latest initiative made this problem far less severe. There are still
> > some failures from time to time, but they are the minority now. I think we
> > can close this and improve individual tests when needed.
> 
> I agree, UI tests are pretty stable thanks to the effort you spent on
> improving them, thanks again for this work :-)

No problem :). I also submitted this change right now, which seems to improve stability a bit more:

https://git.eclipse.org/r/#/c/18646/

> Should we change the configuration of the egit.gerrit build job verifying
> new changes to fail the build when a UI test fails ? At the moment UI tests
> failures are reported as UNSTABLE, we could consider to instead FAIL these
> builds in order to ensure that the stability of the UI tests doesn't degrade
> over time.

Yes, I think we can try that now.