Package org.apache.jmeter.junit.stubs

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


        }

        // 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

        }

        public void testRandomOrder() {
            testLog.debug("Testing RandomOrderController");
            RandomOrderController roc = new RandomOrderController();
            roc.addTestElement(new TestSampler("zero"));
            roc.addTestElement(new TestSampler("one"));
            roc.addTestElement(new TestSampler("two"));
            roc.addTestElement(new TestSampler("three"));
            TestElement sampler = null;
            List usedSamplers = new ArrayList();
            roc.initialize();
            while ((sampler = roc.next()) != null) {
                String samplerName = sampler.getName();
View Full Code Here

            assertTrue(roc.next() == null);
        }

        public void testRandomOrderOneElement() {
            RandomOrderController roc = new RandomOrderController();
            roc.addTestElement(new TestSampler("zero"));
            TestElement sampler = null;
            List usedSamplers = new ArrayList();
            roc.initialize();
            while ((sampler = roc.next()) != null) {
                String samplerName = sampler.getName();
View Full Code Here

        public void testByNumber() throws Exception {
            ThroughputController sub_1 = new ThroughputController();
            sub_1.setStyle(ThroughputController.BYNUMBER);
            sub_1.setMaxThroughput(2);
            sub_1.addTestElement(new TestSampler("one"));
            sub_1.addTestElement(new TestSampler("two"));

            LoopController loop = new LoopController();
            loop.setLoops(5);
            loop.addTestElement(new TestSampler("zero"));
            loop.addTestElement(sub_1);
            loop.addIterationListener(sub_1);
            loop.addTestElement(new TestSampler("three"));

            LoopController test = new LoopController();
            test.setLoops(2);
            test.addTestElement(loop);
View Full Code Here

        public void testByNumberZero() throws Exception {
            ThroughputController sub_1 = new ThroughputController();
            sub_1.setStyle(ThroughputController.BYNUMBER);
            sub_1.setMaxThroughput(0);
            sub_1.addTestElement(new TestSampler("one"));
            sub_1.addTestElement(new TestSampler("two"));

            LoopController controller = new LoopController();
            controller.setLoops(5);
            controller.addTestElement(new TestSampler("zero"));
            controller.addTestElement(sub_1);
            controller.addIterationListener(sub_1);
            controller.addTestElement(new TestSampler("three"));

            String[] order = new String[] { "zero", "three", "zero", "three", "zero", "three", "zero", "three", "zero",
                    "three", };
            int counter = 0;
            controller.setRunningVersion(true);
View Full Code Here

        public void testByPercent33() throws Exception {
            ThroughputController sub_1 = new ThroughputController();
            sub_1.setStyle(ThroughputController.BYPERCENT);
            sub_1.setPercentThroughput(33.33f);
            sub_1.addTestElement(new TestSampler("one"));
            sub_1.addTestElement(new TestSampler("two"));

            LoopController controller = new LoopController();
            controller.setLoops(6);
            controller.addTestElement(new TestSampler("zero"));
            controller.addTestElement(sub_1);
            controller.addIterationListener(sub_1);
            controller.addTestElement(new TestSampler("three"));
            // Expected results established using the DDA
            // algorithm (see
            // http://www.siggraph.org/education/materials/HyperGraph/scanline/outprims/drawline.htm):
            String[] order = new String[] { "zero", // 0/1 vs. 1/1 -> 0 is
                                                    // closer to 33.33
View Full Code Here

        public void testByPercentZero() throws Exception {
            ThroughputController sub_1 = new ThroughputController();
            sub_1.setStyle(ThroughputController.BYPERCENT);
            sub_1.setPercentThroughput(0.0f);
            sub_1.addTestElement(new TestSampler("one"));
            sub_1.addTestElement(new TestSampler("two"));

            LoopController controller = new LoopController();
            controller.setLoops(150);
            controller.addTestElement(new TestSampler("zero"));
            controller.addTestElement(sub_1);
            controller.addIterationListener(sub_1);
            controller.addTestElement(new TestSampler("three"));

            String[] order = new String[] { "zero", "three", };
            int counter = 0;
            controller.setRunningVersion(true);
            sub_1.setRunningVersion(true);
View Full Code Here

        public void testByPercent100() throws Exception {
            ThroughputController sub_1 = new ThroughputController();
            sub_1.setStyle(ThroughputController.BYPERCENT);
            sub_1.setPercentThroughput(100.0f);
            sub_1.addTestElement(new TestSampler("one"));
            sub_1.addTestElement(new TestSampler("two"));

            LoopController controller = new LoopController();
            controller.setLoops(150);
            controller.addTestElement(new TestSampler("zero"));
            controller.addTestElement(sub_1);
            controller.addIterationListener(sub_1);
            controller.addTestElement(new TestSampler("three"));

            String[] order = new String[] { "zero", "one", "two", "three", };
            int counter = 0;
            controller.setRunningVersion(true);
            sub_1.setRunningVersion(true);
View Full Code Here

        public void testProcessing() throws Exception {
            testLog.debug("Testing Generic Controller");
            GenericController controller = new GenericController();
            GenericController sub_1 = new GenericController();
            sub_1.addTestElement(new TestSampler("one"));
            sub_1.addTestElement(new TestSampler("two"));
            controller.addTestElement(sub_1);
            controller.addTestElement(new TestSampler("three"));
            GenericController sub_2 = new GenericController();
            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[] order = new String[] { "one", "two", "three", "four", "five", "six", "seven" };
            int counter = 7;
            controller.initialize();
            for (int i = 0; i < 2; i++) {
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.