QUnit 介绍
QUnit 是一个功能强大、易于使用的 JavaScript 单元测试框架。它被 jQuery 项目用于测试代码和插件,它能够测试任何通用的
JavaScript 代码(甚至能够在服务器端测试 JavaScript 代码)。
示例代码:
test("a basic test example", function() { ok( true, "this test is fine" ); var value = "hello"; equals( "hello", value, "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); equals( true, false, "failing test" ); equals( true, true, "passing test" ); });
测试结果页面:
QUnit 官网
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。