It's so easy to create a basic test setup with QUnit. Let's create a HTML5 file and add several elements to it, as follows:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width" /> <title>QUnit Unit Testing Example</title> <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.4.1.css" /> </head> <body> <div id="qunit"></div> <div id="qunit-fixture"></div> <script src="https://code.jquery.com/qunit/qunit-2.4.1.js"></script> <script src="app.js"></script> <script src="test-fixture.js"></script> </body> </html>
This is our test setup; it includes a CSS file to display the test results nicer on the screen. It also includes test-fixture.js and app.js files. The app.js ...