Package com.technophobia.substeps.model

Examples of com.technophobia.substeps.model.Step


       
        for (final ParentStep p : syntax.getSortedRootSubSteps()){
           
            // is there an executionnodeusage that is going to match ?
           
            final Step parent = p.getParent();
           
            if (thereIsNotAStepThatMatchesThisPattern(parent.getPattern(), calledExecutionNodes)){
                buf.append("\t")
                    .append( parent.getLine())
                    .append( " @ ")
                    .append(parent.getSource().getName())
                    .append( ":")
                    .append(parent.getSourceLineNumber())
                    .append("\n");
            }
        }
        if (buf.length()> 0){
            log.warn("** Substep definitions not called in current substep execution scope...\n\n" + buf.toString());
View Full Code Here


        final Scenario sc1 = ff.getScenarios().get(1);
        Assert.assertTrue(sc1.hasBackground());
        Assert.assertThat(sc1.getBackground().getSteps().size(), is(1));
        Assert.assertThat(sc1.getSteps().size(), is(4));

        final Step withEmailAddress = ff.getScenarios().get(0).getSteps().get(0);
        Assert.assertThat(withEmailAddress.getLine(), is("Given something with an@emailaddress.com"));

        final Scenario sc2 = ff.getScenarios().get(2);
        Assert.assertTrue(sc2.isOutline());
        Assert.assertThat(sc2.getSteps().size(), is(6));

        Assert.assertThat(sc2.getExampleParameters().size(), is(8));

        final Scenario sc3 = ff.getScenarios().get(3);
        Assert.assertThat(sc3.getSteps().size(), is(5));

        final Step step = sc3.getSteps().get(2);
        Assert.assertThat(step.getInlineTable().size(), is(1));

        final Map<String, String> inlineTableRow0 = step.getInlineTable().get(0);

        Assert.assertThat(inlineTableRow0.size(), is(4));

        Assert.assertFalse(ff.getScenarios().get(0).getTags().isEmpty());
View Full Code Here

    public void testMultiParamScenario() {
        final String topLevelStepFeature = "Given two postcodes S11 8UP, \"Penrhyn Road\", S11 8UE, \"Hunter Hill Road\"";

        final String parentDefinition = "Given two postcodes <s_outer_pc> <s_inner_pc>, <from_street>, <e_outer_pc> <e_inner_pc>, <to_street>";

        final Step theParentStep = new Step(parentDefinition, true);
        final ParentStep parentStep = new ParentStep(theParentStep);

        final Step topLevelStop = new Step(topLevelStepFeature);

        parentStep.initialiseParamValues(topLevelStop);

        final Map<String, String> paramValueMap = parentStep.getParamValueMap().getParameters();
        Assert.assertNotNull(paramValueMap);
View Full Code Here

    }


    @Test
    public void testStepConstruction() {
        final Step aNormalStep = new Step("Given the usual");

        Assert.assertThat(aNormalStep.getKeyword(), is("Given"));
        Assert.assertThat(aNormalStep.getLine(), is("Given the usual"));
        // Assert.assertThat(aNormalStep.getParam(), is("the usual"));
        Assert.assertNull(aNormalStep.getPattern());

        // a step defined as a root of a series of steps
        final Step aParentSubStep = new Step("Given the usual with a <parameter>", true);

        Assert.assertThat(aParentSubStep.getKeyword(), is("Given"));
        Assert.assertThat(aParentSubStep.getLine(), is("Given the usual with a <parameter>"));

        // we would want this string to match with the compiled pattern

        Assert.assertThat(aParentSubStep.getPattern(), is("Given the usual with a \"?([^\"]*)\"?"));

        // param is "the usual with a <parameter>" as normal... TODO is this
        // expected?
        // Assert.assertThat(aParentSubStep.getParam(),
        // is(aParentSubStep.getPattern()));
View Full Code Here

    }


    @Test
    public void testParentParameterChaining() {
        final Step aParentSubStep = new Step("Given", // "the usual with a <parameter>",
                "Given the usual with a <parameter>", true);

        final Step topLevelStepReDefinedInSubSteps = new Step("Given the usual with a \"fantastically tickety boo\"");

        final ParentStep parentStep = new ParentStep(aParentSubStep);

        parentStep.initialiseParamValues(topLevelStepReDefinedInSubSteps);
        // String[] paramValues = Util.getArgs(this.parent.pattern, step.param);
View Full Code Here

        if (!lineProcessed) {
            if (this.currentParentStep != null) {

                final int sourceOffset = this.currentFileContents.getSourceStartOffsetForLineIndex(lineNumberIdx);
                // no context at the mo
                this.currentParentStep.addStep(new Step(trimmed, true, this.currentFileContents.getFile(),
                        lineNumberIdx, sourceOffset));
            }
        }
    }
View Full Code Here

                // build up a Step from the remainder

                final int sourceOffset = this.currentFileContents.getSourceStartOffsetForLineIndex(lineNumberIdx);

                final Step parent = new Step(remainder, true, this.currentFileContents.getFile(), lineNumberIdx,
                        sourceOffset);

                if (this.currentParentStep != null) {
                    final String newPattern = this.currentParentStep.getParent().getPattern();
View Full Code Here

                    if (collectExamples) {
                        // we're now onto the examples
                        parseExamples(lineNumber, line, sc);
                    } else {
                        // this is an inline table
                        final Step last = sc.getSteps().get(sc.getSteps().size() - 1);
                        final String[] data = line.split("\\|");
                        last.addTableData(data);
                    }

                } else {
                    sc.addStep(new Step(line, file, lineNumber, this.currentFileContents
                            .getSourceStartOffsetForLineIndex(lineNumber)));
                }
            }
        }
    }
View Full Code Here

    }

    @Test
    public void testSingleWordSubStepDefinition() {

        final Step parent = new Step("ASingleWord", true, new File("./target/test-classes/substeps/bugs.substeps"), 23,
                11);

        Assert.assertNotNull(parent.getPattern());

        final List<Class<?>> stepImplsList = new ArrayList<Class<?>>();
        stepImplsList.add(MockStepImplementations.class);

        // final List<Class<?>> stepImpls = new ArrayList<Class<?>>();
View Full Code Here

        Assert.assertThat(sc1.getSourceStartLineNumber(), is(13));

        final List<Step> steps = sc1.getSteps();
        Assert.assertThat(steps.size(), is(7));

        final Step s1 = steps.get(0);
        Assert.assertThat(s1.getSourceLineNumber(), is(14));
        final Step s2 = steps.get(1);
        Assert.assertThat(s2.getSourceLineNumber(), is(15));

        final Step s3 = steps.get(2);
        Assert.assertThat(s3.getSourceLineNumber(), is(16));

        final Step s4 = steps.get(3);
        Assert.assertThat(s4.getSourceLineNumber(), is(17));

        final Step s5 = steps.get(4);
        Assert.assertThat(s5.getSourceLineNumber(), is(18));

        final Step s6 = steps.get(5);
        Assert.assertThat(s6.getSourceLineNumber(), is(19));

        final Step s7 = steps.get(6);
        Assert.assertThat(s7.getSourceLineNumber(), is(20));

        final Scenario sc2 = scenarios.get(1);

        Assert.assertThat(sc2.getSourceStartLineNumber(), is(23));
View Full Code Here

TOP

Related Classes of com.technophobia.substeps.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.