Wednesday, 30 May 2018


How to run Cucumber Feature file using Junit or TestNg



Run through Junit


@RunWith(Cucumber.class)
@CucumberOptions(
                  features = “src/test/Your features file“,
                  glues="src/test/Your Step Defnitio File"
                  tags ={“@SoapUI,@Functional"},...  )

public class TestRunnerClass
{
// You should keep empty

}

Run through TestNG

@CucumberOptions(
        format={"pretty","json:path/to/json_report.json"},
        features = "Path_to_Your_features_file",
        glue="Path_to_Your_stepDefinition file",
        tags={"@smoke,@regression")
        )

public class TestRunner extends AbstractTestNGCucumberTests

{
  //keep empty
}

No comments:

Post a Comment