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

相关推荐
終不似少年遊*3 天前
【软测】node.js辅助生成测试报告
软件测试·测试工具·node.js·postman·web
测试19983 天前
2025软件测试面试题汇总(接口测试篇)
自动化测试·软件测试·python·测试工具·面试·职场和发展·接口测试
互联网杂货铺3 天前
如何使用Postman做接口自动化测试
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
车载测试工程师4 天前
Wireshark 筛选功能详解:语法与示例
网络·tcp/ip·测试工具·wireshark
测试杂货铺4 天前
postman接口测试
自动化测试·软件测试·python·测试工具·测试用例·接口测试·postman
金玉满堂@bj5 天前
《Playwright:微软的自动化测试工具详解》
测试工具·microsoft·自动化
测试者家园5 天前
接口测试不再难:智能体自动生成 Postman 集合
软件测试·人工智能·测试工具·postman·agent·智能化测试·测试开发和测试
不念霉运5 天前
关键领域软件测试新范式:如何在安全合规前提下提升效率?
软件测试·测试工具·安全·开源·desecvops·ci/di
夏日玲子5 天前
Selenium工作原理
selenium·测试工具
风掣长空5 天前
[软件测试]:什么是自动化测试?selenium+webdriver-manager的安装,实现你的第一个脚本
selenium·测试工具