Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use EventProtocolFormatter to call the beforeStep and afterStep in Cucumber v4? #1076

Closed
vignesh-paramasivam opened this issue Apr 25, 2018 · 3 comments

Comments

@vignesh-paramasivam
Copy link

We need to log the step level info, so going through the hooks, where for the cucumber(v4.2.1) uses EventProtocolFormatter, i have tried to invoke it, but its not successful.

// support/hooks.js
const {Before, After} = require('cucumber');
const {setDefaultTimeout} = require('cucumber');

setDefaultTimeout(60000);

Before(function (scenario) {

});

// How to invoke the EventProtocolFormatter here to call the beforeStep and afterStep?
// Do we need to require and call the events in this way?
let local_event_formatter = require('../../node_modules/cucumber/lib/formatter/event_protocol_formatter.js');

After(function (scenario) {
    browser.close();
    return browser.quit();
});

Same has been asked here.. stackoverflow

@charlierudolph
Copy link
Member

Those hooks were removed and you should not use event protocol formatter directly. You can write your own formatter if you want to log something specific otherwise will need to wait for #997

@vignesh-paramasivam
Copy link
Author

Hello @charlierudolph, Yes, I have created my own formatter using the event listeners to log step level information. Thank you!

@lock
Copy link

lock bot commented Sep 7, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants