Unit testing server side javascript

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 12:39 AM
I'm currently looking at unit testing javascript. On client side, I've found Jasmine running PhantomJS to be good. However, I'm struggling to find and setup javascript unit testing for server side. At the moment it looks like doing a more of an end-to-end integration tests is the only feasible solution.
How has Alfresco Share done this kind of unit testing? What would you suggest a developer of new features, like me, does?
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 12:08 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 04:12 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 05:12 PM
So your testController.js file looks like this (and you call it via that command servlet, not as a web script).
<javascript><import resource="classpath:ctrl.lib.js">
var companyhome = "fakecompanyhomeobject"
var document = fakedocument;
var args = { site: "fakeSite", nodeRef: "fakeNodeRef"};
main();
</javascript>
And your regular controller just holds the import statement and main().
Now that I've written it, it sounds kind of clumsy, but at least it's a start, right?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2013 07:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2013 01:09 PM


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2013 01:12 PM
http://www.springsurf.org/sites/1.0.0.CI-SNAPSHOT/testapidocs/org/springframework/extensions/webscri...
Alfresco webscripts are done on springframework webscripts package.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2013 04:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2013 03:26 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2013 03:39 PM
