Qunit学习总结2

复制代码
<!DOCTYPE HTML>
 <html>
  <head>
       <!-- 这里引用的是jQuery官网上的Qunit,项目中为了加快下载可以放到本地 -->
             <link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.17.1.css" type="text/css"/>
            <script type="text/javascript" src="http://code.jquery.com/qunit/qunit-1.17.1.js"></script>
         </head>
     <body>
         <h1 id="qunit-header">QUnit example</h1>

         <h2 id="qunit-banner"></h2>

         <div id="qunit-testrunner-toolbar"></div>
         <h2 id="qunit-userAgent"></h2>
         <ol id="qunit-tests"></ol>
         <div id="qunit-fixture">test markup, will be hidden</div>
         <script>
                 test("a basic test example", function () {
                     ok(true, "this test is fine");
                     var value = "hello";
                     equal(value, "hello", "We expect value to be hello");
                 });

                 module("Module A");

                 test("first test within module", function () {
                     ok(true, "all pass");
                 });

                 test("second test within module", function () {
                     ok(true, "all pass");
                 });

                 module("Module B");

                 test("some other test", function () {
                     expect(2);
                     equal(true, false, "failing test");
                     equal(true, true, "passing test");
                 });
             </script>
     </body>
 </html>

这里把test方法写在html文件中

参考:

JS单元测试工具Qunit - 前端组www.qianduanzu.com - 博客园

QUnit系列 -- 5.QUnit源码分析之<大致结构> - 下一站永远 - 博客园

JQuery团队打造的javascript单元测试工具QUnit介绍 - 你听海是不是在笑 - 博客园

相关推荐
ZLG_zhiyuan7 小时前
竞逐“芯”赛道:CAN分析仪如何成为芯片行业高效测试工具?
测试工具
Lugas Luo8 小时前
DVR 存储工具深度分析报告 (测试与产品视角)
linux·嵌入式硬件·测试工具
LT101579744412 小时前
2026年云测试平台选型指南:技术能力与场景匹配全解析
测试工具
IT19951 天前
Wireshark笔记-对AI连接标准MCP抓包分析
笔记·测试工具·wireshark
LT10157974441 天前
2026 年自动化测试工具对比:架构与场景深度评测
测试工具·架构·自动化
momo1 天前
POSTMAN
测试工具·postman
实名上网宋凯宣1 天前
postman怎么用?
测试工具·postman
Warren981 天前
Windows本地部署n8n完整教程(基于Docker,新手友好)
运维·windows·python·测试工具·docker·容器·可用性测试
Lugas Luo1 天前
车载录像存储性能模拟测试工具设计
linux·嵌入式硬件·测试工具
llilian_161 天前
国产铷原子钟 铷频标挑选指南 铷原子频标 国产铷钟
大数据·网络·功能测试·单片机·嵌入式硬件·测试工具