How to use the before/after hooks?
edento opened this issue · 5 comments
I have read the readme file, but I do not understand where those should be located.
lets take an example, I want to print the name of the feature before each feature.
// before-hook.js
module.exports = function () {
// add a before feature hook
this.BeforeFeature(function(feature, done) {
console.log('BeforeFeature: ' + feature.getName());
done();
});
};
- that means this code will run before each feature?
- what is done?
- where should before-hooks.js should be located? (features folder? else?
Thanks!
@john-doherty Thanks. where should i located that hook? a different file? will your package will automatically include it or it needs a specific location?
@edento I tried the hooks in the step definitions file and in a world.js file in my step_definitions folder. They both seem to work.
Hello @john-doherty! I try to use different BeforeScenario in different features with different step-definitions files, but when I started npm test I see that I used only one BeforeScenario and part of my test failed
Closing as this is super old. Please reopen if its still an issue