Node.JS +茉莉花+量angular器

  1. ActionManager.js从文件夹中读取所有可能的testing函数的文件(库)

  2. WorkflowManager.js读取具有所需testing描述的文件(testing工作stream程)。 每个文件都包含动作和参数数组。

  3. TestsRunner.js需要并运行ActionManager和WorkflowManager。 之后,我想用参数运行每个testing工作stream的动作(执行Jasminetesting)。

如何使这个过程严重执行

我试图实现亚军作为:

  • 描述块之前调用require,所以Jasmine的testing在此之前运行

  • 把要求放在beforeEach之前 ,所以在执行之前每个被调用() ; 所以我知道需要和获得stream数组之后循环的stream的数量; 但是当执行时,它应该已经从已经定义的循环迭代中被调用

  • 我把它的模拟描述块()用于主要描述下的初始化,但是在这种情况下,循环为()得到stream量的量化为0,并且这之后所有描述开始执行并且量被初始化

  • 我将这两个描述都包含在其他描述之间 – > 描述描述之间的代码, 描述和循环的内部不执行。

以下是只需要WorkflowManager的代码部分,并且在每次迭代时使用控制台输出循环执行工作stream数组大小。

var firstTime = true; beforeEach(function() { if (firstTime) { var flow = protractor.promise.controlFlow(); flow.execute(function() { console.log("I'm beforeach part#1"); path = require("path"); testsPath = path.resolve("./e2e/tests/"); //requiring WorkflowManager wfMng = require('./utils/WorkflowManager.js'); }).then(function() { console.log("I'm beforeeach part#2"); var workflowPath = path.resolve("./e2e/data/workflows/"); //getting array of worklows wfs = wfMng.getAllWorkflows(workflowPath + '\\'); }).then(function() { console.log("I'm beforeeach part#3"); //console output of length of workflows array = 1 - is correct console.log("Length of array in before each after initing " + wfs.length); //LENGTH = 1 firstTime = false; }) } }); describe("Describe for initialization", function() { it("It block for initialization", function() { expect(0).toEqual(0); console.log("Length in 1st describe: " + wfs.length); //LENGTH = 1 }); }); describe("Core describe", function() { console.log("This console log doesn't executed!!!!"); //CYCLE ISN'T EXECUTED - LENGTH = 0 for (var workflowidx = 0, wlen = wfs.length; workflowidx < wlen; workflowidx += 1) { (function(widx) { console.log("Length in for cycle: " + wfs.length); describe("SBB" + widx, function() { console.log("This console log doesn't executed!!!!"); it("My test" + widx, function() { expect(2).toEqual(2); console.log("Length in it func: " + wfs.length); //LENGTH = 1 }); }); })(workflowidx); }; }); 

如何处理这两个要求,获取可能的行动和所需的工作stream程的数组,并执行循环中的每个动作之后

我应该不知何故使用茉莉花的间谍

Node.JS v0.10.30

量angular器v 1.0.0