Package com.technophobia.substeps.execution.node

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


        Assert.assertNotNull(nonFailMethod);
        Assert.assertNotNull(failMethod);

        final String scenarioName = "scenarioName";
        final TestRootNodeBuilder rootNodeBuilder = new TestRootNodeBuilder();
        final TestFeatureNodeBuilder featureBuilder = rootNodeBuilder.addFeature(new Feature("test feature", "file"));

        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));
View Full Code Here


        Assert.assertNotNull(nonFailMethod);
        Assert.assertNotNull(failMethod);

        final String scenarioName = "scenarioName";
        final TestRootNodeBuilder rootNodeBuilder = new TestRootNodeBuilder();
        final TestFeatureNodeBuilder featureBuilder = rootNodeBuilder.addFeature(new Feature("test feature", "file"));

        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());

        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
        // tests run
View Full Code Here

    @Before
    public void setupDataAsAbove() {

        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);
View Full Code Here

TOP

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

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.