Im QUnit newbie.
I created simple test but it fails with error: "ReferenceError: equals is not defined". My code is following:
simpleTests.js:
QUnit.test('isEven()', function (assert) {
equals(2, 1, 'one equals one');
})
simpleTestRun.js:
<html>
<head>
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="qunit/qunit.js"></script>
<!-- Your JS library file goes here -->
<script type="text/javascript" src="simple.js"></script>
<!-- Your tests file goes here -->
<script type="text/javascript" src="simpleTests.js"></script>
</head>
<body>
<h1 id="qunit-header">QUnit Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
</body>
</html>
What is wrong?
UPDATE1: I doing QUnit test on local disc, not through web server. How it affect testing?
equal
(not equals
) is a method of assert, so you have to use it like this:
QUnit.test('isEven()', function (assert) {
assert.equal(2, 1, 'one equals one');
})