JavaScript RIA Examples with Unit Tests

Can someone give me examples of large-scale JS applications (including AJAX, various user interface widgets, and complex architecture) with unit tests?

I'm not talking about Selenium tests here, just plain stupid unit tests using mocks, decent reporting of results, etc.


Not sure why people voted to close or underestimate the issue. Maybe a comment would be nice. Seriously, I tried to find web applications with proven modules, since it’s difficult for me to build layouts, and I wonder if this is possible with reasonable efforts. This made me think about the benefits of unit tests on widgets over Selenium tests. People talk a lot about unit tests, but apparently no one really did this in JS-RIA. Or are they?

+6
source share
5 answers

Personally, I like Qooxdoo, check it out for yourself and see if you want it.

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

+2
source

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

+1
source

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

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

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

Btw is an example of an application with checking units from Pivotal: https://github.com/pivotal/cimonitor . Here you can find client side tests - cimonitor/public/javascripts/js-common

+1
source

I'm not sure that this answer will be qualified, but I'm working on the next iteration of my favorite Atomic OS project (an OS metaphor for web developers) that will ultimately meet your criteria.

I am working on a related project (which I can’t share yet), which is based on the Atomic OS v2 voice framework and provides a rich set of custom widgets for mobile web applications.

I created and used JSDog to create documentation from a subset of the JSDoc syntax and unit test runners with QUnit .

For an example of where I'm going to go with unit tests, see the Atomic OS Documentation , (Click "Documents" on the taskbar and select a class, for example HxJSFS )

0
source

Only one perspective:

I am working on a web application that is the interface of a video analytics system. (The back panel is usually an IP camera, DVR or video router with a very poor built-in web server.) It uses several jQueryUI widgets, allows the user to configure the device, create video analysis rules and draw markup on top of the video using elements canvas. I find it pretty complicated.

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

However, we do not have unit tests that manipulate the DOM or verify that the elements on the page are in the correct state. Doing this correctly showed us an overly complex problem to solve, so we rely on Selinium tests to verify that this set of inputs will put the DOM in the correct state.

0
source

Source: https://habr.com/ru/post/902366/


All Articles