Package com.consol.citrus

Examples of com.consol.citrus.TestAction


    public void testActionFailingInContainerHierarchy() {
        TestCase test = new TestCase();
        test.setPackageName("com.consol.citrus.util");
        test.setName("FailureStackExampleTest");

        TestAction failedAction = new MockedTestAction("sleep");
       
        List<TestAction> actions = new ArrayList<TestAction>();
        actions.add(new MockedTestAction("sleep"));
       
        actions.add(new MockedActionContainer("parallel",
                new MockedTestAction("sleep"),
                new MockedTestAction("fail"),
                new MockedActionContainer("sequential", new MockedTestAction("sleep"), new MockedTestAction("echo"))));
       
        actions.add(new MockedTestAction("sleep"));
       
        TestAction failedContainer = new MockedActionContainer("iterate", failedAction);
        ((TestActionContainer)failedContainer).setLastExecutedAction(failedAction);
       
        TestAction nestedContainer = new MockedActionContainer("sequential",
                new MockedTestAction("echo"),
                new MockedTestAction("sleep"),
                failedContainer);
        ((TestActionContainer)nestedContainer).setLastExecutedAction(failedContainer);
        actions.add(nestedContainer);
View Full Code Here


    public void testContainerItselfFailing() {
        TestCase test = new TestCase();
        test.setPackageName("com.consol.citrus.util");
        test.setName("FailureStackExampleTest");

        TestAction failedAction = new MockedActionContainer("sequential", new MockedTestAction("sleep"), new MockedTestAction("echo"));
       
        List<TestAction> actions = new ArrayList<TestAction>();
        actions.add(new MockedTestAction("sleep"));
       
        TestAction failedContainer = new MockedActionContainer("parallel",
                new MockedTestAction("sleep"),
                new MockedTestAction("fail"),
                failedAction);
        ((TestActionContainer)failedContainer).setLastExecutedAction(failedAction);
        actions.add(failedContainer);
View Full Code Here

    public void testLastActionFailing() {
        TestCase test = new TestCase();
        test.setPackageName("com.consol.citrus.util");
        test.setName("FailureStackExampleTest");

        TestAction failedAction = new MockedTestAction("echo");
       
        List<TestAction> actions = new ArrayList<TestAction>();
        actions.add(new MockedTestAction("sleep"));
       
        actions.add(new MockedActionContainer("parallel",
                new MockedTestAction("sleep"),
                new MockedTestAction("fail"),
                new MockedActionContainer("sequential", new MockedTestAction("sleep"), new MockedTestAction("echo"))));
       
        actions.add(new MockedTestAction("sleep"));
       
        actions.add(new MockedActionContainer("sequential",
                new MockedTestAction("echo"),
                new MockedTestAction("sleep"),
                new MockedActionContainer("iterate", new MockedTestAction("sleep"))));
       
        actions.add(new MockedTestAction("fail"));
        actions.add(failedAction);
       
        test.setActions(actions);
        test.setLastExecutedAction(failedAction);
       
        List<FailureStackElement> failureStack = TestUtils.getFailureStack(test);
       
        Assert.assertFalse(failureStack.isEmpty());
        Assert.assertTrue(failureStack.size() == 1);
        FailureStackElement failureStackElement = failureStack.get(0);
        Assert.assertEquals(failureStackElement.getStackMessage(), "at com/consol/citrus/util/FailureStackExampleTest(" + failedAction.getName() + ":35-37)");
        Assert.assertEquals(failureStackElement.getLineNumberStart().longValue(), 35L);
        Assert.assertEquals(failureStackElement.getLineNumberEnd().longValue(), 37L);
    }
View Full Code Here

    @Test
    public void testNoIterationBasedOnCondition() {
        Iterate iterate = new Iterate();
       
        List<TestAction> actions = new ArrayList<TestAction>();
        TestAction action = EasyMock.createMock(TestAction.class);

        reset(action);
        replay(action);

        actions.add(action);
View Full Code Here

    @Test
    public void testIterationWithIndexManipulation() {
        Iterate iterate = new Iterate();

        List<TestAction> actions = new ArrayList<TestAction>();
        TestAction incrementTestAction = new AbstractTestAction() {
            @Override
            public void doExecute(TestContext context) {
                Long end = Long.valueOf(context.getVariable("end"));
                context.setVariable("end", String.valueOf(end - 25));
            }
View Full Code Here

     * @see org.springframework.beans.factory.FactoryBean#getObject()
     */
    public TestCase getObject() throws Exception {
        if (this.testChain != null && this.testChain.size() > 0) {
            for (int i = 0; i < testChain.size(); i++) {
                TestAction action = testChain.get(i);
                testCase.addTestAction(action);
            }
        }

        if (this.finallyChain != null && this.finallyChain.size() > 0) {
            for (int i = 0; i < finallyChain.size(); i++) {
                TestAction action = finallyChain.get(i);
                testCase.addFinallyChainAction(action);
            }
        }

        return this.testCase;
View Full Code Here

    public void testSingleAction() {

        final Conditional conditionalAction = new Conditional();
        conditionalAction.setExpression("1 = 1");

        final TestAction action = EasyMock.createMock(TestAction.class);

        reset(action);

        action.execute(this.context);
        expectLastCall().once();

        replay(action);

        final List<TestAction> actionList = new ArrayList<TestAction>();
View Full Code Here

    public void testMultipleActions() {

        final Conditional conditionalAction = new Conditional();
        conditionalAction.setExpression("1 = 1");

        final TestAction action1 = EasyMock.createMock(TestAction.class);
        final TestAction action2 = EasyMock.createMock(TestAction.class);
        final TestAction action3 = EasyMock.createMock(TestAction.class);

        reset(action1, action2, action3);

        action1.execute(this.context);
        expectLastCall().once();
        action2.execute(this.context);
        expectLastCall().once();
        action3.execute(this.context);
        expectLastCall().once();

        replay(action1, action2, action3);

        final List<TestAction> actionList = new ArrayList<TestAction>();
View Full Code Here

    public void testFirstActionFailing() {

        final Conditional conditionalAction = new Conditional();
        conditionalAction.setExpression("1 = 1");

        final TestAction action1 = EasyMock.createMock(TestAction.class);
        final TestAction action2 = EasyMock.createMock(TestAction.class);
        final TestAction action3 = EasyMock.createMock(TestAction.class);

        reset(action1, action2, action3);

        replay(action1, action2, action3);
View Full Code Here

    public void testLastActionFailing() {

        final Conditional conditionalAction = new Conditional();
        conditionalAction.setExpression("1 = 1");

        final TestAction action1 = EasyMock.createMock(TestAction.class);
        final TestAction action2 = EasyMock.createMock(TestAction.class);
        final TestAction action3 = EasyMock.createMock(TestAction.class);

        reset(action1, action2, action3);

        action1.execute(this.context);
        expectLastCall().once();
        action2.execute(this.context);
        expectLastCall().once();
        action3.execute(this.context);
        expectLastCall().once();

        replay(action1, action2, action3);

        final List<TestAction> actionList = new ArrayList<TestAction>();
View Full Code Here

TOP

Related Classes of com.consol.citrus.TestAction

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.