use of org.apache.jmeter.samplers.SampleResult in project jmeter-plugins by undera.
the class IsDefinedTest method testExecute.
@Test
public void testExecute() throws Exception {
System.out.println("execute 1");
SampleResult previousResult = null;
Sampler currentSampler = null;
Collection<CompoundVariable> parameters = new ArrayList<CompoundVariable>();
parameters.add(new CompoundVariable("var_to_be_defined1"));
IsDefined instance = new IsDefined();
instance.setParameters(parameters);
String expResult = "0";
String result = instance.execute(previousResult, currentSampler);
Assert.assertEquals(expResult, result);
}
use of org.apache.jmeter.samplers.SampleResult in project jmeter-plugins by undera.
the class LowerCaseTest method testExecute.
/**
* Test of execute method, of class LowerCase.
*/
@Test
public void testExecute() throws Exception {
System.out.println("execute");
Collection<CompoundVariable> parameters = new ArrayList<CompoundVariable>();
parameters.add(new CompoundVariable("ABC"));
parameters.add(new CompoundVariable("var"));
SampleResult previousResult = null;
Sampler currentSampler = null;
LowerCase instance = new LowerCase();
instance.setParameters(parameters);
String expResult = "abc";
String result = instance.execute(previousResult, currentSampler);
Assert.assertEquals(expResult, result);
Assert.assertEquals(expResult, JMeterContextService.getContext().getVariables().get("var"));
}
use of org.apache.jmeter.samplers.SampleResult in project jmeter-plugins by undera.
the class MD5Test method testExecute.
/**
* Test of execute method, of class MD5.
*/
@Test
public void testExecute() throws Exception {
System.out.println("execute");
Collection<CompoundVariable> parameters = new ArrayList<CompoundVariable>();
parameters.add(new CompoundVariable("public void testExecute() throws Exception {}"));
parameters.add(new CompoundVariable("var"));
SampleResult previousResult = null;
Sampler currentSampler = null;
MD5 instance = new MD5();
instance.setParameters(parameters);
String expResult = "cb5b1ca8504cb5a7772f219109e05ccf";
String result = instance.execute(previousResult, currentSampler);
Assert.assertEquals(expResult, result);
Assert.assertEquals(expResult, JMeterContextService.getContext().getVariables().get("var"));
}
use of org.apache.jmeter.samplers.SampleResult in project jmeter-plugins by undera.
the class ThroughputVsThreadsGuiTest method testAdd.
/**
* Test of add method, of class ThroughputVsThreadsGui.
*/
@Test
public void testAdd() {
System.out.println("add");
ThroughputVsThreadsGui instance = new ThroughputVsThreadsGui();
instance.add(new SampleResult());
instance.add(new SampleResult(0, 100));
instance.add(new SampleResult(0, 100));
}
use of org.apache.jmeter.samplers.SampleResult in project jmeter-plugins by undera.
the class ConsoleStatusLogger method sampleOccurred.
@Override
public synchronized void sampleOccurred(SampleEvent se) {
// TODO: make the interval configurable
long sec = System.currentTimeMillis() / 1000;
if (sec != cur && count > 0) {
if (cur == 0) {
begin = sec;
}
log.debug(cur + " " + begin);
flush(sec - begin);
cur = sec;
}
SampleResult res = se.getResult();
count++;
sumRTime += res.getTime();
sumLatency += res.getLatency();
errors += res.isSuccessful() ? 0 : 1;
threads = res.getAllThreads();
}
Aggregations