use of gherkin.formatter.PrettyFormatter in project cucumber-jvm by cucumber.
the class DataTable method toString.
@Override
public String toString() {
StringBuilder result = new StringBuilder();
PrettyFormatter pf = new PrettyFormatter(result, true, false);
pf.table(getGherkinRows());
pf.eof();
return result.toString();
}
use of gherkin.formatter.PrettyFormatter in project cucumber-jvm by cucumber.
the class BackgroundTest method should_run_background.
@Test
public void should_run_background() throws IOException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
RuntimeOptions runtimeOptions = new RuntimeOptions("");
Runtime runtime = new Runtime(new ClasspathResourceLoader(classLoader), classLoader, asList(mock(Backend.class)), runtimeOptions);
CucumberFeature feature = feature("test.feature", "" + "Feature:\n" + " Background:\n" + " Given b\n" + " Scenario:\n" + " When s\n");
StringBuilder out = new StringBuilder();
PrettyFormatter pretty = new PrettyFormatter(out, true, true);
feature.run(pretty, pretty, runtime);
String expectedOutput = "" + "Feature: \n" + "\n" + " Background: # test.feature:2\n" + " Given b\n" + "\n" + " Scenario: # test.feature:4\n" + " When s\n";
assertEquals(expectedOutput, out.toString());
}
Aggregations