Unable to invoke global hooks for cucumber java
I have a test project that is cucumber java based. I have 3 packages under src/test/java -> featureFiles, stepDefinitions, globalHooks. When I run my entire test suite via Gradle task or JUnit runner, it seems the hooks never gets invokes unless I move them into stepDefintions. Any advice on how this can be fixed? Hooks I'm using are "@BeforeAll,@Before,@Afterand@AfterAll"1.5KViews0likes0CommentsUnable to override cucumber tags from command line
I have this strange issue where I am unable to override the tag in the runner with the tag I supply from command line. Runner class:- @RunWith(Cucumber.class) @CucumberOptions( plugin = {"pretty", "timeline:target/cucumber-timeline/", "json:target/cucumber-report/cucumber.json", "junit:target/cucumber-report/report-xml.xml"}, dryRun = false, useFileNameCompatibleName = true, stepNotifications = true, strict = true, features = "src/test/resources/features", snippets = CucumberOptions.SnippetType.CAMELCASE, glue = {"com.Novatel"}, tags = {"@smoke"}) public class RunCucumberIT { } Sample Feature file:- @sampleTest Feature: Testing the website navigation Scenario: Navigate to the the site1 Given I click on the URL Then I navigate to the site @smoke Scenario: Navigate to bbc1 Given I navigate to the url Then I am able to view the news And I set the below sys property and run from command line:- mvn clean verify -DCucumber.filter.tags="@sampleTest" But it just ignores '@sampleTest' tag and runs the second scenario which has the@smoke tag which is in the runner,but that's not what I want as I need to run the features with its own tags from command line. I know it is possible, but I have no idea why it doesn't work.. I use Cucumber 5.0.0 and Junit 4.12.. Any help would be greatly appreciated. Thanks1.7KViews0likes0Comments