use of org.apache.jmeter.samplers.SampleEvent in project jmeter by apache.
the class TestCSVSaveService method testSample.
@Test
public // if this test fails, check whether the default was intentionally changed or not
void testSample() throws MalformedURLException {
final String RESULT = "1,2,3,4,5,6,7,true,,8,9,10,11,https://jmeter.apache.org,12,13,14";
SampleResult result = new SampleResult();
result.setSaveConfig(new SampleSaveConfiguration());
result.setStampAndTime(1, 2);
result.setSampleLabel("3");
result.setResponseCode("4");
result.setResponseMessage("5");
result.setThreadName("6");
result.setDataType("7");
result.setSuccessful(true);
result.setBytes(8L);
result.setURL(new URL("https://jmeter.apache.org"));
result.setSentBytes(9);
result.setGroupThreads(10);
result.setAllThreads(11);
result.setLatency(12);
result.setIdleTime(13);
result.setConnectTime(14);
assertEquals("Result text has changed", RESULT, CSVSaveService.resultToDelimitedString(new SampleEvent(result, "")));
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter by apache.
the class TestResultAction method testOnFailureStopThread.
@Test
@SuppressWarnings("deprecation")
public void testOnFailureStopThread() {
sampleResult.setSuccessful(false);
resultAction.setErrorAction(ResultAction.ON_ERROR_STOPTHREAD);
resultAction.sampleOccurred(new SampleEvent(sampleResult, "JUnit-TG"));
Assert.assertFalse(sampleResult.isStopTest());
Assert.assertFalse(sampleResult.isStopTestNow());
Assert.assertTrue(sampleResult.isStopThread());
Assert.assertFalse(sampleResult.isStartNextThreadLoop());
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter by apache.
the class TestResultAction method testOnFailureStopTest.
@Test
@SuppressWarnings("deprecation")
public void testOnFailureStopTest() {
sampleResult.setSuccessful(false);
resultAction.setErrorAction(ResultAction.ON_ERROR_STOPTEST);
resultAction.sampleOccurred(new SampleEvent(sampleResult, "JUnit-TG"));
Assert.assertTrue(sampleResult.isStopTest());
Assert.assertFalse(sampleResult.isStopTestNow());
Assert.assertFalse(sampleResult.isStopThread());
Assert.assertFalse(sampleResult.isStartNextThreadLoop());
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter by apache.
the class TestResultAction method testOnFailureStartNextThreadLoop.
@Test
@SuppressWarnings("deprecation")
public void testOnFailureStartNextThreadLoop() {
sampleResult.setSuccessful(false);
resultAction.setErrorAction(ResultAction.ON_ERROR_START_NEXT_THREAD_LOOP);
resultAction.sampleOccurred(new SampleEvent(sampleResult, "JUnit-TG"));
Assert.assertFalse(sampleResult.isStopTest());
Assert.assertFalse(sampleResult.isStopTestNow());
Assert.assertFalse(sampleResult.isStopThread());
Assert.assertTrue(sampleResult.isStartNextThreadLoop());
}
use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.
the class AbstractGraphPanelVisualizerTest method testMinMax_max_only.
@Test
public void testMinMax_max_only() {
CorrectedResultCollector instance = new CorrectedResultCollector();
instance.setEndOffset("20");
instance.testStarted();
DebugVisualizer vis = new DebugVisualizer();
vis.configure(instance);
instance.setListener(vis);
vis.startTimeRef = 10300;
vis.startTimeInf = 10000;
vis.startTimeSup = 11000;
vis.lastLabel = null;
SampleResult res = SampleResult.createTestSample(31500, 32000);
res.setSampleLabel("test");
instance.sampleOccurred(new SampleEvent(res, "tg"));
assertNull(vis.lastLabel);
vis.lastLabel = null;
SampleResult res1 = SampleResult.createTestSample(29000, 30000);
res1.setSampleLabel("test1");
instance.sampleOccurred(new SampleEvent(res1, "tg"));
assertEquals("test1", vis.lastLabel);
instance.testEnded();
instance.setEndOffset("20a");
instance.testStarted();
vis.configure(instance);
instance.setListener(vis);
vis.lastLabel = null;
SampleResult res2 = SampleResult.createTestSample(31000, 32000);
res2.setSampleLabel("test2");
instance.sampleOccurred(new SampleEvent(res2, "tg"));
assertEquals("test2", vis.lastLabel);
}
Aggregations