Search in sources :

Example 61 with JMeterVariables

use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.

the class TestXPathExtractor method setUp.

@Before
public void setUp() throws UnsupportedEncodingException {
    jmctx = JMeterContextService.getContext();
    extractor = new XPathExtractor();
    // This would be done by the run command
    extractor.setThreadContext(jmctx);
    extractor.setRefName(VAL_NAME);
    extractor.setDefaultValue("Default");
    result = new SampleResult();
    data = "<book><preface title='Intro'>zero</preface><page>one</page><page>two</page><empty></empty><a><b></b></a></book>";
    result.setResponseData(data.getBytes("UTF-8"));
    vars = new JMeterVariables();
    jmctx.setVariables(vars);
    jmctx.setPreviousResult(result);
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables) SampleResult(org.apache.jmeter.samplers.SampleResult) Before(org.junit.Before)

Example 62 with JMeterVariables

use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.

the class PackageTest method setUp.

@Override
public void setUp() {
    jmctx = JMeterContextService.getContext();
    jmctx.setVariables(new JMeterVariables());
    vars = jmctx.getVariables();
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables)

Example 63 with JMeterVariables

use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.

the class SplitFunctionTest method setUp.

@Before
public void setUp() {
    jmctx = JMeterContextService.getContext();
    jmctx.setVariables(new JMeterVariables());
    vars = jmctx.getVariables();
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables) Before(org.junit.Before)

Example 64 with JMeterVariables

use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.

the class TestWhileController method setUp.

@Before
public void setUp() {
    jmctx = JMeterContextService.getContext();
    jmctx.setVariables(new JMeterVariables());
    jmvars = jmctx.getVariables();
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables) Before(org.junit.Before)

Example 65 with JMeterVariables

use of org.apache.jmeter.threads.JMeterVariables in project jmeter by apache.

the class PackageTest method setUp.

@Before
public void setUp() {
    jmctx = JMeterContextService.getContext();
    Map<String, String> variables = new HashMap<>();
    variables.put("my_regex", ".*");
    variables.put("server", "jakarta.apache.org");
    SampleResult result = new SampleResult();
    result.setResponseData("<html>hello world</html> costs: $3.47,$5.67", null);
    transformer = new ReplaceStringWithFunctions(new CompoundVariable(), variables);
    jmctx.setVariables(new JMeterVariables());
    jmctx.setSamplingStarted(true);
    jmctx.setPreviousResult(result);
    jmctx.getVariables().put("server", "jakarta.apache.org");
    jmctx.getVariables().put("my_regex", ".*");
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables) HashMap(java.util.HashMap) SampleResult(org.apache.jmeter.samplers.SampleResult) Before(org.junit.Before)

Aggregations

JMeterVariables (org.apache.jmeter.threads.JMeterVariables)96 SampleResult (org.apache.jmeter.samplers.SampleResult)35 JMeterContext (org.apache.jmeter.threads.JMeterContext)33 Before (org.junit.Before)33 CompoundVariable (org.apache.jmeter.engine.util.CompoundVariable)17 Test (org.junit.Test)16 JSONPostProcessor (org.apache.jmeter.extractor.json.jsonpath.JSONPostProcessor)8 TestPlan (org.apache.jmeter.testelement.TestPlan)6 HashMap (java.util.HashMap)5 Sampler (org.apache.jmeter.samplers.Sampler)5 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 ValueReplacer (org.apache.jmeter.engine.util.ValueReplacer)4 Properties (java.util.Properties)3 TestSampler (org.apache.jmeter.junit.stubs.TestSampler)3 Logger (org.slf4j.Logger)3 URL (java.net.URL)2 Arguments (org.apache.jmeter.config.Arguments)2 ReplaceStringWithFunctions (org.apache.jmeter.engine.util.ReplaceStringWithFunctions)2 HTTPArgument (org.apache.jmeter.protocol.http.util.HTTPArgument)2