Search in sources :

Example 1 with FormatterSpy

use of cucumber.runtime.formatter.FormatterSpy in project cucumber-jvm by cucumber.

the class FormatterMissingLifecycleMethods method handles_formatters_missing_startOfScenarioLifeCycle_endOfScenarioLifeCycle.

@Test
public void handles_formatters_missing_startOfScenarioLifeCycle_endOfScenarioLifeCycle() throws Throwable {
    CucumberFeature feature = TestHelper.feature("path/test.feature", "" + "Feature: feature name\n" + "  Scenario: scenario name\n" + "    Given step\n");
    FormatterSpy formatterSpy = new FormatterSpy();
    RuntimeOptions runtimeOptions = new RuntimeOptions("");
    runtimeOptions.addPlugin(new FormatterMissingLifecycleMethods());
    runtimeOptions.addPlugin(formatterSpy);
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    TestHelper.runFeatureWithFormatter(feature, new HashMap<String, String>(), runtimeOptions.formatter(classLoader), runtimeOptions.reporter(classLoader));
    assertEquals("" + "uri\n" + "feature\n" + "  startOfScenarioLifeCycle\n" + "  scenario\n" + "    step\n" + "    match\n" + "    result\n" + "  endOfScenarioLifeCycle\n" + "eof\n" + "done\n" + "close\n", formatterSpy.toString());
}
Also used : CucumberFeature(cucumber.runtime.model.CucumberFeature) FormatterSpy(cucumber.runtime.formatter.FormatterSpy) Test(org.junit.Test)

Example 2 with FormatterSpy

use of cucumber.runtime.formatter.FormatterSpy in project cucumber-jvm by cucumber.

the class RuntimeTest method runFeatureWithFormatterSpy.

private String runFeatureWithFormatterSpy(CucumberFeature feature, Map<String, Result> stepsToResult) throws Throwable {
    FormatterSpy formatterSpy = new FormatterSpy();
    TestHelper.runFeatureWithFormatter(feature, stepsToResult, Collections.<SimpleEntry<String, Result>>emptyList(), 0L, formatterSpy, formatterSpy);
    return formatterSpy.toString();
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) FormatterSpy(cucumber.runtime.formatter.FormatterSpy) Result(gherkin.formatter.model.Result)

Aggregations

FormatterSpy (cucumber.runtime.formatter.FormatterSpy)2 CucumberFeature (cucumber.runtime.model.CucumberFeature)1 Result (gherkin.formatter.model.Result)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1