展示一下我的测试模块 v4用到的新技术
var Expect = function(id){ this.count = Expect[id].count++; this.id = id; console.log(this.count) } Expect.xxx = { count: 0 } var expect = function(id){ var id = arguments.callee.caller.arguments[0]; new Expect(id) } function test (){ expect(); expect(); expect(); } test("xxx");
这样测试样例与其模块就可以彻底解藕了。测试样例知道自己位于哪一个测试套装中,是其中第几个测试!
spec模块位于more目录之下,自己去看吧。