Package com.technophobia.substeps.execution.node

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


        final TestOutlineScenarioNodeBuilder outlineScenarioBuilder = featureBuilder.addOutlineScenario(scenarioName);
        final TestOutlineScenarioRowNodeBuilder rowBuilder1 = outlineScenarioBuilder.addRow(1);
        final TestOutlineScenarioRowNodeBuilder rowBuilder2 = outlineScenarioBuilder.addRow(2);

        final TestBasicScenarioNodeBuilder row1ScenarioBuilder = rowBuilder1.setBasicScenario(scenarioName);
        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));

        Assert.assertThat(outlineScenarioBuilder.getBuilt().getResult().getResult(), is(ExecutionResult.FAILED));
        Assert.assertThat(row1ScenarioBuilder.getBuilt().getChildren().get(0).getResult().getResult(),
                is(ExecutionResult.PASSED));
        Assert.assertThat(row1ScenarioBuilder.getBuilt().getChildren().get(1).getResult().getResult(),
                is(ExecutionResult.FAILED));
        Assert.assertThat(row1ScenarioBuilder.getBuilt().getChildren().get(2).getResult().getResult(),
                is(ExecutionResult.NOT_RUN));

        Assert.assertThat(row2ScenarioBuilder.getBuilt().getChildren().get(0).getResult().getResult(),
                is(ExecutionResult.PASSED));
        Assert.assertThat(row2ScenarioBuilder.getBuilt().getChildren().get(1).getResult().getResult(),
                is(ExecutionResult.PASSED));
        Assert.assertThat(row2ScenarioBuilder.getBuilt().getChildren().get(2).getResult().getResult(),
                is(ExecutionResult.PASSED));

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

        // just one failure for the actual step that failed
View Full Code Here


        final TestOutlineScenarioNodeBuilder outlineScenarioBuilder = featureBuilder.addOutlineScenario(scenarioName);
        final TestOutlineScenarioRowNodeBuilder rowBuilder1 = outlineScenarioBuilder.addRow(1);
        final TestOutlineScenarioRowNodeBuilder rowBuilder2 = outlineScenarioBuilder.addRow(2);

        final TestBasicScenarioNodeBuilder row1ScenarioBuilder = rowBuilder1.setBasicScenario(scenarioName);
        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());
View Full Code Here

        TestRootNodeBuilder rootBuilder = new TestRootNodeBuilder();

        TestFeatureNodeBuilder feature1 = rootBuilder.addFeature(new Feature("Feature1", "File"));
        TestFeatureNodeBuilder feature2 = rootBuilder.addFeature(new Feature("Feature2", "File"));

        TestBasicScenarioNodeBuilder scenarioA = feature1.addBasicScenario("ScenarioA");
        TestBasicScenarioNodeBuilder scenarioB = feature1.addBasicScenario("ScenarioB");

        TestSubstepNodeBuilder aSubstep1 = scenarioA.addSubstep();
        aSubstep1.addSubstep().addStepImpl(getClass(), null);
        aSubstep1.addSubstep().addStepImpl(getClass(), null);
        scenarioA.addSubstep().addStepImpl(getClass(), null).addStepImpl(getClass(), null);
        scenarioB.addStepImpl(getClass(), null).addSubstep().addStepImpl(getClass(), null);

        TestOutlineScenarioNodeBuilder scenarioOutline1 = feature2.addOutlineScenario("SO1");
        TestOutlineScenarioRowNodeBuilder row1 = scenarioOutline1.addRow(1);
        TestOutlineScenarioRowNodeBuilder row2 = scenarioOutline1.addRow(2);

        TestBasicScenarioNodeBuilder basicScenarioC = row1.setBasicScenario("BasicScenarioC");
        basicScenarioC.addSubstep().addStepImpls(2, getClass(), null);
        basicScenarioC.addSubstep().addStepImpl(getClass(), null);
        row2.setBasicScenario(basicScenarioC);

        TestOutlineScenarioNodeBuilder scenarioOutline2 = feature2.addOutlineScenario("SO2");

        TestOutlineScenarioRowNodeBuilder sO2Row1 = scenarioOutline2.addRow(0);

        TestBasicScenarioNodeBuilder basicScenarioD = sO2Row1.setBasicScenario("BasicScenarioD");
        basicScenarioD.addStepImpl(getClass(), null);

        TestOutlineScenarioRowNodeBuilder sO2Row2 = scenarioOutline2.addRow(1);
        sO2Row2.setBasicScenario(basicScenarioD);

        reportData = new ReportData();
View Full Code Here

TOP

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

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.