Reputation: 44673
I am currently deriving a javascript framework pattern as an architecture for the client side development for an upcoming large scale application that I will developing.
I am looking to go with a module observer pattern in which each control I develop will have its own javascript file, holding no knoweldge of the other controls.
From designing this framework for my application, I am looking to integrate in a testing mechanism for my modules - a unit testing mechanism for javascript. I am not aware of any such frameworks or how I may set up such. Any suggestions?
As part of such testing, I will also need to mock up http requests.
The library I will be using in development is jquery.
Upvotes: 7
Views: 406
Reputation: 485
BoilerplateJS is a reference architecture for large scale JavaScript product development. You can find the tests which are written using qunit, sinon and testr included under the tests folder.
Upvotes: 0
Reputation: 2596
Consider using JsTestDriver to run your JS tests. The main benefit it provides - it can run your tests on continuous integration environment, which is essential for unit testing practice.
Some additional features:
List of mocking libraries you can find in another thread.
Upvotes: 1
Reputation: 471
Jasmine may be what you are looking for. It has built-in mock up support, and does not rely on any other frameworks.
They also have a separate module for faking AJAX responses.
The setup is simple. Just download the standalone version, write some testing suites, and view the SpecRunner.html in a browser.
Upvotes: 1
Reputation: 191058
The JQuery team has QUnit.
As for abstracting out AJAX, you should wrap it appropriately or just test the data manipulation methods.
Upvotes: 7