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

相关推荐
SQDN7 小时前
Chatbox 1.22.1 获取不到模型?先验 /models,再对齐精确 model ID
人工智能·测试工具·机器学习·chatgpt·json
Luminbox紫创测控10 小时前
可调UV宽光谱高功率的LED太阳能模拟器
人工智能·测试工具·汽车·安全性测试·uv·测试标准
Li Ming&11 小时前
图吧工具箱下载安装《保姆级日常使用教程》
测试工具·电脑
测试秃头怪12 小时前
postman接口测试详解
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
CYB35321 天前
KEYSIGHT是德科技 E8362C PNA系列20 GHz高性能微波矢量网络分析仪
功能测试·科技·测试工具
CYB35321 天前
KEYSIGHT N9020A是德科技 高性能MXA信号分析仪
功能测试·测试工具
祉猷并茂,雯华若锦2 天前
Selenium+Pytest自动化测试框架实战
selenium·测试工具·pytest
CYB35322 天前
KEYSIGHT是德科技 N5173B 微波模拟信号发生器
功能测试·科技·测试工具
软件资深者2 天前
QQ音乐PC版 使用教程:去广告绿色便携版音乐播放器,本地曲库管理与在线试听一键搞定,音乐播放器新手 5 分钟上手(2026)
测试工具·容器·娱乐·软件需求