javascript - 如何在茉莉花的 IT 规格中运行 for 循环?
问题描述
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)
}
推荐阅读
- c# - SqlBulkCopy 违反具有错误值的唯一约束
- r - 通过滚动日期或连续过滤日期来过滤数据
- php - 从 php 中的 url 中删除 %20
- c++ - librsvg 和 cairo;rsvg_handle_render_cairo() 失败;我究竟做错了什么?
- c# - C#:制作类时哪些成员将被序列化为XML元素[Serializable]
- unity3d - 使用 Unity SDK 从 Vimeo 流式传输可在编辑器中工作,但不会在构建中加载视频
- javascript - 替换和正则表达式异常
- azure - Azure Pipeline:如何将项目二进制文件发布到 Azure 机器中
- laravel - 不在 Laravel 控制器上工作,在 Tinker 上工作
- angular - github页面可以向外部服务器发送http请求吗?