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

相关推荐
有趣的我9 小时前
wireshark介绍和使用
网络·测试工具·wireshark
草履虫建模11 小时前
Postman - API 调试与开发工具 - 标准使用流程
java·测试工具·spring·json·测试用例·postman·集成学习
AIZHINAN16 小时前
如何评价 selenium 自动化测试框架搭建?
selenium·测试工具
WIN赢10 天前
PostMan使用
测试工具·lua·postman
百里图书11 天前
颠覆传统接口测试!用 Streamlit + SQLite + GPT 打造可视化自动化平台
自动化测试·测试开发·接口自动化测试·测试工具·接口测试·测试平台·python编程
网络安全小吗喽11 天前
靶场(二十六)---小白心得&&靶场体会---Readys
服务器·网络·测试工具·网络安全·靶机
天才测试猿11 天前
2025最新软件测试面试题总结【附文档】
自动化测试·软件测试·python·测试工具·面试·职场和发展·测试用例
网络安全小吗喽11 天前
靶场(二十七)---小白心得&&靶场体会---Hawat
网络·测试工具·安全·网络安全·靶场
NLxxxxX12 天前
爬虫获取数据:selenium的应用
开发语言·爬虫·python·selenium·测试工具·numpy·pandas
狂师12 天前
推荐一款全栈工具导航网站!超实用~
测试工具·工具