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

相关推荐
测试19986 小时前
软件测试 - 单元测试总结
自动化测试·软件测试·python·测试工具·职场和发展·单元测试·测试用例
影sir8 小时前
Selenium常用函数(等待)
selenium·测试工具
影sir8 小时前
Selenium常用函数(浏览器导航,文件上传,浏览器参数设置)
selenium·测试工具
德思特1 天前
通过 Wireshark 抓取串口命令
网络协议·测试工具·wireshark
影sir2 天前
Selenium常用函数(窗口与弹窗)
selenium·测试工具
Luminbox紫创测控2 天前
基于环境舱的新能源汽车三高试验方法与热响应评估
大数据·人工智能·测试工具·汽车·安全性测试·测试标准
菠萝猫yena3 天前
【读书笔记】《测试架构师修炼之道》读书笔记
功能测试·测试工具·单元测试
PhotonixBay3 天前
金属增材制造表面测量:共聚焦显微镜参数优化实践
人工智能·测试工具·制造
LT10157974443 天前
2026年 AI+RPA平台选型指南:智能自动化高效落地
测试工具