On Fri, Aug 5, 2011 at 11:06 PM, Jerome Velociter
<jerome(a)xwiki.com> wrote:
Hi Denis,
On Fri, Aug 5, 2011 at 10:54 PM, Denis Gervalle <dgl(a)softec.lu> wrote:
Hi Jerome,
I feel sorry that you have not ask earlier. I have been involved with
Javascript development for a while now, and since we have a large code base
in JS, I have had to find a good development workflow, and I want it to be
maven based. Hopelessly, I have not found what I really wanted and I had
finally written my own based on existing pieces I have found.
Javascript Maven Tools (
http://mojo.codehaus.org/javascript-maven-tools/)
was the best maven integration I found, but unfinished, with some issues and
limitations, and using a junit like testing that is not really smart for
javascript IMHO. So I have searched for better javascript testing frameworks
and the RSpec-style JavaScript DSL used by screw-unit have catch me, but I
have finally used its latest incarnation, which is called Jasmine (
http://pivotal.github.com/jasmine/).
In screw-unit, I really dislike the JQuery dependency (especially since I
use a prototypejs based framework), and the storage of test results in DOM
elements. This works great in a browser, but it completely disallow headless
testing and could fails simply due to DOM issue unrelated with your own
test. Jasmine was written by the same guys who have written screw-unit, with
these issues in mind. Jasmine does not have any unnecessary dependency. If
what you are testing is not DOM related, you do not need a DOM for your
test.
That sound great.
Personally I don't think we should have DOM related tests as JS tests.
Or maybe running directly in XWiki with the full DOM, but indeed
anything in-between sounds off.
It also provide the best I have found to test
asynchronous behaviors
with simplicity. And for maven integration you have the Jasmine Maven Plugin
(
http://searls.github.com/jasmine-maven-plugin/).
For a complete JS workflow, I have merged the javascript-maven-tool and the
jasmine-maven-plugin (which has evolved afterward). What my implementation
basically provide, is a really full JS dependency management using maven for
both packaging and testing. The plugins use htmlunit to provided different
kind of browser environment, allowing tests to be done in each of them.
There are still some area to improve and documentation has to be written,
but I use it already for several project that could be taken as example. You
could find tools on github:
https://github.com/softec/javascript-maven-toolsand some usages in our
other repositories.
Cool, I will look in to that.
I really do not like the idea of starting now something based on screw-unit,
since Jasmine is the evolution of screw-unit, I see no reason to continue
using screw-unit now, so I am currently -1 for it. At least, I would suggest
to use Jasmine, and its maven plugin, you have my +1 for that. If you want
more, I would be obviously pleased to help you using my own
maven-javascript-tools.
No problem moving the tests to Jasmine as a first step