Skip to content
Advertisement

Is there a way to get the list of scenarios that are to be run in the @BeforeClass annotation in cucumber JVM

I have got a requirement to get the list of all the scenarios that are to be executed based on the tag I provided in cucumber Test runner. However I have to get this list before tests start execution.

I know there is a tag called “@BeforeClass” but I am not sure if I can use to get the list of all the scenarios that are going to be run. For example something like this

JavaScript

Below is the code for me test runner class

JavaScript

Advertisement

Answer

You may have to implement EventListener class to get that information and do dryRun = true in your Runner class in @CucumberOptions

Quoting from a question that can help you achieve what you need

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement