Package org.apache.jmeter.junit.stubs

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


        }
  
        public void testProcessingTrue() throws Exception {
            LoopController controller = new LoopController();
            controller.setLoops(2);
            controller.addTestElement(new TestSampler("Sample1"));
            IfController ifCont = new IfController("true==true");
            ifCont.setEvaluateAll(true);
            ifCont.addTestElement(new TestSampler("Sample2"));
            TestSampler sample3 = new TestSampler("Sample3");           
            ifCont.addTestElement(sample3);
            controller.addTestElement(ifCont);
                       
            String[] order = new String[] { "Sample1", "Sample2", "Sample3",
                    "Sample1", "Sample2", "Sample3" };
View Full Code Here


         * @throws Exception
         */
        public void testEvaluateAllChildrenWithoutSubController() throws Exception {
            LoopController controller = new LoopController();
            controller.setLoops(2);
            controller.addTestElement(new TestSampler("Sample1"));
            IfController ifCont = new IfController("true==true");
            ifCont.setEvaluateAll(true);
            controller.addTestElement(ifCont);
           
            ifCont.addTestElement(new TestSampler("Sample2"));
            TestSampler sample3 = new TestSampler("Sample3");           
            ifCont.addTestElement(sample3);
            TestSampler sample4 = new TestSampler("Sample4");
            ifCont.addTestElement(sample4);
           
            String[] order = new String[] { "Sample1", "Sample2", "Sample3",
                    "Sample1", "Sample2", "Sample3" };
            int counter = 0;
View Full Code Here

         * @throws Exception
         */
        public void testEvaluateAllChildrenWithSubController() throws Exception {
            LoopController controller = new LoopController();
            controller.setLoops(2);
            controller.addTestElement(new TestSampler("Sample1"));
            IfController ifCont = new IfController("true==true");
            ifCont.setEvaluateAll(true);
            controller.addTestElement(ifCont);
            ifCont.addTestElement(new TestSampler("Sample2"));
           
            GenericController genericCont = new GenericController();
            TestSampler sample3 = new TestSampler("Sample3");           
            genericCont.addTestElement(sample3);
            TestSampler sample4 = new TestSampler("Sample4");
            genericCont.addTestElement(sample4);
            ifCont.addTestElement(genericCont);
           
            String[] order = new String[] { "Sample1", "Sample2", "Sample3",
                    "Sample1", "Sample2", "Sample3" };
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

        }

        // Should behave the same for blank and LAST because success on input
        private void runTestLastFailed(String s) throws Exception {
            GenericController controller = new GenericController();
            controller.addTestElement(new TestSampler("1"));
            WhileController while_cont = new WhileController();
            controller.addTestElement(while_cont);
            while_cont.setCondition(s);
            GenericController sub = new GenericController();
            while_cont.addTestElement(sub);
            sub.addTestElement(new TestSampler("2"));
            sub.addTestElement(new TestSampler("3"));
           
            controller.addTestElement(new TestSampler("4"));

            setLastSampleStatus(true);
            controller.initialize();
            assertEquals("1", nextName(controller));
            assertEquals("2", nextName(controller));
View Full Code Here

            controller.setContinueForever(true);
            controller.setLoops(-1);
            WhileController while_cont = new WhileController();
            setLastSampleStatus(false);
            while_cont.setCondition("false");
            while_cont.addTestElement(new TestSampler("one"));
            while_cont.addTestElement(new TestSampler("two"));
            controller.addTestElement(while_cont);
            if (other) {
                controller.addTestElement(new TestSampler("three"));
            }
            controller.initialize();
            try {
                if (other) {
                    assertEquals("three", 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.