Monday, 22 July 2013

Unit Testing JavaScript

What is QUnit?

QUnit is a powerful, easy-to-use JavaScript unit testing framework.

Getting Started

A minimal QUnit test setup:

<!DOCTYPE html>
<html:gt;
<head:gt;
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="/resources/qunit.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="/resources/qunit.js"></script>
<script src="/resources/tests.js"></script>
</body>
</html>

The contents of tests.js:

test( "hello test", function() {
  ok( 1 == "1", "Passed!" );
});
Useful links

qunitjs.com

http://qunitjs.com/intro/

No comments:

Post a Comment