use of gherkin.formatter.model.Tag in project cucumber-jvm by cucumber.
the class HookOrderTest method before_hooks_execute_in_order.
@Test
public void before_hooks_execute_in_order() throws Throwable {
List<HookDefinition> hooks = mockHooks(3, Integer.MAX_VALUE, 1, -1, 0, 10000, Integer.MIN_VALUE);
for (HookDefinition hook : hooks) {
glue.addBeforeHook(hook);
}
runtime.runBeforeHooks(mock(Reporter.class), new HashSet<Tag>());
InOrder inOrder = inOrder(hooks.toArray());
inOrder.verify(hooks.get(6)).execute(Matchers.<Scenario>any());
inOrder.verify(hooks.get(3)).execute(Matchers.<Scenario>any());
inOrder.verify(hooks.get(4)).execute(Matchers.<Scenario>any());
inOrder.verify(hooks.get(2)).execute(Matchers.<Scenario>any());
inOrder.verify(hooks.get(0)).execute(Matchers.<Scenario>any());
inOrder.verify(hooks.get(5)).execute(Matchers.<Scenario>any());
inOrder.verify(hooks.get(1)).execute(Matchers.<Scenario>any());
}
use of gherkin.formatter.model.Tag in project cucumber-jvm by cucumber.
the class HookOrderTest method hooks_order_across_many_backends.
@Test
public void hooks_order_across_many_backends() throws Throwable {
List<HookDefinition> backend1Hooks = mockHooks(3, Integer.MAX_VALUE, 1);
for (HookDefinition hook : backend1Hooks) {
glue.addBeforeHook(hook);
}
List<HookDefinition> backend2Hooks = mockHooks(2, Integer.MAX_VALUE, 4);
for (HookDefinition hook : backend2Hooks) {
glue.addBeforeHook(hook);
}
runtime.runBeforeHooks(mock(Reporter.class), new HashSet<Tag>());
List<HookDefinition> allHooks = new ArrayList<HookDefinition>();
allHooks.addAll(backend1Hooks);
allHooks.addAll(backend2Hooks);
InOrder inOrder = inOrder(allHooks.toArray());
inOrder.verify(backend1Hooks.get(2)).execute(Matchers.<Scenario>any());
inOrder.verify(backend2Hooks.get(0)).execute(Matchers.<Scenario>any());
inOrder.verify(backend1Hooks.get(0)).execute(Matchers.<Scenario>any());
inOrder.verify(backend2Hooks.get(2)).execute(Matchers.<Scenario>any());
verify(backend2Hooks.get(1)).execute(Matchers.<Scenario>any());
verify(backend1Hooks.get(1)).execute(Matchers.<Scenario>any());
}
use of gherkin.formatter.model.Tag in project cucumber-jvm by cucumber.
the class JavaStepDefinitionTest method does_not_throw_ambiguous_when_nothing_is_ambiguous.
@Test
public void does_not_throw_ambiguous_when_nothing_is_ambiguous() throws Throwable {
backend.addStepDefinition(THREE_DISABLED_MICE.getAnnotation(Given.class), THREE_DISABLED_MICE);
Reporter reporter = new Reporter() {
@Override
public void before(Match match, Result result) {
throw new UnsupportedOperationException();
}
@Override
public void result(Result result) {
if (result.getError() != null) {
throw new RuntimeException(result.getError());
}
}
@Override
public void after(Match match, Result result) {
throw new UnsupportedOperationException();
}
@Override
public void match(Match match) {
}
@Override
public void embedding(String mimeType, byte[] data) {
}
@Override
public void write(String text) {
}
};
runtime.buildBackendWorlds(reporter, Collections.<Tag>emptySet(), mock(Scenario.class));
Tag tag = new Tag("@foo", 0);
Set<Tag> tags = asSet(tag);
runtime.runBeforeHooks(reporter, tags);
Step step = new Step(NO_COMMENTS, "Given ", "three blind mice", 1, null, null);
runtime.runStep("some.feature", step, reporter, ENGLISH);
assertTrue(defs.foo);
assertFalse(defs.bar);
}
use of gherkin.formatter.model.Tag in project cucumber-jvm by cucumber.
the class JavaHookTest method matches_matching_tags.
@Test
public void matches_matching_tags() {
objectFactory.setInstance(new HasHooks());
backend.buildWorld();
backend.addHook(BEFORE.getAnnotation(Before.class), BEFORE);
HookDefinition before = glue.getBeforeHooks().get(0);
assertTrue(before.matches(asList(new Tag("@bar", 0), new Tag("@zap", 0))));
}
use of gherkin.formatter.model.Tag in project cucumber-jvm by cucumber.
the class HTMLFormatterTest method runFeaturesWithFormatter.
private void runFeaturesWithFormatter(URL outputDir) throws IOException {
final HTMLFormatter f = new HTMLFormatter(outputDir);
f.uri("some\\windows\\path\\some.feature");
f.scenario(new Scenario(Collections.<Comment>emptyList(), Collections.<Tag>emptyList(), "Scenario", "some cukes", "", 10, "id"));
f.embedding("image/png", "fakedata".getBytes("US-ASCII"));
f.embedding("text/plain", "dodgy stack trace here".getBytes("US-ASCII"));
f.done();
f.close();
}
Aggregations