Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359024 - Build SWTBot with Tycho
Summary: Build SWTBot with Tycho
Status: RESOLVED FIXED
Alias: None
Product: SWTBot
Classification: Technology
Component: Build (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 2.0.6   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 358496 358933 360217 362476 385380
Blocks:
  Show dependency tree
 
Reported: 2011-09-27 05:02 EDT by Mickael Istria CLA
Modified: 2012-07-20 05:13 EDT (History)
3 users (show)

See Also:


Attachments
Screenshot of the integration of SWTBot Tycho build in Jenkins (173.68 KB, image/png)
2011-11-07 09:25 EST, Mickael Istria CLA
no flags Details
Screenshot of the integration of SWTBot Tycho build in Sonar (166.78 KB, image/png)
2011-11-07 09:26 EST, Mickael Istria CLA
no flags Details
I amended Mickael's patch adding the modifications I listed in the commit message (458.28 KB, patch)
2012-07-17 16:19 EDT, Matthias Sohn CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mickael Istria CLA 2011-09-27 05:02:23 EDT
Now that SWTBot dropped support for old Eclipse release, the build is no more conditional and could be easily moved to Tycho.
That would allow easier maintainance, integration to hudson.eclipse.org and more.
Comment 1 Mickael Istria CLA 2011-09-27 06:53:30 EDT
FYI, this branch contains some refactorings that:
* Remove the JUnit issue described in bug 358496
* Builds bundles and repository. (Simply check out and "mvn clean install")

I'll work on getting the test to work. Besides of tests, what would you need to see in the Tycho build to make it the official build for SWTBot?
Comment 2 Mickael Istria CLA 2011-09-27 06:54:02 EDT
The branch: https://github.com/mickaelistria/swtbot
Comment 3 Mariot Chauvin CLA 2011-09-27 08:22:00 EDT
+1 for me for building with tycho, but I know Ketan is not a big fan of maven.
Comment 4 Mickael Istria CLA 2011-09-27 08:29:01 EDT
I know that too ;)
That's why your support is welcome.

But I have some arguments when it will be time to think about officially using Tycho. The first step is to provide a build with the same features as the current one. Then my question is:
* What feature must the build provide to be equivalent to the current one? *
Comment 5 Mickael Istria CLA 2011-09-28 09:43:36 EDT
From this commit: https://github.com/mickaelistria/swtbot/commit/59d30b2986ce84a9d92a4f578079c7a9b664e964 , I have SWTBot update site built, with test execution OK. Only a few tests are failing, probably because of Locale and keyboard stuff:

in org.eclipse.swtbot.swt.finder.test
"
Failed tests: 
  typesText(org.eclipse.swtbot.swt.finder.widgets.SWTBotTextTest)

Tests in error: 
  typesSpecialCharactersAtALocation(org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledTextTest)
shouldBeAbleToParseUserProvidedKeyboardLayout(org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayoutTest)
shouldBeAbleToParseUserProvidedKeyboardLayoutViaPreference(org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayoutTest)
createsKeyboardForAWTKeyboardStrategy(org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactoryTest)
createsKeyboardForSWTKeyboardStrategy(org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactoryTest)
createsKeyboardForMockKeyboardStrategy(org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactoryTest)
getsKeyStrokeForCapitalCharacters(org.eclipse.swtbot.swt.finder.keyboard.KeystrokesTest)
getsKeyStrokeForSmallCharacters(org.eclipse.swtbot.swt.finder.keyboard.KeystrokesTest)
getsKeyStrokeForSpecialCharacters(org.eclipse.swtbot.swt.finder.keyboard.KeystrokesTest)
compatibilityWithOtherReferences(org.eclipse.swtbot.swt.finder.ReferenceByTest)

Tests run: 373, Failures: 1, Errors: 10, Skipped: 7

