Package org.apache.jmeter.protocol.http.sampler

Examples of org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.addArgument()


            String html = "location: http://server.com/index.html" + "?session_id=jfdkjdkf%20jddkfdfjkdjfdf%22;";
            response = new SampleResult();
            response.setResponseData(html, null);
            mod.setArgumentName("session_id");
            HTTPSamplerBase sampler = createSampler();
            sampler.addArgument("session_id", "adfasdfdsafasdfasd");
            context.setCurrentSampler(sampler);
            context.setPreviousResult(response);
            mod.process();
            Arguments args = sampler.getArguments();
            assertEquals("jfdkjdkf jddkfdfjkdjfdf\"", ((Argument) args.getArguments().get(0).getObjectValue())
View Full Code Here


            String html = "location: http://server.com/index.html" + "?session[33]=jfdkjdkf%20jddkfdfjkdjfdf%22;";
            response = new SampleResult();
            response.setResponseData(html, null);
            mod.setArgumentName("session[33]");
            HTTPSamplerBase sampler = createSampler();
            sampler.addArgument("session[33]", "adfasdfdsafasdfasd");
            context.setCurrentSampler(sampler);
            context.setPreviousResult(response);
            mod.process();
            Arguments args = sampler.getArguments();
            assertEquals("jfdkjdkf jddkfdfjkdjfdf\"", ((Argument) args.getArguments().get(0).getObjectValue())
View Full Code Here

                "<a href=\"#\" onclick=\"$(\'frame\').src=\'/index?param1=bla&sessionid=xyzxyzxyz\\'";
            response = new SampleResult();
            response.setResponseData(html, null);
            mod.setArgumentName("sessionid");
            HTTPSamplerBase sampler = createSampler();
            sampler.addArgument("sessionid", "xyzxyzxyz");
            context.setCurrentSampler(sampler);
            context.setPreviousResult(response);
            mod.process();
            Arguments args = sampler.getArguments();
            assertEquals("xyzxyzxyz", ((Argument) args.getArguments().get(0).getObjectValue())
View Full Code Here

            assertEquals(config.getUrl().toString(), newUrl);
        }

        public void testSimpleFormParse() throws Exception {
            HTTPSamplerBase config = makeUrlConfig(".*index.html");
            config.addArgument("test", "g.*");
            config.setMethod(HTTPSamplerBase.POST);
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
            String responseText = "<html><head><title>Test page</title></head><body>"
                    + "<form action=\"index.html\" method=\"POST\">" + "<input type=\"checkbox\" name=\"test\""
                    + " value=\"goto\">Goto index page</form></body></html>";
View Full Code Here

            assertEquals("test=goto", config.getQueryString());
        }

        public void testBadCharParse() throws Exception {
            HTTPSamplerBase config = makeUrlConfig(".*index.html");
            config.addArgument("te$st", "g.*");
            config.setMethod(HTTPSamplerBase.POST);
            HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
            String responseText = "<html><head><title>Test page</title></head><body>"
                    + "<form action=\"index.html\" method=\"POST\">" + "<input type=\"checkbox\" name=\"te$st\""
                    + " value=\"goto\">Goto index page</form></body></html>";
View Full Code Here

        public void testSpecialCharParse() throws Exception {
        String specialChars = "-_.!~*'()%25";// These are some of the special characters
        String htmlEncodedFixture = URLEncoder.encode(specialChars, "UTF-8");
       
        HTTPSamplerBase config = makeUrlConfig(".*index.html");
        config.addArgument("test", ".*");
        config.setMethod(HTTPSamplerBase.POST);
        HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
        String responseText = "<html><head><title>Test page</title></head><body>"
            + "<form action=\"index.html\" method=\"POST\">" + "<input type=\"hidden\" name=\"test\""
            + " value=\"" + htmlEncodedFixture + "\">Goto index page</form></body></html>";
View Full Code Here

            gui = new HttpTestSampleGui();
        }

        public void testCloneSampler() throws Exception {
            HTTPSamplerBase sampler = (HTTPSamplerBase) gui.createTestElement();
            sampler.addArgument("param", "value");
            HTTPSamplerBase clonedSampler = (HTTPSamplerBase) sampler.clone();
            clonedSampler.setRunningVersion(true);
            sampler.getArguments().getArgument(0).setValue("new value");
            assertEquals("Sampler didn't clone correctly", "new value", sampler.getArguments().getArgument(0)
                    .getValue());
View Full Code Here

            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
           
            target.addArgument("param2", "value2", "=");
            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
           
            pattern.addArgument("param1", ".*", "=");
            assertFalse(HtmlParsingUtils.isAnchorMatched(target, pattern));
           
            target.addArgument("param1", "value1", "=");
            assertTrue(HtmlParsingUtils.isAnchorMatched(target, pattern));
        }
View Full Code Here

                } else if (tag.equalsIgnoreCase("textarea")) { // $NON-NLS-1$
                    try {
                        url.addEncodedArgument(getAttributeValue(nodeAtts, "name")// $NON-NLS-1$
                                tempNode.getFirstChild().getNodeValue());
                    } catch (NullPointerException e) {
                        url.addArgument(getAttributeValue(nodeAtts, "name"), ""); // $NON-NLS-1$
                    }
                } else if (tag.equalsIgnoreCase("select")) { // $NON-NLS-1$
                    selectName = getAttributeValue(nodeAtts, "name"); // $NON-NLS-1$
                } else if (tag.equalsIgnoreCase("option")) { // $NON-NLS-1$
                    String value = getAttributeValue(nodeAtts, "value"); // $NON-NLS-1$
View Full Code Here

                } else if (tag.equalsIgnoreCase("textarea")) { // $NON-NLS-1$
                    try {
                        url.addEncodedArgument(getAttributeValue(nodeAtts, "name")// $NON-NLS-1$
                                tempNode.getFirstChild().getNodeValue());
                    } catch (NullPointerException e) {
                        url.addArgument(getAttributeValue(nodeAtts, "name"), ""); // $NON-NLS-1$
                    }
                } else if (tag.equalsIgnoreCase("select")) { // $NON-NLS-1$
                    selectName = getAttributeValue(nodeAtts, "name"); // $NON-NLS-1$
                } else if (tag.equalsIgnoreCase("option")) { // $NON-NLS-1$
                    String value = getAttributeValue(nodeAtts, "value"); // $NON-NLS-1$
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.