Created
February 19, 2017 15:53
-
-
Save upgundecha/dcbe8232a92c1aa3b76b477cb6f94b96 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 env = require('./environment.js'); | |
// A small suite to make sure the cucumber framework works. | |
exports.config = { | |
seleniumAddress: env.seleniumAddress, | |
framework: 'custom', | |
frameworkPath: '../index.js', | |
// Spec patterns are relative to this directory. | |
specs: [ | |
'cucumber/*.feature' | |
], | |
capabilities: env.capabilities, | |
baseUrl: env.baseUrl, | |
cucumberOpts: { | |
require: ['cucumber/**/stepDefinitions.js', | |
'cucumber/**/hooks.js'], | |
tags: '@dev', | |
format: undefined, | |
profile: false, | |
'no-source': true | |
} | |
}; |
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