[英]How do I build a suite of Qunit tests that all have their own qunit fixtures?
我有兩個XXXTest.html文件,每個都與此類似:
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.11.0.css" />
<script src="../../../public/scripts/common/SomeUtils.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">
<div id="findme">Something specific for the code under test</div>
</div>
<script src="http://code.jquery.com/qunit/qunit-1.11.0.js"></script>
<script src="SomeUtilsTest.js"></script>
</body>
</html>
每個都有自己的qunit-fixture,所以html文件相當於一個JUnit Test Class。 我意識到qunit認為模塊與測試類大致相同,但這是非常有限的。
擁有一個將在其他html文件中執行測試的主html文件的最佳方法是什么? 或者在qunit世界中分離出需要自己的燈具的測試的“正確方法”是什么?
我通常有一個master runner.html,讓我的#qunit-fixture
空,並在我的模塊的setup方法中填充燈具。
但是如果你想分享html很容易:
然后你可以根據需要填充#qunit-fixture
這個名為qunit-composite的插件很好。
“Composite是一個QUnit插件,當傳遞一個文件數組時,將打開iframe中的每個文件,運行測試,並將結果顯示為一組QUnit測試。”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.