title: How to skip a specific scenario having unique tag from TestNG runner
body: <p>I have feature file with lots of scenarios, which run on multiple countries. To run on different countries I have created different TestNG runner classes. 
  Here my question is how can I skip a scenario to run from a specific runner file. I am running scenario's using a feature level tag.</p>
  
  <p>For Example : 
  Feature file is having <code>@regression</code> tag and I am using this tag in 
  all runner classes to across the countries. Since data issue for some 
  countries I want skip some scenario for some countries.(I am using TestNG 
  runner). I have seen that in JUnit runner you can use not to skip but the 
  same is not working in TestNG runner.</p>
  
  <p>I tried below :</p>
  
  <pre><code>@CucumberOptions(
  plugin = "com.cucumber.listener.ExtentCucumberFormatter:", 
  monochrome = true, 
  features = "src/features/Cart", 
  tags = { "@regression and not @invalid"}
  
      @regression
      Feature: Validate login functionality for all countries
  
      @valid
        Scenario Outline: login with valid user access
          Given site launched
            And user enters "&lt;username&gt;"
            And user enters "&lt;password&gt;"
           When user clicks Sign In button
           Then display user home page
  
          Examples: 
            | username | password | 
            | xyz      | xyz123   | 
            | abc      | abc123   | 
  
        @invalid
        Scenario Outline: login with invalid user access
          Given site launched
            And user enters "&lt;username&gt;"
            And user enters "&lt;password&gt;"
           When user clicks Sign In button
           Then display user home page
  
          Examples: 
            | username | password | 
            | xyz      | xyz123   | 
            | abc      | abc123   | 
  </code></pre>
  
  <p>Below is my runner class file : </p>
  
  <pre><code>    package runner;
      import java.io.File;
      import java.util.HashMap;
      import java.util.Map;
  
      import org.junit.runner.RunWith;
      import org.testng.annotations.AfterClass;
      import org.testng.annotations.BeforeClass;
  
      import com.cucumber.listener.Reporter;
  
      import cucumber.api.CucumberOptions;
      import cucumber.api.junit.Cucumber;
      import cucumber.api.testng.AbstractTestNGCucumberTests;
      import utils.ConfigManagement;
      import utils.ExcelSheetManager;
      import utils.ExtentReportUtills;
  
      @CucumberOptions(plugin = "com.cucumber.listener.ExtentCucumberFormatter:",
      monochrome = true, features = "src/features/Cart", tags = { "@regression and not @invalid"},
  
              format = { "html:cucumber-html-reports1",
                      "json:cucumber-html-reports/cucumber.json" }, dryRun = false, glue = "steps")
      public class EU_IR_EN extends AbstractTestNGCucumberTests {
  
          public static Map&lt;String, String&gt; configDetails = new HashMap&lt;&gt;();
  
          @BeforeClass
          public static void setup() throws Exception {
  
              Map&lt;String, String&gt; SheetData = new HashMap&lt;&gt;();
              String key = "Cart";
              SheetData.put("SHEETNAME", key);
              configDetails = ConfigManagement.GetConfigDetailsForRCL(key);
              SheetData.putAll(configDetails);
              System.out.println("map at class level of runner1" + SheetData);
              ExcelSheetManager.setData(SheetData);
              System.out.println("first statement");
          }
  
          @AfterClass
          public static void prepareReport() throws Exception {
              ExtentReportUtills.UpdateExtentReport();
          }
      }
  </code></pre>
  
  <p>Below is my POM.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  </code></pre>
  
  <p>http://maven.apache.org/xsd/maven-4.0.0.xsd">
      4.0.0</p>
  
  <pre><code>&lt;groupId&gt;cucumberTest&lt;/groupId&gt;
  &lt;artifactId&gt;FSCartUIAutomation&lt;/artifactId&gt;
  &lt;version&gt;1&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  &lt;dependencies&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.aventstack&lt;/groupId&gt;
          &lt;artifactId&gt;extentreports&lt;/artifactId&gt;
          &lt;version&gt;3.0.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.vimalselvam&lt;/groupId&gt;
          &lt;artifactId&gt;cucumber-extentsreport&lt;/artifactId&gt;
          &lt;version&gt;3.0.1&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.12&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
          &lt;artifactId&gt;cucumber-java&lt;/artifactId&gt;
          &lt;version&gt;4.2.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
          &lt;artifactId&gt;cucumber-testng&lt;/artifactId&gt;
          &lt;version&gt;4.2.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;io.github.bonigarcia&lt;/groupId&gt;
          &lt;artifactId&gt;webdrivermanager&lt;/artifactId&gt;
          &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;io.github.bonigarcia&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-jupiter&lt;/artifactId&gt;
          &lt;version&gt;2.2.0&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
          &lt;artifactId&gt;poi&lt;/artifactId&gt;
          &lt;version&gt;3.14&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
          &lt;artifactId&gt;poi-ooxml&lt;/artifactId&gt;
          &lt;version&gt;3.14&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- For excel file handling --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.sourceforge.jexcelapi&lt;/groupId&gt;
          &lt;artifactId&gt;jxl&lt;/artifactId&gt;
          &lt;version&gt;2.6.12&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- https://mvnrepository.com/artifact/joda-time/joda-time --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;joda-time&lt;/groupId&gt;
          &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
          &lt;version&gt;2.3&lt;/version&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
  &lt;pluginRepositories&gt;
      &lt;pluginRepository&gt;
          &lt;snapshots&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
          &lt;/snapshots&gt;
          &lt;id&gt;hindsighttesting.release&lt;/id&gt;
          &lt;name&gt;Hindsight Software Release Repository&lt;/name&gt;
          &lt;url&gt;http://repo.hindsightsoftware.com/public-maven&lt;/url&gt;
      &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
  &lt;build&gt;
      &lt;plugins&gt;
  
  
          &lt;plugin&gt;
              &lt;groupId&gt;com.hindsighttesting.behave&lt;/groupId&gt;
              &lt;artifactId&gt;behave-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.0.4&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;install6&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;features&lt;/goal&gt;
                      &lt;/goals&gt;
  
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.12&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;integration-test&lt;/id&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;integration-test&lt;/goal&gt;
                          &lt;goal&gt;verify&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.19.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;suiteXmlFiles&gt;
                      &lt;suiteXmlFile&gt;GFSCart.xml&lt;/suiteXmlFile&gt;
                  &lt;/suiteXmlFiles&gt;
                  &lt;printSummary&gt;true&lt;/printSummary&gt;
                  &lt;forkCount&gt;4&lt;/forkCount&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.6.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
  
                  &lt;!-- &lt;source&gt;${jdk.level}&lt;/source&gt; &lt;target&gt;${jdk.level}&lt;/target&gt; --&gt;
  
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p><a href="https://i.stack.imgur.com/XM7Eo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XM7Eo.png" alt="enter image description here"></a>   </p>