"
Comment 6 Ketan Padegaonkar CLA 2011-09-28 10:40:54 EDT
(In reply to comment #5)
> From this commit:
> https://github.com/mickaelistria/swtbot/commit/59d30b2986ce84a9d92a4f578079c7a9b664e964
> , I have SWTBot update site built, with test execution OK. Only a few tests are
> failing, probably because of Locale and keyboard stuff:
> 
> in org.eclipse.swtbot.swt.finder.test
> "
> Failed tests: 
>   typesText(org.eclipse.swtbot.swt.finder.widgets.SWTBotTextTest)

Can you open another bug for this with information on your locale, keyboard settings etc ?
Comment 7 Mickael Istria CLA 2011-09-28 10:47:12 EDT
Actually, I am currently more thinking this is an issue with configuration of tests rather than issue with keyboard itself. I did not investigate yet; and I'll open a bug when I am sure there is something to change in SWTBot code.
Comment 8 Mickael Istria CLA 2011-10-07 09:00:09 EDT
Some tests are now working by fixing bug #360217.
Some other tests are failing because of incorrect visibility with OSGi (the default "package" dependency does work between classes coming from different OSGi bundles, it is necessary to use "public").
Comment 9 Mickael Istria CLA 2011-10-07 09:52:45 EDT
Encouraging current status:

Failed tests: 
  typesText(org.eclipse.swtbot.swt.finder.widgets.SWTBotTextTest)
getsKeyStrokeForSpecialCharacters(org.eclipse.swtbot.swt.finder.keyboard.KeystrokesTest)
  bringsShellToFront(org.eclipse.swtbot.swt.finder.widgets.SWTBotShellTest)

Tests in error: 
  typesSpecialCharactersAtALocation(org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledTextTest)
Comment 10 Ketan Padegaonkar CLA 2011-10-07 09:54:49 EDT
(In reply to comment #9)
> Encouraging current status:
> 
> Failed tests: 
>   typesText(org.eclipse.swtbot.swt.finder.widgets.SWTBotTextTest)
> getsKeyStrokeForSpecialCharacters(org.eclipse.swtbot.swt.finder.keyboard.KeystrokesTest)
> 
> Tests in error: 
>  
> typesSpecialCharactersAtALocation(org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledTextTest)

These are known to fail if you are on a different keyboard layout.



>   bringsShellToFront(org.eclipse.swtbot.swt.finder.widgets.SWTBotShellTest)

This might be a random failure. I'll see if I'm able to reproduce on my computer.
Comment 11 Mickael Istria CLA 2011-10-07 11:43:58 EDT
I know still have those ones failing: 

Failed tests: 
  typesText(org.eclipse.swtbot.swt.finder.widgets.SWTBotTextTest)
  getsKeyStrokeForSpecialCharacters(org.eclipse.swtbot.swt.finder.keyboard.KeystrokesTest)

Tests in error: 
  typesSpecialCharactersAtALocation(org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledTextTest)


with the following message (respectively):
* Expected: a string containing "Type This 123"  got: "Type This "
* java.lang.AssertionError: expected:<SHIFT+> but was:<!>
* java.lang.IllegalArgumentException: Could not understand keystroke ALT+CTRL+

I have tried to run tests with 2 keyboard layouts enabled on my system: us_intl and fr_FR. In vain. What is the way to have those tests working too?
Comment 12 Mariot Chauvin CLA 2011-10-07 12:09:11 EDT
(In reply to comment #11)
> I know still have those ones failing: 
> 
> Failed tests: 
>   typesText(org.eclipse.swtbot.swt.finder.widgets.SWTBotTextTest)
>  
> getsKeyStrokeForSpecialCharacters(org.eclipse.swtbot.swt.finder.keyboard.KeystrokesTest)
> 
> Tests in error: 
>  
> typesSpecialCharactersAtALocation(org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledTextTest)
> 
> 
> with the following message (respectively):
> * Expected: a string containing "Type This 123"  got: "Type This "
> * java.lang.AssertionError: expected:<SHIFT+> but was:<!>
> * java.lang.IllegalArgumentException: Could not understand keystroke ALT+CTRL+
> 
> I have tried to run tests with 2 keyboard layouts enabled on my system: us_intl
> and fr_FR. In vain. What is the way to have those tests working too?

You will not be able to have those working without changing code of the keyboard layout manager, or you may have but there are will remain problems with the current code. Let me explain.

On a french keyboard, to enter "1", you have to type "é" + SHIFT. If you enter the following mapping in the keyboard layout, you will encounter an exception with awt.Robot class, as "é" should be entered with the following code :

 robot.keyPress(KeyEvent.VK_DEAD_ACUTE);
 robot.keyPress('e');
 robot.keyRelease('e');
 robot.keyRelease(KeyEvent.VK_DEAD_ACUTE);

The current SWTBot do not do this. I started to modify the code those case but never finish.
Comment 13 Ketan Padegaonkar CLA 2011-10-07 13:37:01 EDT
(In reply to comment #12)

> On a french keyboard, to enter "1", you have to type "é" + SHIFT. If you enter
> the following mapping in the keyboard layout, you will encounter an exception
> with awt.Robot class, as "é" should be entered with the following code :
> 
>  robot.keyPress(KeyEvent.VK_DEAD_ACUTE);
>  robot.keyPress('e');
>  robot.keyRelease('e');
>  robot.keyRelease(KeyEvent.VK_DEAD_ACUTE);
> 
> The current SWTBot do not do this. I started to modify the code those case but
> never finish.

This has been on my list of things to do, unfortunately I've no way of testing these sort of things :(
Comment 14 Mickael Istria CLA 2011-10-10 04:38:00 EDT
If you have this available on a branch, please send me the link, I'll try these tests with your modifications.
Maybe this should be tracked in another bug.
Comment 15 Mickael Istria CLA 2011-11-07 09:25:55 EST
Created attachment 206521 [details]
Screenshot of the integration of SWTBot Tycho build in Jenkins
Comment 16 Mickael Istria CLA 2011-11-07 09:26:28 EST
Created attachment 206523 [details]
Screenshot of the integration of SWTBot Tycho build in Sonar
Comment 17 Mickael Istria CLA 2011-11-07 09:33:15 EST
I could go ahead and here is a current status:
* Running all the build is simply about "mvn clean install"
* Integration in Jenkins/Hudson is free
* I enabled Jacoco during the build to perform code coverage
* Thanks to mavn and Jenkins Sonar plugins, there is report for static analysis and code coverage in Sonar.

I'd like some other people to give it a try, by taking my github master branch and running "mvn clean install".

I think that's a good step ahead for SWTBot, it will allow it to join the release train with fewer efforts. Once the Tycho build gets adopted, sonarsource will be able to host reports at nemo.sonarsource.com.
Comment 18 Ketan Padegaonkar CLA 2011-11-13 12:09:49 EST
I'm not trying to ignore this bug. But, I've not had the time to look at this. I'll be looking at other bug fixes for today my only free time in a few months: ( and hopefully come back to this one, if there's still time left.
Comment 19 Mickael Istria CLA 2011-11-14 04:10:40 EST
Ketan, have you at least checked out the branch, and tried "mvn clean install" ? It won't require you lot of time (actually typing it will require you less time that writing you do not have time to do so ;).
Comment 20 Ketan Padegaonkar CLA 2011-11-14 10:24:10 EST
(In reply to comment #19)
> Ketan, have you at least checked out the branch, and tried "mvn clean install"
> ? It won't require you lot of time (actually typing it will require you less
> time that writing you do not have time to do so ;).

I've done that briefly :) I'll just need to browse through and the test output and code coverage with the existing ant build to make sure everything is good.
Comment 21 Mickael Istria CLA 2011-11-15 03:58:09 EST
Ok, that's good news to know the build is working also on your side. Please tell me when you feel ready to get it contributed, so that I'll provide a patch. I'm eager to see SWTBot using Tycho!
Comment 22 Mickael Istria CLA 2012-06-29 04:00:12 EDT
IT seems like bug 375598 will have a certain success and a lot of contributors will be involved in fixing it.
Some people are already complaining about not being able to get local or snapshot builds easily. Moving to Tycho would provide that.
Comment 23 Mickael Istria CLA 2012-06-29 11:33:12 EDT
For those interested, I updated a branch dedicated to this effort: https://github.com/mickaelistria/swtbot/tree/359024
Comment 24 Mickael Istria CLA 2012-07-11 06:34:58 EDT
Matthias,

I received your pull request here: https://github.com/mickaelistria/swtbot/pull/1

It should be fine to integrate it into SWTBot master@Eclipse. But I think the IP process requires you to attach the patches in the pull request to this bug using "git format-patch" and adding the lines saying that you are author of the parts you contributed and so on as a comment of the bug.
I'll then integrate it to a branch and set up some CI builds using it. If it happens to work well, I'll then merge that "tycho" branch to master and the CI builds based on it will become SWTBot main builds.
Also, once my committer election process gets finished, I plan to nominate you as a committer based on this contributions and other reports and efforts you made to improve SWTBot.
Comment 25 Ketan Padegaonkar CLA 2012-07-11 06:40:56 EDT
(In reply to comment #24)
> Matthias,
> 
> I received your pull request here:
> https://github.com/mickaelistria/swtbot/pull/1
> 
> Also, once my committer election process gets finished, I plan to nominate you
> as a committer based on this contributions and other reports and efforts you
> made to improve SWTBot.

If Matthias agrees, I'm happy to nominate to speed up the process.
Comment 26 Matthias Sohn CLA 2012-07-17 16:19:46 EDT
Created attachment 218836 [details]
I amended Mickael's patch adding the modifications I listed in the commit message

Here my modification of Mickael's change 359024 [1], feel free to use it as you see fit.

[1] https://github.com/mickaelistria/swtbot/tree/359024

I confirm
that I am the author 100% of the modifications I am contributing.
that I own the copyright of the contributed content
that I have the right to contribute the content to Eclipse under swtbot's license (EPL)
Comment 27 Mickael Istria CLA 2012-07-18 04:32:48 EDT
I created branch tycho-359024 to work on this issue: http://git.eclipse.org/c/swtbot/org.eclipse.swtbot.git/log/?h=tycho-359024
Comment 28 Mickael Istria CLA 2012-07-19 05:45:49 EDT
A CI job for SWTBot with Tycho: https://hudson.eclipse.org/hudson/job/swtbot-tycho/
A lot of tests are failing, I suspect it's because of bug 362476 . This is an issue I can reproduce locally.
Comment 29 Mickael Istria CLA 2012-07-19 11:57:51 EDT
CI job is blue with all tests working: https://hudson.eclipse.org/hudson/job/swtbot-tycho/
A repository for snapshot builds (from CI) has been set up: http://download.eclipse.org/technology/swtbot/snapshots

So any opposition to merging the Tycho branch into trunk and drop previous builds?
Comment 30 Mariot Chauvin CLA 2012-07-19 14:38:21 EDT
(In reply to comment #29)
> CI job is blue with all tests working:
> https://hudson.eclipse.org/hudson/job/swtbot-tycho/
> A repository for snapshot builds (from CI) has been set up:
> http://download.eclipse.org/technology/swtbot/snapshots
> 
> So any opposition to merging the Tycho branch into trunk and drop previous
> builds?

nope
Comment 31 Mickael Istria CLA 2012-07-20 05:13:15 EDT
Merged and used in order to build snapshots.