ccw-ide / ccw

Counterclockwise is an Eclipse plugin helping developers write Clojure code
https://github.com/laurentpetit/ccw/wiki/GoogleCodeHome
Eclipse Public License 1.0
220 stars 50 forks source link

Add Test Generator menu and fixtures for it #816

Closed arichiardi closed 9 years ago

arichiardi commented 9 years ago

From the first comment:

This patch enables the user to record tests using the SWTBot generator and therefore ease the pain
    of bug reporting. It is also useful for debugging purposes and/or test enhancing.
    A contributed menu entry called "Generator..." in the Test menu will open the SWTBot interface. In
    the process, the MANIFEST.MF has been updated with the new version of SWTBot and updates it with the
    dependencies taken from the SWTBot samples. Hamcrest imports were also needed. Tests were added.

    Note1: the Clojure menu is always shown now because the user might want to call Test Generator even
    when the active part is not the ClojureEditor.
    Note2: the patch also performs a little refactoring of the command contributions

Hello Laurent, the honey is in Clojure -> Test -> Generator... but also in ccw.core.test :smile:

I added a "mode" (which is enabled through -D option) where the user can record tests. Of course it would be great if we could have her project were to run the tests as well but at the beginning a sample project provided by us that can be imported in the workspace would suffice. I also added ReplTests and tests for bug #817 so we really should merge this in :wink:

Not WIP anymore :+1:

arichiardi commented 9 years ago

Laurent have you seen the error on the build? everything is fine on my machine but it looks like there is not enough space on the server...or there is some other Tycho problem...I am investigating

arichiardi commented 9 years ago
laurentpetit commented 9 years ago

Hi Andrea. Yes, I the problem is bogging me since yesterday. I have fixed locally the issue with the standalone product not working anymore (at least on OS x) since the move to Mars Stable. But indeed now it's the Jenkins server that refuses to build ...

I'll take a look at it ASAP, but alas not right now

arichiardi commented 9 years ago

Ok no problem, good that you have a solution already :+1:

laurentpetit commented 9 years ago

I will test this PR ASAP, seems really interesting ! Can you rebase it on top of the latest master?

arichiardi commented 9 years ago

done!

arichiardi commented 9 years ago

One test is failing here whereas it completes fine on my machine...is there a way by any chance to peek at ccw.core.test/target on the Travis machine?

laurentpetit commented 9 years ago

no, not on the travis machine. On the jenkins machine, yes

arichiardi commented 9 years ago

Looks all green now!

arichiardi commented 9 years ago

Changed a lot of things, but some test are failing, I will need to fix them... a bit later...

arichiardi commented 9 years ago

Please have a look at the enhance BotUtils commit first as it adds/removes the things that we discussed: removing the system property (and Test Mode), adding the menu under Clojure > Test > Generator... removing then-, explaining a bit more what the prefix are aboutin the header of BotUtils, adding the copyright, improving ClojureEditorTests...

arichiardi commented 9 years ago

All the test are green, it failed during the zip creation...I hope nothing too bad, I am going to check...

arichiardi commented 9 years ago

Apart from the small but important fixes, the build failed, again with that weird error while building the zips...

laurentpetit commented 9 years ago

It's probably because the new dependency is missing, maybe a repository or something like that. I can take care of this, I may be faster (I have done this a couple times already), and then let you review the issue (should be small) and I can explain you what I did in the comments

arichiardi commented 9 years ago

Deal! Tomorrow first thing I will fix these things..thanks as usual for the suggestions ;)

laurentpetit commented 9 years ago

OK. I may not be able to work on it before monday evening, tho.

arichiardi commented 9 years ago

Laurent, when you have time, could you attach the screen for the following?

!MESSAGE Change Clojure language support : Clojure language support successfully added for project my-second-clojure-project.

26 Jul 2015 10:40:48.387 -                      main - DEBUG -                       SWTUtils - (SWTUtils.java:405) - Capturing screenshot '/home/travis/build/laurentpetit/ccw/ccw.core.test/target/screenshots/updatesDependenciesOnceOnProjectCreation(ccw.core.SmokeTests).jpeg'
laurentpetit commented 9 years ago

Sorry, what do you mean ?

arichiardi commented 9 years ago

I would like to have a look at /home/travis/build/laurentpetit/ccw/ccw.core.test/target/screenshots/updatesDependenciesOnceOnProjectCreation(ccw.core.SmokeTests).jpeg as this test is succussful on my machine but not on the server and I don't understand why...

laurentpetit commented 9 years ago

sorry, but I have no access to this. It remains internal to the instance which is automatically discarded as soon as the build is stopped. The only way to do this would be to force it to ftp somewhere, but it's not active anymore since jenkins is pushing. Hmm, I'll try to reactivate again with a folder named differently.

arichiardi commented 9 years ago

Ah ok, well, about that test, it is weird it is not working... and maybe not even a screenshot can solve the mystery, but I figured I might give it a try...by the way it would be good to have the screenshot folder accessible for debugging future failing tests...

laurentpetit commented 9 years ago

OK, I've tweaked the old travis shell scripts so that hopefully they will publish their own qualified update sites (same qualifier as jenkins, but prepended with "travis"). Even in case of errors, the errors are published, as well as the directory containing screenshots !

arichiardi commented 9 years ago

Wow! I am going to try immediately!

arichiardi commented 9 years ago

Ah ok I have just noticed for the first time the page https://github.com/laurentpetit/jenkins.ccw-ide.org...I am reading...

laurentpetit commented 9 years ago

Here for finding interesting stuff: http://updatesite.ccw-ide.org/branch/ Here is jenkins : https://jenkins.ccw-ide.org/

arichiardi commented 9 years ago

