Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QUnit is only running the first test

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>
like image 483
Mims H. Wright Avatar asked Dec 06 '12 21:12

Mims H. Wright


People also ask

How does QUnit work?

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.

How to write QUnit test cases?

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.

How do I install Qunit?

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.


1 Answers

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

like image 158
Mims H. Wright Avatar answered Oct 17 '22 22:10

Mims H. Wright