如何 运行 for loop inside an it spec of jasmine?
how to run for loop inside an it spec of jasmine?
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
}
当我 运行 以上代码时,规范内的 for 循环根本不执行,因此 specExecutor.exeute
不触发。
如何处理这种用例?
我的要求是根据计数在一个规范内执行多个测试,以便所有结果都在要求的规范下。
它不在 testRunner 函数内的循环中 count.length。就是数
for(var j=0;j<count;j++) {
console.log(count+"SECOND")
specExecutor.execute(test)
}
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
}
当我 运行 以上代码时,规范内的 for 循环根本不执行,因此 specExecutor.exeute
不触发。
如何处理这种用例?
我的要求是根据计数在一个规范内执行多个测试,以便所有结果都在要求的规范下。
它不在 testRunner 函数内的循环中 count.length。就是数
for(var j=0;j<count;j++) {
console.log(count+"SECOND")
specExecutor.execute(test)
}