Thursday, 30 April 2020

Tip : None of the features at [classpath:features] matched the filters: [@scenario_AddMarketingAccount, @scenario_AddMarketingUser] OR tags for command line execution of cucumber scenarios

Hi,

If we try to provide tags individually as below in main method for command line usage, we may end-up getting the error message saying .. None of the features at classpath matched the filters.

"-t","@scenario_AddMarketingAccount,
"-t","@scenario_AddMarketingUser",


None of the features at [classpath:features] matched the filters: [@scenario_AddMarketingAccount, @scenario_AddMarketingUser]

0 Scenarios

0 Steps
0m0.000s


Provide a single tag with comma separated literals/scenario tags. 
i.e., 
"-t","@scenario_AddMarketingAccount,@scenario_AddMarketingUser"

Below is how the tags should be written for CLI (command line interface)

package com.sadakar.selenium.common;
import org.openqa.selenium.WebDriver;

public class BasePage {
 
 public  static WebDriver driver; 
 
 public static void main(String args[]) throws Throwable{
  try {
   cucumber.api.cli.Main.main(
     new String[]{
     "classpath:features",
     "-g", "com.sadakar.cucumber.stepdefinitions/", 
     "-g","com.sadakar.cucumber.common",
     "-t","@scenario_AddMarketingAccount,@scenario_AddMarketingUser",
     "-p","pretty", 
     "-p","json:target/cucumber-reports/Cucumber.json",
     "-p", "html:target/cucumber-reports",
     "-m"
     }
   ); 
  }
  catch(Throwable e) {
    e.printStackTrace();
    System.out.println("Main method exception");
  }
 }
}


NOTE : 
When you run executable jar file, it executes ALL the scenarios given with "-t" tag.

1) Build the jar file 
clean compile assembly:single install

2) Run the jar file
java -DtestEnv=local -jar SADAKAR_POC-0.0.1-SNAPSHOT-jar-with-dependencies.jar

No comments:

Post a Comment