question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

this in beforestep hooks is not world

See original GitHub issue

this in beforestep hooks is not world. (It is undefined)

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:22 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
charlierudolphcommented, Jan 16, 2017

@benjamine cucumber-js already keeps track of how long each step takes. That data is available in the json formatter and in the new usage formatters

1reaction
benjaminecommented, Jul 11, 2016

@jbpros BeforeStep and StepResult events are useful. In my case I’m using them to log timings for each step (only when there’s a failure or in a verbose mode), which sometimes helps sometimes debugging, or find slow steps. I can see it also being useful to run certain checks after a step that has a tag, eg:

Scenario: Log In
Given I visit homepage
When I enter my credentials
@screenshot-compare
Then I'm logged in

Then you can use that tag to take a screenshot after that step and use it for screenshot comparison checks, just an example.

ps: my bad, tags cannot be applied to a specific step, https://github.com/cucumber/cucumber/wiki/Hooks#tagged-hooks

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - @BeforeStep doesn't get called
I am trying to use the @BeforeStep /@AfterStep hooks but it seems that the tags doesn't get called. But the @After /@Before hooks...
Read more >
Cucumber Hooks
Hooks are not visible in the Gherkin code. Therefore, we should not see them as a replacement for a Cucumber Background or a...
Read more >
What are Cucumber Hooks And How to ...
Cucumber Hooks allows us to better manage the code workflow and helps us to reduce the code redundancy. We can say that it...
Read more >
How To Work With Cucumber Hooks
Hooks are blocks of code that run before or after each scenario in the Cucumber execution cycle. Here's how you can run them...
Read more >
Hooks — Aloe 0.1.12 documentation
Hooks can be installed to run before , around and after part of the test. ... Aloe does not explicitly reset world between...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found