Package com.technophobia.substeps.execution.node

Examples of com.technophobia.substeps.execution.node.RootNode


        final String substeps = "./target/test-classes/substeps/duplicates2.substeps";
        final IExecutionListener notifier = mock(IExecutionListener.class);

        final List<SubstepExecutionFailure> failures = new ArrayList<SubstepExecutionFailure>();

        final RootNode rootNode = runExecutionTest(feature, tags, substeps, notifier, failures);

        // check the rootNode tree is in the state we expect
        Assert.assertThat(rootNode.getResult().getResult(), is(ExecutionResult.FAILED));

        final FeatureNode featureNode = rootNode.getChildren().get(0);
        final ScenarioNode<?> scenarioNode = featureNode.getChildren().get(0);

        Assert.assertThat(scenarioNode.getResult().getResult(), is(ExecutionResult.PARSE_FAILURE));

        verify(notifier, times(1)).onNodeFailed(eq(scenarioNode), argThat(any(SubstepsConfigurationException.class)));
View Full Code Here


        final String substeps = "./target/test-classes/substeps/simple.substeps";
        final IExecutionListener notifier = mock(IExecutionListener.class);

        // TODO - checkfailures - test currently ignored anyway..
        final List<SubstepExecutionFailure> failures = new ArrayList<SubstepExecutionFailure>();
        final RootNode rootNode = runExecutionTest(feature, tags, substeps, notifier, failures);

        System.out.println("\n\n\n\n\n*************\n\n" + rootNode.toDebugString());

        // check the rootNode tree is in the state we expect
        Assert.assertThat(rootNode.getResult().getResult(), is(ExecutionResult.FAILED));

        final FeatureNode featureNode = rootNode.getChildren().get(0);

        final OutlineScenarioNode scenarioOutlineNode2 = (OutlineScenarioNode) featureNode.getChildren().get(1);

        Assert.assertThat(scenarioOutlineNode2.getResult().getResult(), is(ExecutionResult.PARSE_FAILURE));

View Full Code Here

        final ExecutionNodeRunner runner = new ExecutionNodeRunner();
        runner.addNotifier(notifier);

        runner.prepareExecutionConfig(executionConfig);

        final RootNode rootNode = runner.run();

        final List<SubstepExecutionFailure> localFailures = runner.getFailures();

        failures.addAll(localFailures);
View Full Code Here

    @Test
    public void testNoTestsExecutedResultsInTwoFailures() {

        final ExecutionNodeRunner runner = new ExecutionNodeRunner();

        final RootNode node = new RootNode("Description", Collections.<FeatureNode> emptyList());

        final INotificationDistributor notificationDistributor = getPrivateField(runner, "notificationDistributor");
        final SetupAndTearDown setupAndTearDown = mock(SetupAndTearDown.class);

        final RootNodeExecutionContext nodeExecutionContext = new RootNodeExecutionContext(notificationDistributor,
View Full Code Here

        final OutlineScenarioNode outlineNode = new OutlineScenarioNode("scenarioName",
                Collections.<OutlineScenarioRowNode> emptyList(), Collections.<String> emptySet(), 2);
        final FeatureNode featureNode = new FeatureNode(new Feature("test feature", "file"),
                Collections.<ScenarioNode<?>> singletonList(outlineNode), Collections.<String> emptySet());
        final ExecutionNode rootNode = new RootNode("Description", Collections.singletonList(featureNode));

        final ExecutionNodeRunner runner = new ExecutionNodeRunner();

        final INotificationDistributor notificationDistributor = getPrivateField(runner, "notificationDistributor");
        final SetupAndTearDown setupAndTearDown = mock(SetupAndTearDown.class);
View Full Code Here

        row1ScenarioBuilder.addStepImpl(getClass(), nonFailMethod).addStepImpl(getClass(), failMethod)
                .addStepImpl(getClass(), nonFailMethod);
        final TestBasicScenarioNodeBuilder row2ScenarioBuilder = rowBuilder2.setBasicScenario(scenarioName);
        row2ScenarioBuilder.addStepImpls(3, getClass(), nonFailMethod);

        final RootNode rootNode = rootNodeBuilder.build();

        final ExecutionNodeRunner runner = new ExecutionNodeRunner();

        final INotificationDistributor notificationDistributor = getPrivateField(runner, "notificationDistributor");
        final SetupAndTearDown setupAndTearDown = mock(SetupAndTearDown.class);
        final RootNodeExecutionContext nodeExecutionContext = new RootNodeExecutionContext(notificationDistributor,
                Lists.<SubstepExecutionFailure> newArrayList(), setupAndTearDown, null, new ImplementationCache());

        setPrivateField(runner, "rootNode", rootNode);
        setPrivateField(runner, "nodeExecutionContext", nodeExecutionContext);

        runner.run();
        final List<SubstepExecutionFailure> failures = runner.getFailures();

        Assert.assertThat(rootNode.getResult().getResult(), is(ExecutionResult.FAILED));
        Assert.assertThat(featureBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.FAILED));
        Assert.assertThat(row1ScenarioBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.FAILED));
        Assert.assertThat(row2ScenarioBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.PASSED));
        Assert.assertThat(rowBuilder1.getBuilt().getResult().getResult(), is(ExecutionResult.FAILED));
        Assert.assertThat(rowBuilder2.getBuilt().getResult().getResult(), is(ExecutionResult.PASSED));
