javascript - How show time for each test with casperjs -


i have "launcher" script 1 array, names , routes of many tests. when run tests, casper shows total time of run tests. need show how time needs each test script, casperjs have method this?

when param 'all' used, run tests.

var testspaneles = [     ["panel1", "./paneles/testpanel1.js"],     ["panel2", "./paneles/testpanel2.js"] ]  if (casper.cli.get('arg') == 'all') {     casper.start()         .then(function() {         casper.test.begin('bateria de pruebas ', function suite(test) {             (i = 0; < testspaneles.length; i++) {                 var prueba = require(testspaneles[i][1]);                 prueba();             }         });     }).run(function() {         this.test.done();     }); } 

result:

# bateria de pruebas panel operador # test panel oper - clientes pass input usuario pass input password # test panel-oper - portfolio pass input nombre usuario pass input pass usuario pass 4 tests executed in 4.23s, 4 passed, 0 failed, 0 dubious, 0 skipped. 

and want, this:

# bateria de pruebas panel operador # test panel oper - clientes pass input usuario pass input password **time: 1.59s** # test panel-oper - portfolio pass input nombre usuario pass input pass usuario **time: 2.24s** pass 4 tests executed in 4.23s, 4 passed, 0 failed, 0 dubious, 0 skipped. 

finally solved using function in launcher.js

var start = date.now(); casper.test.on('success', function tiempo() {     casper.echo(date.now()-start + "ms");     start = date.now(); }); 

this function started when each test run event "success".


Comments