后,我們只需要寫一個簡單的網(wǎng)頁來運行測試:
<!DOCTYPE html>
<html>
<head>
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="lib/qunit.css" type="text/css" media="screen">
<script type="text/javascript" src="lib/qunit.js"></script>
<!-- Your project file goes here -->
<script type="text/javascript" src='jquery.min.js'></script>
<script type="text/javascript" src='underscore.js'></script>
<script type="text/javascript" src="quintus.js"></script>
<script type="text/javascript" src="card.js"></script>
<!-- Your tests file goes here -->
<script type="text/javascript" src="card_test.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>
運行上面的網(wǎng)頁, 我們可以看到測試結(jié)果了. 上面的代碼可以在https://github.com/mcai4gl2/card上下載, 上面的代碼對應card.js, card_test.js和cardTest.html這三個文件. 運行cardTest.html并不需要一個Web Server, 只需要在瀏覽器中打開這個文件可以了. 運行效果可以在http://card1php.eu01.aws.af.cm/cardTest.html看到.