Package gherkin.formatter.model

Examples of gherkin.formatter.model.Step


  }

  private static GrMethodCall buildStepDefinitionByStep(@NotNull final GherkinStep step) {
    final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(step.getProject());

    final Step cucumberStep = new Step(Collections.<Comment>emptyList(), step.getKeyword().getText(), step.getStepName(), 0, null, null);

    SnippetGenerator generator = new SnippetGenerator(new GroovySnippet());
    final String fqnPendingException;
    if (GrCucumberUtil.isCucumber_1_1_orAbove(step)) {
      fqnPendingException = "cucumber.api.PendingException";
View Full Code Here


  private static PsiMethod buildStepDefinitionByStep(@NotNull final GherkinStep step, Language language) {
    String annotationPackage = new AnnotationPackageProvider().getAnnotationPackageFor(step);
    String methodAnnotation = String.format("@%s.", annotationPackage);

    final Step cucumberStep = new Step(new ArrayList<Comment>(), step.getKeyword().getText(), step.getStepName(), 0, null, null);
    final String snippet = new SnippetGenerator(new JavaSnippet()).getSnippet(cucumberStep)
      .replace("PendingException", CucumberJavaUtil.getCucumberPendingExceptionFqn(step))
      .replaceFirst("@", methodAnnotation)
      .replaceAll("\\\\\\\\", "\\\\")
      .replaceAll("\\\\d", "\\\\\\\\d");
View Full Code Here

    public void testAllStepsFirstOrderingOfCalls() {
        StringBuilder stringBuilder = new StringBuilder();
        JSONFormatter jsonFormatter = new JSONPrettyFormatter(stringBuilder);
        Feature feature = feature("Test Feature");
        Scenario scenario = scenario("Test Scenario");
        Step step1 = step("Given", "Step 1");
        Step step2 = step("Given", "Step 2");
        final byte[] data1 = new byte[] {1, 2, 3};
        String text1 = "text1";
        String text2 = "text2";
        final byte[] data2 = new byte[] {4};
        Result step1Result = result("passed");
View Full Code Here

    public void testOneStepAtTheTimeOrderingOfCalls() {
        StringBuilder stringBuilder = new StringBuilder();
        JSONFormatter jsonFormatter = new JSONPrettyFormatter(stringBuilder);
        Feature feature = feature("Test Feature");
        Scenario scenario = scenario("Test Scenario");
        Step step1 = step("Given", "Step 1");
        Step step2 = step("Given", "Step 2");
        final byte[] data1 = new byte[] {1, 2, 3};
        String text1 = "text1";
        String text2 = "text2";
        final byte[] data2 = new byte[] {4};
        Result step1Result = result("passed");
View Full Code Here

    private Scenario scenario(String scenarioName) {
      return new Scenario(Collections.<Comment>emptyList(), Collections.<Tag>emptyList(), "", scenarioName, "", 13, "");
    }

    private Step step(String keyword, String stepName) {
        return new Step(Collections.<Comment>emptyList(), keyword, stepName, 14, null, new DocString("", "", 52));
    }
View Full Code Here

        if (o.containsKey("doc_string")) {
            Map ds = (Map) o.get("doc_string");
            docString = new DocString(getString(ds, "content_type"), getString(ds, "value"), getInt(ds, "line"));
        }

        Step step = new Step(comments(o), keyword(o), name(o), line(o), rows, docString);
        step.replay(formatter);

        if (o.containsKey("match")) {
            Map m = (Map) o.get("match");
            new Match(arguments(m), location(m)).replay(reporter);
        }
View Full Code Here

        }

    }

    private void printStep(String status, List<Argument> arguments, String location) {
        Step step = steps.remove(0);
        Format textFormat = getFormat(status);
        Format argFormat = getArgFormat(status);

        printComments(step.getComments(), "    ");

        StringBuilder buffer = new StringBuilder("    ");
        buffer.append(textFormat.text(step.getKeyword()));
        stepPrinter.writeStep(new NiceAppendable(buffer), textFormat, argFormat, step.getName(), arguments);
        buffer.append(indentedLocation(location));

        out.println(buffer);
        if (step.getRows() != null) {
            table(step.getRows());
        } else if (step.getDocString() != null) {
            docString(step.getDocString());
        }
    }
View Full Code Here

    }

    @Before("call(public * cucumber.runtime.StepDefinitionMatch.runStep(..)) && within(cucumber.runtime.Runtime)")
    public void beforeRunningStep(JoinPoint thisJoinPoint) {
        StepDefinitionMatch stepDefinitionMatch = (StepDefinitionMatch) thisJoinPoint.getTarget();
        Step step = (Step) getFieldValueInObject(stepDefinitionMatch, "step");
        setScenarioFromStep(step);
    }
View Full Code Here

    }

    @After("call(public * cucumber.runtime.StepDefinitionMatch.runStep(..)) && within(cucumber.runtime.Runtime)")
    public void afterRunningStep(JoinPoint thisJoinPoint) {
        StepDefinitionMatch stepDefinitionMatch = (StepDefinitionMatch) thisJoinPoint.getTarget();
        Step step = (Step) getFieldValueInObject(stepDefinitionMatch, "step");
        steps.remove(step);
    }
View Full Code Here

TOP

Related Classes of gherkin.formatter.model.Step

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.