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.

No feature information in hooks

See original GitHub issue

In classic cucumber runner, I can access current Feature object via Scenario instance in a @before hook. With courgette the Scenario.reporter field is null I want to get current feature name and its lang iso code at runtime. Is it possible to implement?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
clicmancommented, Apr 9, 2018
0reactions
prashant-ramcharancommented, Apr 9, 2018

Hi @clicman

I’ve upgraded Courgette-JVM to 2.0.0.

This now uses Cucumber-JVM 2.4.0 and Gherkin 5. With this, the scenario object is updated.

So you can get the feature info using Gherkin including the language

    private Feature getFeature(Scenario scenario) throws FileNotFoundException {
        Parser<GherkinDocument> parser = new Parser<>(new AstBuilder());

        TokenMatcher matcher = new TokenMatcher();

        return parser.parse(new FileReader(scenario.getUri()), matcher).getFeature();
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Rules of Hooks - React
Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class.
Read more >
What are Cucumber Hooks And How to Use ... - Tools QA
Cucumber supports hooks, which are blocks of code that run before or after each scenario. You can define them anywhere in your project...
Read more >
Cucumber Hooks - Baeldung
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 >
Obtain Cucumber 3 scenario properties in hooks.rb ... - GitHub
Describe the bug In version 3 it is possible to obtain the name of the current feature from Before and After hooks.
Read more >
React Hooks cheat sheet: Best practices with examples
Editor's note: This React Hooks tutorial was last updated in January 2021 to include more React Hooks best practices and examples.
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