FireUnit:JavaScript单元测试扩展
程序员文章站
2022-03-13 12:06:06
...
John Resig 和 Jan Odvarko发布了FireUnit,这是Firebug的JavaScript单元测试扩展。在Firebug中安装好扩展就能打开一个测试tab进行测试。
详情查看:http://fireunit.org/
范例代码:
详情查看:http://fireunit.org/
范例代码:
// Simple true-like/false-like testing fireunit.ok( true, "I'm going to pass!" ); fireunit.ok( false, "I'm going to fail!" ); // Compare two strings - shows a diff of the // results if they're different fireunit.compare( "The lazy fox jumped over the log.", "The lazy brown fox jumped the log.", "Are these two strings the same?" ); // Compare a string using a regular expression fireunit.reCompare( /The .* fox jumped the log./, "The lazy brown fox jumped the log.", "Compare a string using a RegExp." ); // Display the total results fireunit.testDone(); // -- browser events // You can also simulate browser events var input = document.getElementsByTagName("input")[0]; fireunit.mouseDown( input ); fireunit.click( input ); fireunit.focus( input ); fireunit.key( input, "a" ); // -- Run batches // Or run multiple pages of tests: fireunit.runTests("test2.html", "test3.html"); // Place at the end of every test file in order to continue fireunit.testDone();
上一篇: LeetCode-Python-204. 计数质数
下一篇: 打印100以内所有质数
推荐阅读
-
js下通过prototype扩展实现indexOf的代码_javascript技巧
-
Javascript功能扩展
-
突袭HTML5之Javascript API扩展5—其他扩展(应用缓存/服务端消息/桌面通知)
-
突袭HTML5之Javascript API扩展1—Web Worker异步执行及相关概述
-
突袭HTML5之Javascript API扩展2—地理信息服务及地理位置API学习
-
突袭HTML5之Javascript API扩展3—本地存储全新体验
-
突袭HTML5之Javascript API扩展4—拖拽(Drag/Drop)概述
-
JavaScript 扩展运算符用法实例小结【基于ES6】
-
突袭HTML5之Javascript API扩展1—Web Worker异步执行及相关概述
-
突袭HTML5之Javascript API扩展4—拖拽(Drag/Drop)概述