问题描述
1 /以下是我的规格
function testRunner(count) {
it('test',async function () {
console.log(count+"FirsT")
for(var j=0;j<count.length;j++)
{
console.log(count+"SECOND")
specExecutor.execute(test)
}
});
}
count = 1
for (var i=1; i<5; i++) {
count = count+1;
testRunner(count); //run testrunner 2 times; count = 2
}
当我运行以上代码时,spec内的for循环根本不会执行,因此specExecutor.exeute
不会触发。
如何处理这种用例?
我的要求是根据计数在一个规格内执行多个测试,以使所有结果均在所需规格之内。
解决方法
它不是testRunner函数内部循环中的count.length。只是计数
for(var j=0;j<count;j++) {
console.log(count+"SECOND")
specExecutor.execute(test)
}