View Full Code Here

        row1ScenarioBuilder.addStepImpl(getClass(), nonFailMethod).addStepImpl(getClass(), failMethod)
                .addStepImpl(getClass(), nonFailMethod);
        final TestBasicScenarioNodeBuilder row2ScenarioBuilder = rowBuilder2.setBasicScenario(scenarioName);
        row2ScenarioBuilder.addStepImpl(getClass(), nonFailMethod).addStepImpls(3, getClass(), failMethod);

        final RootNode rootNode = rootNodeBuilder.build();

        final Class<?>[] setupClasses = new Class[] { this.getClass() };
        final SetupAndTearDown setupAndTearDown = new SetupAndTearDown(setupClasses, new ImplementationCache());

        final ExecutionNodeRunner runner = new ExecutionNodeRunner();

        final INotificationDistributor notificationDistributor = getPrivateField(runner, "notificationDistributor");
        final RootNodeExecutionContext nodeExecutionContext = new RootNodeExecutionContext(notificationDistributor,
                Lists.<SubstepExecutionFailure> newArrayList(), setupAndTearDown, null, new ImplementationCache());

        setPrivateField(runner, "rootNode", rootNode);
        setPrivateField(runner, "nodeExecutionContext", nodeExecutionContext);

        runner.run();
        final List<SubstepExecutionFailure> failures = runner.getFailures();

        Assert.assertThat(rootNode.getResult().getResult(), is(ExecutionResult.FAILED));
        Assert.assertThat(featureBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.NOT_RUN));

        Assert.assertFalse("expecting some failures", failures.isEmpty());

        // two failures - one for the @before failure and another because no
View Full Code Here

    public RootNode run() {

        // attach a result listener to broadcast

        this.nodeRunner.addNotifier(this);
        final RootNode rootNode;
        try {
            rootNode = this.nodeRunner.run();
        } finally {
            // now send the final notification
View Full Code Here

        final String substeps = "./target/test-classes/substeps/simple.substeps";
        final IExecutionListener notifier = mock(IExecutionListener.class);

        final List<SubstepExecutionFailure> failures = new ArrayList<SubstepExecutionFailure>();

        final RootNode rootNode = runExecutionTest(feature, tags, substeps, notifier, failures);

        Assert.assertThat(rootNode.getResult().getResult(), is(ExecutionResult.PASSED));

    }
View Full Code Here

        final String substeps = "./target/test-classes/substeps/error.substeps";
        final IExecutionListener notifier = mock(IExecutionListener.class);

        final List<SubstepExecutionFailure> failures = new ArrayList<SubstepExecutionFailure>();

        final RootNode rootNode = runExecutionTest(feature, tags, substeps, notifier, failures);

        // check the rootNode tree is in the state we expect
        Assert.assertThat(rootNode.getResult().getResult(), is(ExecutionResult.FAILED));

        final FeatureNode featureNode = rootNode.getChildren().get(0);
        final ScenarioNode<?> scenarioNode = featureNode.getChildren().get(0);

        Assert.assertThat(scenarioNode.getResult().getResult(), is(ExecutionResult.PARSE_FAILURE));

        verify(notifier, times(1)).onNodeFailed(eq(scenarioNode), argThat(any(UnimplementedStepException.class)));
View Full Code Here

TOP

Related Classes of com.technophobia.substeps.execution.node.RootNode

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.