Skip to content

Commit 4263783

Browse files
author
John Doherty
committed
Added example of before/after hooks. Resolves #10
1 parent 4dc0f47 commit 4263783

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.MD

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,35 @@ You can register event handlers for the following events within the cucumber lif
214214
| Event | Example
215215
| -------------- | ------------------------------------------------------------
216216
| BeforeFeature | ```this.BeforeFeatures(function(feature, callback) {}) ```
217+
| AfterFeature | ```this.AfterFeature(function(feature, callback) {});```
217218
| BeforeScenario | ```this.BeforeScenario(function(scenario, callback) {});```
218219
| AfterScenario | ```this.AfterScenario(function(scenario, callback) {});```
219-
| AfterFeature | ```this.AfterFeature(function(feature, callback) {});```
220+
221+
```js
222+
// add a before feature hook
223+
this.BeforeFeature(function(feature, done) {
224+
console.log('BeforeFeature: ' + feature.getName());
225+
done();
226+
});
227+
228+
// add an after feature hook
229+
this.AfterFeature(function(feature, done) {
230+
console.log('AfterFeature: ' + feature.getName());
231+
done();
232+
});
233+
234+
// add before scenario hook
235+
this.BeforeScenario(function(scenario, done) {
236+
console.log('BeforeScenario: ' + scenario.getName());
237+
done();
238+
});
239+
240+
// add after scenario hook
241+
this.AfterScenario(function(scenario, done) {
242+
console.log('AfterScenario: ' + scenario.getName());
243+
done();
244+
});
245+
```
220246

221247
## How to debug
222248

0 commit comments

Comments
 (0)