Examples of JavaScript RIAs with unit tests
Asked Answered
O

5

6

Can anyone give me examples of large-scale JS apps (including AJAX, different UI widgets, and a sophisticated architecture) with unit tests?

I'm not talking about Selenium tests here, just plain ol' stupid unit tests using mocks, decent result reporting and such.


Not sure why people voted to close, or downvoted the question. Maybe a comment would be nice. Seriously, I've been trying hard to find unit tested web apps, since I'm having a hard time building mocks and I wonder if it's even possible with reasonable effort. It made me think about the benefits of unit tests on widgets as compared to Selenium tests. People are babbling a lot about unit tests in theory but evidently nobody actually has done it in JS-RIAs. Or have they?

Oleaceous answered 25/11, 2011 at 7:50 Comment(4)
I'd also be interested in any answers to this question. We are porting our silverlight client to HTML5 technology. With javascript being loosely typed, unit testing is very important to us, because there is no compiler to detect errors as with a statically typed language (e.g. silverlight).Schilling
If you look at a number of Pivotal projects on Github, I'm sure you'll find extensive use of unit tests with Jasmine github.com/pivotalSterilant
@ChristopherTokar No. Not a single one.Oleaceous
people hear, "give us da khodez!" - I think @ChristopherTokar had it right when he pointed you to GitHub. Try again, or look on Codeplex or Google Code...Celestaceleste
I
2

Personally I like Qooxdoo, check it out for your self and see if this is what you want

http://qooxdoo.org/demo#real-life_examples

Idempotent answered 20/12, 2011 at 12:12 Comment(0)
I
1

This is one good tool: http://www.uize.com/

Impend answered 18/12, 2011 at 7:34 Comment(0)
H
1

You should look at Jasmine & Sinon.js : http://sinonjs.org/

Here is a good tutorial on testing using Backbone.js, Jasmine & Sinon.js : http://tinnedfruit.com/2011/03/03/testing-backbone-apps-with-jasmine-sinon.html

I also recommend Phantom.js for integration testing... It's a headless browser and much faster than using Selenium... http://www.phantomjs.org/

Btw here is an example of unit-tested app from Pivotal : https://github.com/pivotal/cimonitor. You can find client-side tests there -> cimonitor/public/javascripts/js-common

Herdsman answered 19/12, 2011 at 14:44 Comment(3)
CIMonitor looks promising. I might need some time to look into that. Do you have any idea how to get the tests running? Looks like the Github project does not contain the actual testrunner.Oleaceous
Seems like they are using JsUnit. Did you try to download it and launch 'suite.html' ?Herdsman
Yep, unfortunately without success :(Oleaceous
B
0

I'm not sure if this answer will qualify but I'm working on the next iteration of my pet project "Atomic OS" (an OS-metaphor for web developers) which will, eventually, meet your criteria.

I'm working on a related project (which I can't share just yet) that is built on a bare-bones Atomic OS v2 foundation and provides a rich set of UI widgets for mobile web apps.

I built & use JSDog to produce documentation from a subset of JSDoc syntax and unit test runners with QUnit.

For an example of where I'm intending to go with unit tests, please see the Atomic OS documentation. (Click "Docs" in the taskbar and select a class, such as HxJSFS)

Barnabe answered 13/12, 2011 at 19:7 Comment(0)
C
0

Just one perspective:

I work on a web application that is the front end of a video analytics system. (The back end is typically an IP camera, DVR or video router running a very, very lean, embedded web server.) It uses a number of jQueryUI widgets, allows user to configure the device, create video analysis rules, and draw markup over video frames using canvas elements. I think of it as fairly sophisticated.

We use unit tests (originally written for JSUnit, but now using qunit) for a very limited subset of the code. We have unit tests to verify the behavior of business objects, including the ability to serialize/deserialize to/from XML. And we have unit tests to test the basic geometry classes we've written for the canvas markup.

However, we have no unit tests that manipulate the DOM or that verify that the elements on a page are in the correct state. Doing that correctly struck us as too difficult a problem to solve, so we rely on Selinium tests to verify that a given set of inputs will put the DOM into the correct state.

Chancellor answered 20/12, 2011 at 15:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.