Search in sources :

Example 51 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class ConsoleStatusLoggerTest method testSampleStopped.

/**
 * Test of sampleStopped method, of class ConsoleStatusLogger.
 */
@Test
public void testSampleStopped() {
    System.out.println("sampleStopped");
    SampleEvent se = null;
    ConsoleStatusLogger instance = new ConsoleStatusLogger();
    instance.sampleStopped(se);
}
Also used : SampleEvent(org.apache.jmeter.samplers.SampleEvent)

Example 52 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class ConsoleStatusLoggerTest method testSampleStarted.

/**
 * Test of sampleStarted method, of class ConsoleStatusLogger.
 */
@Test
public void testSampleStarted() {
    System.out.println("sampleStarted");
    SampleEvent se = null;
    ConsoleStatusLogger instance = new ConsoleStatusLogger();
    instance.sampleStarted(se);
}
Also used : SampleEvent(org.apache.jmeter.samplers.SampleEvent)

Example 53 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class FlexibleFileWriterTest method testSampleOccurred_null.

@Test
public void testSampleOccurred_null() throws IOException {
    System.out.println("sampleOccurred null");
    SampleResult res = new SampleResult();
    // res.setResponseData("test".getBytes());
    SampleEvent e = new SampleEvent(res, "Test");
    FlexibleFileWriter instance = new FlexibleFileWriter();
    instance.setColumns(FlexibleFileWriter.AVAILABLE_FIELDS.replace(' ', '|'));
    String tmpFile = File.createTempFile("ffw_test_", ".txt").getAbsolutePath();
    instance.setFilename(tmpFile);
    instance.testStarted();
    for (int n = 0; n < 10; n++) {
        res.sampleStart();
        res.sampleEnd();
        instance.sampleOccurred(e);
    }
    instance.testEnded();
    assertTrue(tmpFile.length() > 0);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) SampleEvent(org.apache.jmeter.samplers.SampleEvent) Test(org.junit.Test)

Example 54 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class FlexibleFileWriterTest method testSampleOccurred_phout.

@Test
public void testSampleOccurred_phout() throws IOException {
    System.out.println("sampleOccurred_phout");
    SampleResult res = new SampleResult();
    res.sampleStart();
    res.setResponseData("test".getBytes());
    res.setResponseCode("200");
    res.setLatency(4);
    res.setSuccessful(true);
    res.sampleEnd();
    SampleEvent e = new SampleEvent(res, "Test");
    FlexibleFileWriter instance = new FlexibleFileWriter();
    instance.setFilename(File.createTempFile("ffw_test_", ".txt").getAbsolutePath());
    instance.setColumns("endTimeMillis|\\t\\t|responseTimeMicros|\\t|latencyMicros|\\t|sentBytes|\\t|receivedBytes|\\t|isSuccsessful|\\t|responseCode|\\t|connectTime|\\r\\n");
    instance.testStarted();
    instance.sampleOccurred(e);
    // String written = JMeterPluginsUtils.byteBufferToString(instance.fileEmul.getWrittenBytes());
    // System.out.println(written);
    // assertEquals(8, written.split("\t").length);
    instance.testEnded();
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) SampleEvent(org.apache.jmeter.samplers.SampleEvent) Test(org.junit.Test)

Example 55 with SampleEvent

use of org.apache.jmeter.samplers.SampleEvent in project jmeter-plugins by undera.

the class DbMonCollectorTest method testDbMonSampleOccurred.

/**
 * Test of dbMonSampleOccurred method, of class DbMonCollector.
 */
@Test
public void testDbMonSampleOccurred() {
    System.out.println("dbMonSampleOccurred");
    SampleEvent event = new SampleEvent(new SampleResult(), "test");
    DbMonCollector instance = new DbMonCollector();
    instance.dbMonSampleOccurred(event);
// TODO review the generated test code and remove the default call to fail.
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) SampleEvent(org.apache.jmeter.samplers.SampleEvent)

Aggregations

SampleEvent (org.apache.jmeter.samplers.SampleEvent)58 SampleResult (org.apache.jmeter.samplers.SampleResult)30 Test (org.junit.Test)17 CorrectedResultCollector (kg.apc.jmeter.vizualizers.CorrectedResultCollector)12 Test (org.junit.jupiter.api.Test)10 File (java.io.File)5 JMeterSerialTest (org.apache.jorphan.test.JMeterSerialTest)4 SampleSaveConfiguration (org.apache.jmeter.samplers.SampleSaveConfiguration)3 JMeterVariables (org.apache.jmeter.threads.JMeterVariables)3 IOException (java.io.IOException)2 ResultCollector (org.apache.jmeter.reporters.ResultCollector)2 StatisticalSampleResult (org.apache.jmeter.samplers.StatisticalSampleResult)2 ArrivalsThreadGroupTest (com.blazemeter.jmeter.threads.arrivals.ArrivalsThreadGroupTest)1 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1