javascript - How to run the same specs several times for each startup config -


jasmine favorite testing javascript framework. far i've wrote specs without problems.

but 1 day i've decided extend application (it's simple mind-map tool) several graph types instead of single one. it's supporting "wbs" , "orgchart" data models. don't want duplicate current specs previous data model newly created one.

may in case enough fix 1 global beforeeach function? looks like

var graph; beforeeach(function () {   graph = new graph({     template: templates.orgchart   }); }); 

so question how make same spec run each type of data models. or if there way pass arguments jasmine.getenv().execute()? appreciated, thanks.

you run tests in loop:

['wbs', 'orgchart'].foreach(function(datamodel){    var graph;   beforeeach(function () {     graph = new graph({       template: templates[datamodel]     });   });    describe('with ' + datamodel, function(){ //your tests   })   }) 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -