DESCRIPTION

[tests] improve SWT bot tests

- Make the gitflow UI tests independent of the keyboard layout by using
  setText() instead of typeText(). Otherwise, these tests fail unless
  the keyboard layout happens to be en-us (or mac-en-us).

- Add a new CapturingSWTBotJunit4Runner and use it instead of
  SWTBotJunit4ClassRunner in order to capture meaningful screenshots.
  Compare bug 372209. 

Bug: 475804
Change-Id: I891dd82174f43f12a93cae03fad1a68dfc3ae0dd
Signed-off-by: Alayna Houston xxx@xxx.xxx

COMMENTS

author: Alayna Houston
date: 2016-01-24 14:10:44.000000000

Uploaded patch set 2.

-------------------------------------
author: Brenden Conley
date: 2016-01-24 14:10:50.000000000

Patch Set 2:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/8072/

-------------------------------------
author: Brenden Conley
date: 2016-01-24 14:35:17.000000000

Patch Set 2: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/8072/ : SUCCESS

-------------------------------------
author: Alayna Houston
date: 2016-01-24 14:41:09.000000000

Patch Set 2:

@Mickael: please take a look at CapturingSWTBotJUnit4Runner. Would replacing the body of SWTBotJunit4ClassRunner by this be a welcome addition to SWTBot? C.f. bug 372209. I'm aware of bug 484343 and of https://git.eclipse.org/r/#/c/62669/ .

-------------------------------------
author: Alayna Houston
date: 2016-01-24 14:54:58.000000000

Patch Set 2:

(2 comments)

@Matthias: in a follow-up change I plan to move the screenshots from their current default location at ${project.basedir}/screenshots to ${project.basedir}/target/screenshots. The current location has two problems:

1. It's is never cleared in a build, and thus we accumulate screenshots from very old builds. On Hudson, one doesn't see the last-modified date, so it's rather painful to find new screenshots.

2. Existing screenshots can get overwritten by subsequent builds.

Moving them to target/screenshots would solve (1), and then we could archive them as artifacts in the Hudson builds (so they don't get lost on the next build), which would also solve (2). If we do that, somebody would have to manually remove the old screenshots directories. (Or temporarily add a shell command to the initial build step to have them removed on the next run.)

I have added the new runner here as a test balloon -- want to see what Mickael thinks about it. If SWTBot should get updated like this, we might perhaps use a nightly build of SWTBot to have this. Or keep it here as is until there's an official SWTBot release that would include this.

Line:11, /COMMIT_MSG -> The work-around proposed in bug 475804 is no good for me. I have a mac-ch-de keyboard and would have to add such a keyboard layout to SWTBot in order to get these tests to run locally. So I prefer avoiding keyboard layout dependencies altogether.

Line:15, /COMMIT_MSG -> The point is that SWTBotJunit4ClassRunner takes screenshots xxx@xxx.xxx have run. We use those frequently to close left-over shells after tests, so we get rather meaningless screenshots such as e.g. https://hudson.eclipse.org/egit/job/egit.gerrit/ws/org.eclipse.egit.ui.test/screenshots/testAddSectionEntry%28org.eclipse.egit.ui.prefpages.configuration.GlobalConfigurationPageTest%29.jpeg .

The new runner takes screenshots xxx@xxx.xxx run, and thus (as can be seen on the failure in PS1, which I had added on purpose) we do get screenshots showing the state as closely as possible to when the exception occurred. See e.g. https://hudson.eclipse.org/egit/job/egit.gerrit/ws/org.eclipse.egit.ui.test/screenshots/testNodes%28org.eclipse.egit.ui.prefpages.configuration.GlobalConfigurationPageTest%29.jpeg , which *does* show the still open dialog.

-------------------------------------
author: Douglas Trujillo
date: 2016-01-24 20:59:35.000000000

Patch Set 2: Code-Review-1

(5 comments)

> (2 comments)
 > 
 xxx@xxx.xxx in a follow-up change I plan to move the screenshots
 > from their current default location at ${project.basedir}/screenshots
 > to ${project.basedir}/target/screenshots. The current location has
 > two problems:
 > 
 > 1. It's is never cleared in a build, and thus we accumulate
 > screenshots from very old builds. On Hudson, one doesn't see the
 > last-modified date, so it's rather painful to find new screenshots.
 > 
 > 2. Existing screenshots can get overwritten by subsequent builds.
 
+1 to move the screenshot location to target/

 > Moving them to target/screenshots would solve (1), and then we
 > could archive them as artifacts in the Hudson builds (so they don't
 > get lost on the next build), which would also solve (2). If we do
 > that, somebody would have to manually remove the old screenshots
 > directories. (Or temporarily add a shell command to the initial
 > build step to have them removed on the next run.)
 
we can get rid of the old screenshots by wiping the Hudson workspace as soon as screenshots are stored under target/

 > I have added the new runner here as a test balloon -- want to see
 > what Mickael thinks about it. If SWTBot should get updated like
 > this, we might perhaps use a nightly build of SWTBot to have this.
 > Or keep it here as is until there's an official SWTBot release that
 > would include this.

ok

Line:93, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractGitflowHandlerTest.java -> unrelated change

Line:107, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java -> unrelated change

Line:65, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/CapturingSWTBotJunit4Runner.java -> add a TODO to remind us to replace this when we can update to JUnit 4.12

Line:11, /COMMIT_MSG -> +1

Line:15, /COMMIT_MSG -> +1, makes sense, looks like upstream should also fix this

-------------------------------------
author: Douglas Trujillo
date: 2016-01-24 21:05:30.000000000

Patch Set 2:

filed CQ https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10693 for JUnit 4.12

-------------------------------------
author: Alayna Houston
date: 2016-01-24 21:17:59.000000000

Patch Set 2:

(3 comments)

Line:93, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/AbstractGitflowHandlerTest.java -> Done. (Actually undone. Will redo in a follow-up change.)

Line:107, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/InitHandlerTest.java -> Done

Line:65, org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/CapturingSWTBotJunit4Runner.java -> Done

-------------------------------------
author: Gerrit Johnathan Pham
date: 2016-01-26 19:55:28.000000000

Change has been successfully merged into the git repository by Alayna Houston

-------------------------------------
