Nested it in Protractor/Jasmine -


can create nested in protractor/jasmine.

it("outer it", function () {     it("inner it", function () {         expect(1).tobe(1);     }); }); 

i trying execute test cases inside loop, , in every iteration want run test, example:

it("outer it", function () {     for(var i=0;i<10;i++){         it("inner it", function () {             expect(1).tobe(1);         });     } }); 

the reason want want initialize array , in dynamically way loop trough element , run number of "it", example:

describe ("[components]", function() {    var grid = new grid();     it("initialize grid history window", function () {        grid.init();    });     for(var i=0;i<grid.length;i++){        it("test 1", function () {            expect(1).tobe(1);        });    } 

});

the grid.length equal 0 when loop execute, want loop execute after initialize "it".

answering question, no cannot nest it's 1 inside other. though jasmine framework doesn't throw error, code inside nested it doesn't execute. also, don't see use of nesting it's specs or functions run on own complete particular test step. gives overview of function being executed currently. if trying run in loop, can create function , call inside loop, -

it("outer it", function () {     var newfunction = function(){         expect(1).tobe(1);     };     for(var i=0;i<10;i++){         newfunction();     }; }); 

hope helps. more on it's can found here - jasmine framework - it's


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -