jQunitjQuery单元测试框架

联合创作 · 2023-10-01 15:55

jQunit 是一个 jQuery 的单元测试框架,兼容 jsUnit,示例测试代码:

//Using TestCase
jqUnit.TestCase.prototype.yep = function(val){ this.ok(val);};
var t = new jqUnit.TestCase('TestCase',function(){
    /*setup*/
    this.yep(1);
  },function(){
    /*teardown*/
    this.ok(1)
  });
//jqUnit is mixed into TestCase, so you can overwrite them & only need 1 with(){}
t.test('part 1',function(){ this.ok(1) });
t.test('part 2',function(){ with(this){ ok(2);yep(3) } });
t.test('part 3',function(){ with(jqUnit){ ok(4); this.yep(5) } });

浏览 1
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报