use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class PackageTest method configure.
private void configure(HTTPSamplerBase sampler) throws Exception {
sampler.addArgument("arg1", "val1");
ConfigTestElement config = (ConfigTestElement) new HttpDefaultsGui().createTestElement();
((Arguments) config.getProperty(HTTPSamplerBase.ARGUMENTS).getObjectValue()).addArgument(new HTTPArgument("config1", "configValue"));
config.setRunningVersion(true);
sampler.setRunningVersion(true);
sampler.setRunningVersion(true);
sampler.addTestElement(config);
assertEquals("config1=configValue", sampler.getArguments().getArgument(1).toString());
sampler.recoverRunningVersion();
config.recoverRunningVersion();
assertEquals(1, sampler.getArguments().getArgumentCount());
sampler.addTestElement(config);
assertEquals("config1=configValue", sampler.getArguments().getArgument(1).toString());
}
use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class TestURLRewritingModifier method testGrabSessionId.
@Test
public void testGrabSessionId() throws Exception {
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()).getValue());
assertEquals("http://server.com/index.html?" + "session_id=jfdkjdkf+jddkfdfjkdjfdf%22", sampler.toString());
}
use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class TestURLRewritingModifier method testNoCache.
@Test
public void testNoCache() throws Exception {
String[] html = new String[] { "<input name=\"sid\" value=\"myId\">", "myId", "<html></html>", "" };
URLRewritingModifier newMod = new URLRewritingModifier();
newMod.setThreadContext(context);
newMod.setArgumentName("sid");
newMod.setPathExtension(false);
newMod.setShouldCache(false);
for (int i = 0; i < html.length / 2; i++) {
response = new SampleResult();
response.setResponseData(html[i * 2], null);
HTTPSamplerBase sampler = createSampler();
context.setCurrentSampler(sampler);
context.setPreviousResult(response);
newMod.process();
Arguments args = sampler.getArguments();
assertEquals("For case i=" + i, html[i * 2 + 1], ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
}
}
use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class TestURLRewritingModifier method testGrabSessionId6.
@Test
public void testGrabSessionId6() throws Exception {
String html = "location: http://server.com/index.html" + "?session_id=bonjour+monsieur";
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("bonjour monsieur", ((Argument) args.getArguments().get(0).getObjectValue()).getValue());
assertEquals("http://server.com/index.html?" + "session_id=bonjour+monsieur", sampler.toString());
}
use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class TestURLRewritingModifier method testGrabSessionId5.
@Test
public void testGrabSessionId5() throws Exception {
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()).getValue());
assertEquals("http://server.com/index.html?session%5B33%5D=jfdkjdkf+jddkfdfjkdjfdf%22", sampler.toString());
}
Aggregations