admin管理员组文章数量:1332383
I have the most basic examples of a test runner page shown on the QUnit page inserted into an MVC project.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit basic example</title>
<link rel="stylesheet" href="../Content/qunit-1.11.0.css">
</head>
<body>
<div id="Div1"></div>
<div id="Div2"></div>
<script src="../Scripts/qunit-1.11.0.js"></script>
<script>
test("a basic test example", function () {
var value = "hello";
equal(value, "hello", "We expect value to be hello");
});
</script>
</body>
</html>
When I run this, I just see a blank page. The tests execute as they stop on a breakpoint. Links to the .css and .js are correct and working.
I have the most basic examples of a test runner page shown on the QUnit page inserted into an MVC project.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit basic example</title>
<link rel="stylesheet" href="../Content/qunit-1.11.0.css">
</head>
<body>
<div id="Div1"></div>
<div id="Div2"></div>
<script src="../Scripts/qunit-1.11.0.js"></script>
<script>
test("a basic test example", function () {
var value = "hello";
equal(value, "hello", "We expect value to be hello");
});
</script>
</body>
</html>
When I run this, I just see a blank page. The tests execute as they stop on a breakpoint. Links to the .css and .js are correct and working.
Share Improve this question asked Feb 21, 2013 at 22:59 SeeNoWeevilSeeNoWeevil 2,6195 gold badges28 silver badges40 bronze badges3 Answers
Reset to default 9I had the same problem with MVC and fixed it by getting the source files from the qunit website rather than relying on nuget. After i did this, it all worked perfectly.
The two divs must have the following ids, because QUnit is looking for these to display anything.
<div id="qunit"></div>
<div id="qunit-fixture"></div>
QUnit for ASP.Net MVC requires something a little different. Instead of the normal qunit and qunit-fixture divs, use something like this:
<div>
<h1 id="qunit-header">QUnit Test Results</h1>
<ol id="qunit-tests"></ol>
</div>
For a full example, see Unit Testing JavaScript/JQuery in ASP.Net MVC Project using QUnit Step by Step
本文标签: javascriptQUnit doesn39t print any resultsStack Overflow
版权声明:本文标题:javascript - QUnit doesn't print any results - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742303007a2449366.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论