I can't get QUnit to run any test after the first. To be sure I wasn't doing something weird, I pared down the code to be as basic as possible.
test("A", function () {
ok(true, "Test A");
});
test("B", function () {
ok(true, "Test B");
});
Test A is the only one that runs. No errors thrown or anything else.
My HTML file looks like this.
<!DOCTYPE html>
<html>
<head>
<title>Test title</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.10.0.css">
</head>
<body>
<div id="qunit"></div>
<script src="http://code.jquery.com/qunit/qunit-1.10.0.js"></script>
<script src="tests.js" type="text/javascript"></script>
</body>
</html>
QUnit is a perfect unit test framework for JavaScript programming language. A formal written unit test case is characterized by a known input and by an expected output, which is worked out before the test is executed. The known input should test a precondition and the expected output should test a post-condition.
Create a Test Case Make a call to the QUnit. test function, with two arguments. Name − The name of the test to display the test results. Function − Function testing code, having one or more assertions.
Local Installation Go to the https://code.jquery.com/qunit/ to download the latest version available. Place the downloaded qunit-git. js and qunit-git. css file in a directory of your website, e.g. /jquery.
Found the problem. It was this!
qunit.html?testNumber=1
I guess at some point I hit rerun
and it ignored the other tests!
This other question deserves credit for pointing me in the right direction. QUnit Won't Run Tests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With