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.

Is there a way to get the scenario name in my step definitions

See original GitHub issue

Hi,

I am happily using your framework but was wondering if I can get the scenario name in a step definition. I’ve used cucumberjs in the past and there I could do: Before((scenario) => { console.log('\nscenario: ', scenario.pickle.name); });

Does the preprocessor expose the scenario name in any way to the step definitions?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
adadachecommented, Jan 9, 2021

Of course:

window.testState.currentScenario

This is where all your data relies.

1reaction
hardikrana437commented, Feb 27, 2020

If the scenario doesn’t have any examples, you can get the scenario name from cy.state('ctx').test.title. Otherwise the name will look like ${scenarioName} (example #${index + 1}).

cy.state doesn’t exist on typescript definitions. Is there any way to get the scenario name in my step definitions in ts.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to get the scenario name in my step definitions
If the scenario doesn't have any examples, you can get the scenario name from cy.state('ctx').test.title . Otherwise the name will look like ${ ......
Read more >
How to Get Step Name and Scenario Names through java ...
Hi John,. Just want to retrieve the names from feature file and log those names in my project. Could not able to register...
Read more >
Step Definitions - Cucumber Documentation
Step definitions aren't linked to a particular feature file or scenario. The file, class or package name of a step definition does not...
Read more >
How to Share data between steps in Cucumber using ...
To retrieve the value of the Product Name, just need to pass the Key to the getContext() method which can be accessed like...
Read more >
Is it possible to get scenario inside the step in Cucumber?
I need to make screenshot inside the step on specific place. It means not on @BeforeStep nor on @AfterStep. I need to call...
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