vendredi 8 mai 2015

How show time for each test with casperjs

i have a "launcher" script with one array with all names and routes of many test. When i run all test, casper only show the total time of run all test. I need show how many time needs each test script, have casperjs any method for do this? Thanks

When param 'all' is used, i run all test

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) {
                for (i=0; i<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 i want, something like 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.

Aucun commentaire:

Enregistrer un commentaire