Package org.apache.jmeter.junit.stubs

Examples of org.apache.jmeter.junit.stubs.TestSampler


    }

    public void testProcessing() throws Exception {
        GenericController controller = new GenericController();
        GenericController sub_1 = new OnceOnlyController();
        sub_1.addTestElement(new TestSampler("one"));
        sub_1.addTestElement(new TestSampler("two"));
        controller.addTestElement(sub_1);
        controller.addTestElement(new TestSampler("three"));
        LoopController sub_2 = new LoopController();
        sub_2.setLoops(3);
        GenericController sub_3 = new GenericController();
        sub_2.addTestElement(new TestSampler("four"));
        sub_3.addTestElement(new TestSampler("five"));
        sub_3.addTestElement(new TestSampler("six"));
        sub_2.addTestElement(sub_3);
        sub_2.addTestElement(new TestSampler("seven"));
        controller.addTestElement(sub_2);
        String[] interleaveOrder = new String[] { "one", "two" };
        String[] order = new String[] { "", "", "three", "four", "five", "six", "seven", "four", "five", "six",
            "seven", "four", "five", "six", "seven" };
        int counter = 15;
View Full Code Here


    }

    public void testProcessing2() throws Exception {
        GenericController controller = new GenericController();
        GenericController sub_1 = new OnceOnlyController();
        sub_1.addTestElement(new TestSampler("one"));
        sub_1.addTestElement(new TestSampler("two"));
        controller.addTestElement(sub_1);
        controller.addTestElement(new TestSampler("three"));
        LoopController sub_2 = new LoopController();
        sub_2.setLoops(3);
        OnceOnlyController sub_3 = new OnceOnlyController();
        sub_2.addTestElement(new TestSampler("four"));
        sub_3.addTestElement(new TestSampler("five"));
        sub_3.addTestElement(new TestSampler("six"));
        sub_2.addTestElement(sub_3);
        sub_2.addIterationListener(sub_3);
        sub_2.addTestElement(new TestSampler("seven"));
        controller.addTestElement(sub_2);
        String[] interleaveOrder = new String[] { "one", "two" };
        String[] order = new String[] { "", "", "three", "four", "five", "six", "seven", "four", "seven", "four",
            "seven" };
        int counter = 11;
View Full Code Here

        LoopController controller = new LoopController();
        final int outerLoopCount = 4;
        controller.setLoops(outerLoopCount);
        // OnlyOnce samples
        OnceOnlyController sub_1 = new OnceOnlyController();
        sub_1.addTestElement(new TestSampler("one"));
        sub_1.addTestElement(new TestSampler("two"));
        controller.addTestElement(sub_1);
        controller.addIterationListener(sub_1);
        // Outer sample
        controller.addTestElement(new TestSampler("three"));
        // Inner loop
        LoopController sub_2 = new LoopController();
        final int innerLoopCount = 3;
        sub_2.setLoops(innerLoopCount);
        GenericController sub_3 = new GenericController();
        sub_2.addTestElement(new TestSampler("four"));
        sub_3.addTestElement(new TestSampler("five"));
        sub_3.addTestElement(new TestSampler("six"));
        sub_2.addTestElement(sub_3);
        // Sample in inner loop
        sub_2.addTestElement(new TestSampler("seven"));
        controller.addTestElement(sub_2);
       
        // Compute the expected sample names
        String[] onlyOnceOrder = new String[] { "one", "two" };
        String[] order = new String[] { "three", "four", "five", "six", "seven", "four", "five", "six",
View Full Code Here

        LoopController controller = new LoopController();
        final int outerLoopCount = 4;
        controller.setLoops(outerLoopCount);
        // OnlyOnce samples
        OnceOnlyController sub_1 = new OnceOnlyController();
        sub_1.addTestElement(new TestSampler("one"));
        sub_1.addTestElement(new TestSampler("two"));
        controller.addTestElement(sub_1);
        controller.addIterationListener(sub_1);
        // Outer sample
        controller.addTestElement(new TestSampler("three"));
        // Inner loop
        LoopController sub_2 = new LoopController();
        final int innerLoopCount = 3;
        sub_2.setLoops(innerLoopCount);
        // Sample in inner loop
        sub_2.addTestElement(new TestSampler("four"));
        // OnlyOnce inside inner loop
        OnceOnlyController sub_3 = new OnceOnlyController();
        sub_3.addTestElement(new TestSampler("five"));
        sub_3.addTestElement(new TestSampler("six"));
        sub_2.addTestElement(sub_3);
        sub_2.addIterationListener(sub_3);
        // Sample in inner loop
        sub_2.addTestElement(new TestSampler("seven"));
        controller.addTestElement(sub_2);

        // Compute the expected sample names
        String[] onlyOnceOrder = new String[] { "one", "two" };
        String[] order = new String[] { "three", "four", "five", "six", "seven", "four", "seven", "four", "seven" };
View Full Code Here

        final int outerLoopCount = 4;
        controller.setLoops(outerLoopCount);
        // OnlyOnce samples
        OnceOnlyController sub_1 = new OnceOnlyController();
        sub_1.setName("outer OnlyOnce");
        sub_1.addTestElement(new TestSampler("one"));
        sub_1.addTestElement(new TestSampler("two"));
        controller.addTestElement(sub_1);
        controller.addIterationListener(sub_1);
        // Outer sample
        controller.addTestElement(new TestSampler("three"));
        // Inner loop
        LoopController sub_2 = new LoopController();
        final int innerLoopCount = 5;
        sub_2.setLoops(innerLoopCount);
        sub_2.addTestElement(new TestSampler("four"));
        // OnlyOnce inside inner loop
        OnceOnlyController sub_3 = new OnceOnlyController();
        sub_3.setName("In loop OnlyOnce");
        sub_3.addTestElement(new TestSampler("five"));
        sub_3.addTestElement(new TestSampler("six"));
        sub_2.addTestElement(sub_3);
        sub_2.addIterationListener(sub_3);
        // InterleaveController in inner loop
        InterleaveControl sub_4 = new InterleaveControl();
        sub_4.setStyle(InterleaveControl.USE_SUB_CONTROLLERS);
        // OnlyOnce inside InterleaveController
        OnceOnlyController sub_5 = new OnceOnlyController();
        sub_5.addTestElement(new TestSampler("seven"));
        sub_5.addTestElement(new TestSampler("eight"));
        sub_5.setName("Inside InterleaveController OnlyOnce");
        sub_4.addTestElement(sub_5);
        sub_4.addIterationListener(sub_5);
        // Samples inside InterleaveController       
        sub_4.addTestElement(new TestSampler("nine"));
        sub_4.addTestElement(new TestSampler("ten"));
        sub_2.addTestElement(sub_4);
        // Sample in inner loop       
        sub_2.addTestElement(new TestSampler("eleven"));
        controller.addTestElement(sub_2);

        // Compute the expected sample names
        String[] onlyOnceOrder = new String[] { "one", "two" };
        String[] order = new String[] { "three", "four", "five", "six", "seven", "eight", "eleven",
View Full Code Here

        private void runtestPrevOK(String type) throws Exception {
            GenericController controller = new GenericController();
            WhileController while_cont = new WhileController();
            setLastSampleStatus(true);
            while_cont.setCondition(type);
            while_cont.addTestElement(new TestSampler("one"));
            while_cont.addTestElement(new TestSampler("two"));
            while_cont.addTestElement(new TestSampler("three"));
            controller.addTestElement(while_cont);
            controller.addTestElement(new TestSampler("four"));
            controller.initialize();
            assertEquals("one", nextName(controller));
            assertEquals("two", nextName(controller));
            assertEquals("three", nextName(controller));
            assertEquals("one", nextName(controller));
View Full Code Here

            GenericController controller = new GenericController();
            controller.setRunningVersion(true);
            WhileController while_cont = new WhileController();
            setLastSampleStatus(false);
            while_cont.setCondition("");
            while_cont.addTestElement(new TestSampler("one"));
            while_cont.addTestElement(new TestSampler("two"));
            controller.addTestElement(while_cont);
            controller.addTestElement(new TestSampler("three"));
            controller.initialize();
            assertEquals("one", nextName(controller));
            assertEquals("two", nextName(controller));
            assertEquals("three", nextName(controller));
            assertNull(nextName(controller));
View Full Code Here

            while_cont.setCondition("${VAR}");
            jmvars.put("VAR", "");
            ValueReplacer vr = new ValueReplacer();
            vr.replaceValues(while_cont);
            setRunning(while_cont);
            controller.addTestElement(new TestSampler("before"));
            controller.addTestElement(while_cont);
            while_cont.addTestElement(new TestSampler("one"));
            while_cont.addTestElement(new TestSampler("two"));
            GenericController simple = new GenericController();
            while_cont.addTestElement(simple);
            simple.addTestElement(new TestSampler("three"));
            simple.addTestElement(new TestSampler("four"));
            controller.addTestElement(new TestSampler("after"));
            controller.initialize();
            for (int i = 1; i <= 3; i++) {
                assertEquals("Loop: "+i,"before", nextName(controller));
                assertEquals("Loop: "+i,"one", nextName(controller));
                assertEquals("Loop: "+i,"two", nextName(controller));
View Full Code Here

            while_cont.setCondition("${VAR}");
            jmvars.put("VAR", "");
            ValueReplacer vr = new ValueReplacer();
            vr.replaceValues(while_cont);
            setRunning(while_cont);
            controller.addTestElement(new TestSampler("before"));
            controller.addTestElement(while_cont);
            GenericController simple = new GenericController();
            while_cont.addTestElement(simple);
            simple.addTestElement(new TestSampler("one"));
            simple.addTestElement(new TestSampler("two"));
            while_cont.addTestElement(new TestSampler("three"));
            while_cont.addTestElement(new TestSampler("four"));
            controller.addTestElement(new TestSampler("after"));
            controller.initialize();
            for (int i = 1; i <= 3; i++) {
                assertEquals("Loop: "+i,"before", nextName(controller));
                assertEquals("Loop: "+i,"one", nextName(controller));
                assertEquals("Loop: "+i,"two", nextName(controller));
View Full Code Here

        private void runTestPrevFailed(String s) throws Exception {
            GenericController controller = new GenericController();
            WhileController while_cont = new WhileController();
            setLastSampleStatus(false);
            while_cont.setCondition(s);
            while_cont.addTestElement(new TestSampler("one"));
            while_cont.addTestElement(new TestSampler("two"));
            controller.addTestElement(while_cont);
            controller.addTestElement(new TestSampler("three"));
            controller.initialize();
            assertEquals("three", nextName(controller));
            assertNull(nextName(controller));
            assertEquals("three", nextName(controller));
            assertNull(nextName(controller));
View Full Code Here

TOP

Related Classes of org.apache.jmeter.junit.stubs.TestSampler

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.