当前位置:嗨网首页>书籍在线阅读

28-解决方案

  
选择背景色: 黄橙 洋红 淡粉 水蓝 草绿 白色 选择字体: 宋体 黑体 微软雅黑 楷体 选择字体大小: 恢复默认

18.7.2 解决方案

可以用 module() 函数对测试分组:

module("group a");
test("a basic test example", function() {
   ok( true, "this test is fine" );
});
test("a basic test example 2", function() {
   ok( true, "this test is fine" );
});
module("group b");
test("a basic test example 3", function() {
   ok( true, "this test is fine" );
});
test("a basic test example 4", function() {
   ok( true, "this test is fine" );
});

所有在调用 module() 之后发生的测试将集中到一个模块。在测试结果中的测试名称前面加上模块名称。以后,可以使用模块名称选择运行的测试(见秘诀18.8)。