title: Null Pointer Exception in testNGCucumberRunner.provideFeatures
body: <p>I am getting a NullPointerException in <code>testNGCucumberRunner.provideFeatures();</code> </p>
  
  <p>I tried debugging, it shows  testNGCucumberRunner has null value. I am trying to use Cucumber with TestNG.
  Posting my code and exception here. I tried putting the test runner class in different packages and putting the code in other class than test runner. Tried with getScenarios as well.</p>
  
  <pre><code>[RemoteTestNG] detected TestNG version 7.0.0
  [Utils] [ERROR] [Error] java.lang.NullPointerException
      at com.qa.test.testRunner.getFeatures(testRunner.java:40)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:77)
      at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:46)
      at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:146)
      at org.testng.internal.Parameters.handleParameters(Parameters.java:820)
      at org.testng.internal.Parameters.handleParameters(Parameters.java:762)
      at org.testng.internal.ParameterHandler.handleParameters(ParameterHandler.java:60)
      at org.testng.internal.ParameterHandler.createParameters(ParameterHandler.java:39)
      at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:771)
      at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
      at java.util.ArrayList.forEach(Unknown Source)
      at org.testng.TestRunner.privateRun(TestRunner.java:770)
      at org.testng.TestRunner.run(TestRunner.java:591)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:402)
      at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:396)
      at org.testng.SuiteRunner.privateRun(SuiteRunner.java:355)
      at org.testng.SuiteRunner.run(SuiteRunner.java:304)
      at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
      at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
      at org.testng.TestNG.runSuitesSequentially(TestNG.java:1180)
      at org.testng.TestNG.runSuitesLocally(TestNG.java:1102)
      at org.testng.TestNG.runSuites(TestNG.java:1032)
      at org.testng.TestNG.run(TestNG.java:1000)
      at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
      at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
  </code></pre>
  
  <p><strong>TestRunner class:</strong></p>
  
  <pre><code>package com.qa.test;
  
  
  import org.testng.annotations.BeforeClass;
  import org.testng.annotations.DataProvider;
  import org.testng.annotations.Test;
  
  import cucumber.api.CucumberOptions;
  import cucumber.api.testng.AbstractTestNGCucumberTests;
  import cucumber.api.testng.CucumberFeatureWrapper;
  import cucumber.api.testng.TestNGCucumberRunner;
  
  @CucumberOptions(
          features = "/src/main/java/features/login.feature",
          glue = {"stepDefinitions"},
          tags = {"~@Ignore"},
          format = {
                  "pretty",
                  "html:target/cucumber-reports/cucumber-pretty",
                  "json:target/cucumber-reports/CucumberTestReport.json",
                  "rerun:target/cucumber-reports/rerun.txt"
          },plugin = "json:target/cucumber-reports/CucumberTestReport.json")
  public class testRunner {
      private TestNGCucumberRunner testNGCucumberRunner;
  
  
      @BeforeClass
      public void test1() {
          testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
          System.out.println("hi");
      }
      @Test(groups = "cucumber scenarios", description = "Runs Cucumber Scenarios", dataProvider = "myFeatures")
      public void scenario(CucumberFeatureWrapper cucumberFeatureWrapper) throws Throwable {
          testNGCucumberRunner.runCucumber(cucumberFeatureWrapper.getCucumberFeature());
      }
  
      @DataProvider(name="myFeatures")
      public Object[][] getFeatures()
      {
          return testNGCucumberRunner.provideFeatures();
      }
  }
  </code></pre>
  
  <p><strong>TestNg.xml:</strong>
      </p>
  
  <pre><code>&lt;suite name="Suite1" verbose="1" &gt;
    &lt;test name="Login" &gt;
      &lt;classes&gt;
  &lt;class name="com.qa.test.testRunner" /&gt;
      &lt;/classes&gt;
    &lt;/test&gt;
  
  &lt;/suite&gt;
  </code></pre>
  
  <p><strong>POM:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
     &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
     &lt;groupId&gt;CucumberTest&lt;/groupId&gt;
     &lt;artifactId&gt;v1&lt;/artifactId&gt;
     &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
     &lt;packaging&gt;jar&lt;/packaging&gt;
     &lt;name&gt;v1&lt;/name&gt;
     &lt;url&gt;http://maven.apache.org&lt;/url&gt;
     &lt;properties&gt;
        &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
     &lt;/properties&gt;
     &lt;repositories&gt;
        &lt;repository&gt;
           &lt;id&gt;jcenter&lt;/id&gt;
           &lt;name&gt;bintray&lt;/name&gt;
           &lt;url&gt;http://jcenter.bintray.com&lt;/url&gt;
        &lt;/repository&gt;
     &lt;/repositories&gt;
     &lt;dependencies&gt;
        &lt;!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-core&lt;/artifactId&gt;
           &lt;version&gt;2.4.0&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;2.4.0&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-jvm&lt;/artifactId&gt;
           &lt;version&gt;2.4.0&lt;/version&gt;
           &lt;type&gt;pom&lt;/type&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-junit&lt;/artifactId&gt;
           &lt;version&gt;2.4.0&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-jvm-deps&lt;/artifactId&gt;
           &lt;version&gt;1.0.6&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;net.masterthought&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-reporting&lt;/artifactId&gt;
           &lt;version&gt;1.0.0&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!--      &lt;dependency&gt; --&gt;
        &lt;!--          &lt;groupId&gt;io.cucumber&lt;/groupId&gt; --&gt;
        &lt;!--          &lt;artifactId&gt;gherkin&lt;/artifactId&gt; --&gt;
        &lt;!--          &lt;version&gt;4.1.3&lt;/version&gt; --&gt;
        &lt;!--      &lt;/dependency&gt; --&gt;
        &lt;!-- https://mvnrepository.com/artifact/info.cukes/gherkin --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;info.cukes&lt;/groupId&gt;
           &lt;artifactId&gt;gherkin&lt;/artifactId&gt;
           &lt;version&gt;2.12.2&lt;/version&gt;
           &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;info.cukes&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-testng&lt;/artifactId&gt;
           &lt;version&gt;1.2.5&lt;/version&gt;
           &lt;scope&gt;compile&lt;/scope&gt;
           &lt;exclusions&gt;
              &lt;exclusion&gt;
                 &lt;groupId&gt;junit&lt;/groupId&gt;
                 &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;/exclusion&gt;
           &lt;/exclusions&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;junit&lt;/groupId&gt;
           &lt;artifactId&gt;junit&lt;/artifactId&gt;
           &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
           &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
           &lt;version&gt;3.5.3&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-picocontainer&lt;/artifactId&gt;
           &lt;version&gt;2.4.0&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-html --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;io.cucumber&lt;/groupId&gt;
           &lt;artifactId&gt;cucumber-html&lt;/artifactId&gt;
           &lt;version&gt;0.2.7&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/net.sourceforge.cobertura/cobertura --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;net.sourceforge.cobertura&lt;/groupId&gt;
           &lt;artifactId&gt;cobertura&lt;/artifactId&gt;
           &lt;version&gt;1.9.4.1&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core --&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.hamcrest&lt;/groupId&gt;
           &lt;artifactId&gt;hamcrest-core&lt;/artifactId&gt;
           &lt;version&gt;1.3&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
           &lt;groupId&gt;org.testng&lt;/groupId&gt;
           &lt;artifactId&gt;testng&lt;/artifactId&gt;
           &lt;version&gt;6.10&lt;/version&gt;
           &lt;scope&gt;test&lt;/scope&gt;
        &lt;/dependency&gt;
     &lt;/dependencies&gt;
     &lt;build&gt;
        &lt;plugins&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.21.0&lt;/version&gt;
              &lt;configuration&gt;
                 &lt;suiteXmlFiles&gt;
                    &lt;suiteXmlFile&gt;testNG.xml&lt;/suiteXmlFile&gt;
                 &lt;/suiteXmlFiles&gt;
              &lt;/configuration&gt;
           &lt;/plugin&gt;
        &lt;/plugins&gt;
     &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>