Search in sources :

Example 91 with JMeterVariables

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

the class DurationAssertionTest method setUp.

@Before
public void setUp() {
    JMeterContext jmctx = JMeterContextService.getContext();
    assertion = new DurationAssertion();
    assertion.setThreadContext(jmctx);
    JMeterVariables vars = new JMeterVariables();
    jmctx.setVariables(vars);
    sampleResult = new SampleResult();
    sampleResult.setResponseData(data, null);
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables) JMeterContext(org.apache.jmeter.threads.JMeterContext) SampleResult(org.apache.jmeter.samplers.SampleResult) Before(org.junit.Before)

Example 92 with JMeterVariables

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

the class ResponseAssertionTest method setUp.

@Before
public void setUp() throws MalformedURLException {
    JMeterContext jmctx = JMeterContextService.getContext();
    assertion = new ResponseAssertion();
    assertion.setThreadContext(jmctx);
    sample = new SampleResult();
    JMeterVariables vars = new JMeterVariables();
    jmctx.setVariables(vars);
    jmctx.setPreviousResult(sample);
    sample.setResponseData("response Data\nline 2\n\nEOF", null);
    sample.setURL(new URL("http://localhost/Sampler/Data/"));
    sample.setResponseCode("401");
    sample.setResponseHeaders("X-Header: abcd");
    sample.setRequestHeaders("X-reqHeader: cdef");
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables) JMeterContext(org.apache.jmeter.threads.JMeterContext) SampleResult(org.apache.jmeter.samplers.SampleResult) URL(java.net.URL) Before(org.junit.Before)

Example 93 with JMeterVariables

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

the class SizeAssertionTest method setUp.

@Before
public void setUp() {
    JMeterContext jmctx = JMeterContextService.getContext();
    assertion = new SizeAssertion();
    assertion.setThreadContext(jmctx);
    assertion.setTestFieldResponseBody();
    JMeterVariables vars = new JMeterVariables();
    jmctx.setVariables(vars);
    sample0 = new SampleResult();
    sample1 = new SampleResult();
    sample1.setResponseData(data1, null);
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables) JMeterContext(org.apache.jmeter.threads.JMeterContext) SampleResult(org.apache.jmeter.samplers.SampleResult) Before(org.junit.Before)

Example 94 with JMeterVariables

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

the class TestRandomVariableConfig method setUp.

@Before
public void setUp() {
    JMeterContext jmcx = JMeterContextService.getContext();
    jmcx.setVariables(new JMeterVariables());
    threadVars = jmcx.getVariables();
    config.setRandomSeed("abcd");
    config.setVariableName("randomVar");
}
Also used : JMeterVariables(org.apache.jmeter.threads.JMeterVariables) JMeterContext(org.apache.jmeter.threads.JMeterContext) Before(org.junit.Before)

Example 95 with JMeterVariables

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

the class XPathAssertionTest method setUp.

@Before
public void setUp() throws Exception {
    jmctx = JMeterContextService.getContext();
    assertion = new XPathAssertion();
    // This would be done by the run command
    assertion.setThreadContext(jmctx);
    result = new SampleResult();
    result.setResponseData(readFile("testfiles/XPathAssertionTest.xml"));
    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)

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