Created
February 19, 2017 15:53
-
-
Save upgundecha/03fec4595731c0933578beace7cd1c30 to your computer and use it in GitHub Desktop.
cucumber-js hooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var startTime; | |
module.exports = function() { | |
this.After(function (scenario, callback) { | |
console.log("Name >> " + scenario.getName()); | |
console.log("Start Time >> " + startTime) | |
console.log("End Time >> " + new Date().getTime()) | |
if(scenario.isSuccessful()) { | |
console.log("PASS"); | |
} else if (scenario.isFailed()) { | |
console.log("FAIL"); | |
} else if (scenario.isSkipped()) { | |
console.log("SKIPPED"); | |
} else { | |
console.log("UNDEFINED"); | |
} | |
callback(); | |
}); | |
this.Before(function (scenario, callback) { | |
startTime = new Date().getTime(); | |
console.log("Keyword: " + scenario.getKeyword()); | |
//console.log("Keyword: " + scenario.getUri()); | |
var parts = scenario.getUri().split('/'); | |
var item = parts.length - 1; | |
console.log('Feature >> ' + parts[item].replace('.feature', '')); | |
callback(); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment