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介绍 - 你听海是不是在笑 - 博客园

相关推荐
汽车仪器仪表相关领域14 小时前
GZCVL T-II 安全防坠器测试系统
功能测试·测试工具·安全·单元测试·压力测试·可用性测试
可可南木17 小时前
ICT测试日志 --2--解释日志记录
功能测试·测试工具·pcb工艺
软件测试小仙女1 天前
认真测试大语言模型(LLM)
软件测试·人工智能·测试工具·ai·语言模型·自然语言处理·llm
oh-pinpin1 天前
【jmeter】-脚本-遇自动转义要使用CSV文件
测试工具·jmeter
可可南木1 天前
ICT测试日志 --1--数据结构
功能测试·测试工具·pcb工艺
Parasoft中国2 天前
聚焦汽车网安落地!2026汽车网络安全标准及应用研讨会
人工智能·测试工具·安全·web安全·汽车
少云清2 天前
【接口测试】9_iHRM项目实战 _Postman实现单接口和业务场景测试
测试工具·postman
天才测试猿2 天前
Postman常见问题及解决方法
自动化测试·软件测试·python·测试工具·职场和发展·接口测试·postman