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

相关推荐
newxtc19 小时前
【湖北政务服务网-注册_登录安全分析报告】
人工智能·selenium·测试工具·安全·政务
软件测试小仙女20 小时前
简单但好用:4种Selenium截图方法
自动化测试·软件测试·selenium·测试工具·测试用例·接口测试·selenium截图
程序员杰哥1 天前
软件测试之压力测试详解
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·压力测试
newxtc1 天前
【锦州通APP注册_登录安全-无验证方式导致安全隐患】
人工智能·selenium·测试工具·安全·政务
测试老哥1 天前
Jmeter+Maven+jenkins+eclipse 搭建自动化测试平台
自动化测试·软件测试·测试工具·jmeter·jenkins·maven·性能测试
卖个几把萌1 天前
【16】Selenium+Python 接管已打开谷歌浏览器
python·selenium·测试工具
测试-鹏哥2 天前
要将ITP集成到Jenkins Pipeline中,实现开发发版时自动触发自动化测试
运维·python·测试工具·ci/cd·jenkins
程序员三藏2 天前
Postman接口测试详解
自动化测试·软件测试·python·测试工具·职场和发展·接口测试·postman
安冬的码畜日常2 天前
【JUnit实战3_25】第十五章:表现层测试(上)—— HtmlUnit 在网页测试中的用法
测试工具·junit·gui测试·htmlunit·junit5