Home > Blockchain >  How to execute test runner with multiple tags in Cucumber
How to execute test runner with multiple tags in Cucumber

Time:01-14

I want to execute two specified test cases one by one I have test runner configured like below

@CucumberOptions(
    features = {"src/test/resources/features"},
    glue = "classpath:",
    plugin = { "html:src/test/resources/execution/report/cucumber-reports.html" },
    tags = "@Test213 and @Test214"
)
public class TestRunner extends AbstractTestRunner {
}

but when I run it none scenarios is executed - only @Before from testNG.

Console output:

14:32:09.036 [main] INFO  integration.RestFXTestBaseClass - New browser instance opened
14:32:09.039 [main] INFO  cleaner.RestFXCleaner - Cleaning execution directory...
14:32:09.044 [main] INFO  cleaner.RestFXCleaner - Items deleted

===============================================
Default Suite
Total tests run: 0, Passes: 0, Failures: 0, Skips: 0
===============================================

CodePudding user response:

The problem most likely is caused by glue = "classpath:"

In Cucumber, the "glue" is the location (folder) for your step definitions. I am sure your step definitions folder is not named classpath:. If the folder where your step definitions reside is called tests and it is inside your project, you could use a relative path such as glue = "tests". Most people choose to name their step definitions folder as stepDefinitions.

Also, make sure your tags are correct or you may see a similar problem.

CodePudding user response:

It was due to my wrong understanding of this tags handling. I thought that I need to join scenarios for execution by and but it's logical and so this tags = "@Test213 and @Test214"executes only scenarios which are annotated by both these tags and there are not any in my suite. If I want to run scenarios one by one I need to configure it like this tags = "@Test213 or @Test214"

  •  Tags:  
  • Related