Search code examples
cucumbercucumber-jvm

Cucumber-jvm runner with many features, just run one


I have this project structure:

/src
   /it
      /java
         /com/xxx/test/it
            ContextSteps
            /inventory
               InventoryIT
               InventorySteps                                          
      /resources
         /com/xxx/test/it/inventory  
            1.feature
            2.feature

Runner InventoryIT (both features are annotated with @inventory)

@RunWith(Cucumber.class)
@CucumberOptions(tags = "@inventory")
public class InventoryIT {
}

Note that ContextSteps in injected in InventorySteps through cucumber-picocontainer.

When I execute project tests through this runner (with maven or from the IDE as well), I expect both 1.feature and 2.feature run (because both are placed in the same resources package), but just runs the first one: 1.feature.

Am I missing something? Thanks for the help.


Solution

  • Still wondering why is just running one of the two features... can be fixed setting manually the features resources path:

    features = "src/it/resources/com/xxx/test/it/inventory")

    through @CucumberOptions annotation in the InventoryIT runner.

    @RunWith(Cucumber.class)
    @CucumberOptions(tags = "@inventory", features = "src/it/resources/com/xxx/test/it/inventory")
    public class InventoryIT {
    }
    

    Making this change, both feature run.