QUnit: A JavaScript Unit Testing framework.
What is QUnit?
QUnit is a powerful, easy-to-use JavaScript unit testing framework. It's used by the jQuery, jQuery UI and jQuery Mobile projects and is capable of testing any generic JavaScript code, including itself!
Getting Started
A minimal QUnit test setup:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 |
<title>QUnit Example</title>
<link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.15.0.css">
<div id="qunit-fixture"></div>
<script src="//code.jquery.com/qunit/qunit-1.15.0.js"></script>
<script src="tests.js"></script>
|
The contents of tests.js:
1
2
3 |
QUnit.test( "hello test", function( assert ) {
assert.ok( 1 == "1", "Passed!" );
|
The result:
Browser Support
QUnit supports the same browsers as jQuery 1.x.
That's IE6+ and Current - 1 for Chrome, Firefox, Safari and Opera.
======================================================================
jQuery Mockjax: Ajax request mocking
http://github.com/appendto/jquery-mockjax/
jQuery Mockjax provides request/response mocking for ajax requests with jQuery and provides all standard behaviors in the request/response flow.
You may report any issues you may find in the github issue tracking.
jQuery Version Support
The current version of Mockjax has been tested with jQuery 1.3.2 through 2.0.0 with QUnit unit tests, residing in /test.
Browsers Tested
Internet Explorer 6-9, Firefox 3.6 and stable, Safari 5.x, Chrome stable, Opera 9.6-latest.