Lol, I don't know what you've done, but now the tests complete...all green!

arichiardi commented 9 years ago

I will start again just to be sure...

arichiardi commented 9 years ago

I removed a delay and now everything seems smooth, I think we can merge this one...if nothing else needs corrections..

arichiardi commented 9 years ago

Just rebased on master...still the zip step failing but I leave that to you :smile:

arichiardi commented 9 years ago

On Jenkins they are still failing, with screenshots in /var/lib/jenkins/jobs/ccw-master/workspace/ccw.core.test/target/screenshots Maybe it would be good to have some sort of access to it...what is the difference between Travis build and Jenkins build?

arichiardi commented 9 years ago

Here they also have another idea, to use the vnc plugin in order to access to the display from remote...nice!

laurentpetit commented 9 years ago

on jenkins the failed tests should be published where the udpatesite would have been deployed. So maybe this has been disabled and I need to check why and whether it's easy to fix or not

laurentpetit commented 9 years ago

I did an update to the script. Let's see how it goes

arichiardi commented 9 years ago

Mmm...that error is weird, basically it cannot find the File menu...weird that we cannot see the screenshot as well...

Usually when it cannot find a menu entry it means that some other window has focus (or some other software on the display)...today i am travelling and i won't be able to debug...note that all these tests are working both with mvn clean install and within Eclipse here...

laurentpetit commented 9 years ago

I tried an improvement. To be continued ...

— Envoyé avec Mailbox

On Mon, Jul 27, 2015 at 8:22 AM, Andrea Richiardi notifications@github.com wrote:

Mmm...that error is weird, basically it cannot find the File menu...weird that we cannot see the screenshot as well...

Usually when it cannot find a menu entry it means that some other window has focus (or some other software on the display)...today i am travelling and i won't be able to debug...note that all these tests are working both with mvn clean install and within Eclipse here...

Reply to this email directly or view it on GitHub: https://github.com/laurentpetit/ccw/pull/816#issuecomment-125100497

arichiardi commented 9 years ago

I think that if it fails and you have/want/think is a good idea...we can expose the display with vnc.

laurentpetit commented 9 years ago

Yeah, we'll have to try the vnc thing.

What annoys me is that with the current setup, the screenshots should be published via ftp, as they are currently (successfully) for jenkins builds.

2015-07-27 8:55 GMT+02:00 Andrea Richiardi notifications@github.com:

I think that if it fails and you have/want/think is a good idea...we can expose the display with vnc.

— Reply to this email directly or view it on GitHub https://github.com/laurentpetit/ccw/pull/816#issuecomment-125106457.

Laurent Petit

laurentpetit commented 9 years ago

I will only be able to work on it this evening.

2015-07-27 9:02 GMT+02:00 Laurent PETIT laurent.petit@gmail.com:

Yeah, we'll have to try the vnc thing.

What annoys me is that with the current setup, the screenshots should be published via ftp, as they are currently (successfully) for jenkins builds.

2015-07-27 8:55 GMT+02:00 Andrea Richiardi notifications@github.com:

I think that if it fails and you have/want/think is a good idea...we can expose the display with vnc.

— Reply to this email directly or view it on GitHub https://github.com/laurentpetit/ccw/pull/816#issuecomment-125106457.

Laurent Petit

Laurent Petit

laurentpetit commented 9 years ago

I don't understand. By reading the build logs on the travis console, it seems like there's no screenshots directory at all. I fixed a problem with the embedded ansi-repl plugin anyway, and I also simplified the travis script. Somehow, those tests seem to be fragile, sometimes working, sometimes not, depending on some race conditions ...

laurentpetit commented 9 years ago

Look here, this is kinda proof that the build was unable to create any screenshot: https://travis-ci.org/laurentpetit/ccw/builds/72915194#L6685

laurentpetit commented 9 years ago

the tests don't pass on my machine. Somehow it seems like one of the tests is created twice, when the first instance has not been deleted. Weird.

laurentpetit commented 9 years ago

but the zips were created successfully. Trying the OS X version and reporting back in a while.

laurentpetit commented 9 years ago

The OS X version is working. But since the tests fail, I cannot (yet) incorporate it. BTW, I did some tests, and it seems that SWTBot fails to record a lot of things, e.g. when the user double clicks to open a file in the editor, the cursor position, the current selection, content assist trigger. When in the REPL input area, each insert of a character creates a line in SWT which replaces the whole text, when clicking on Ctrl+Enter, nothing is generated, etc.

arichiardi commented 9 years ago

Strange, it should be fully reproducible...ok I will try again tomorrow when I will come back from my trip ok? I saw them all green a couple of times, but it is true, it looks like they are architecture/Eclipse version/moon dependent...

laurentpetit commented 9 years ago

ahah :-)

arichiardi commented 9 years ago

:smile: Well I'll say planet dependent and I am including Eclipses and real ones :smile_cat: :smiley:

arichiardi commented 9 years ago

Just rebased on master...

arichiardi commented 9 years ago

Incredible, I don't know what goes wrong...but look...almost at the same time as the Travis built...

selection_027

arichiardi commented 9 years ago

If you check the last build the failure is:

[INFO] --- mojo-executor-maven-plugin:2.2.0:execute-mojo (archive) @ ccw.product ---

[INFO] Building zip: /home/travis/build/laurentpetit/ccw/ccw.product/target/products/ccw-linux.gtk.x86_64.zip

/home/travis/build.sh: line 41: 16425 Killed                  mvn clean verify --batch-mode -e -DforceContextQualifier=${QUALIFIER}

The command "mvn clean verify --batch-mode -e -DforceContextQualifier=${QUALIFIER}" exited with 137.