Search in sources :

Example 56 with SampleResult

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

the class UDPSamplerTest method testReal.

// @Test
public void testReal() {
    System.out.println("real");
    instance = new UDPSampler();
    instance.setHostName("8.8.8.8");
    instance.setPort("53");
    instance.setRequestData("f11b0100000100000000000004636f646506676f6f676c6503636f6d00001c0001");
    instance.setEncoderClass(HexStringUDPDecoder.class.getCanonicalName());
    instance.threadStarted();
    instance.setWaitResponse(true);
    instance.setTimeout("500");
    SampleResult res = instance.sample(null);
    assertTrue(res.isSuccessful());
    assertTrue(res.getResponseDataAsString().length() > 0);
    SampleResult res2 = instance.sample(null);
    assertTrue(res2.isSuccessful());
    assertTrue(res2.getResponseDataAsString().length() > 0);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult)

Example 57 with SampleResult

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

the class PerfMonSampleResultTest method testGetValue_SampleResult.

/**
 * Test of getValue method, of class PerfMonSampleResult.
 */
@Test
public void testGetValue_SampleResult() {
    System.out.println("getValue");
    SampleResult res = new SampleResult(1000000, 123 * 1000);
    double expResult = 123;
    double result = PerfMonSampleResult.getValue(res);
    assertEquals(expResult, result, 0.0);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) Test(org.junit.Test)

Example 58 with SampleResult

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

the class ThreadsStateOverTimeGuiTest method testAdd.

/**
 * Test of add method, of class ThreadsStateOverTimeGui.
 */
@Test
public void testAdd() {
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.sampleStart();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    res.sampleEnd();
    instance.add(res);
    try {
        Thread.sleep(2000);
    } catch (InterruptedException ex) {
        Logger.getLogger(ThreadsStateOverTimeGuiTest.class.getName()).log(Level.SEVERE, null, ex);
    }
    SampleResult res2 = new SampleResult(res);
    res2.setAllThreads(1);
    res2.setThreadName("test 1-2");
    instance.add(res);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) Test(org.junit.Test)

Example 59 with SampleResult

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

the class ConnectTimesOverTimeGuiTest method testAdd.

@Test
public void testAdd() {
    ConnectTimesOverTimeGui obj = new ConnectTimesOverTimeGui();
    SampleResult res = new SampleResult();
    obj.add(res);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) Test(org.junit.Test)

Example 60 with SampleResult

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

the class HitsPerSecondGuiTest method testAdd_issue48.

@Test
public void testAdd_issue48() {
    System.out.println("add48");
    SampleResult res = new SampleResult();
    res.setAllThreads(0);
    res.setThreadName("test 1-2");
    res.setResponseMessage(null);
    SampleResult subres = new SampleResult();
    subres.sampleStart();
    subres.sampleEnd();
    res.sampleStart();
    res.addSubResult(subres);
    try {
        Thread.sleep(10);
    } catch (InterruptedException ex) {
    }
    HitsPerSecondGui instance = new HitsPerSecondGui();
    instance.add(res);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) Test(org.junit.Test)

Aggregations

SampleResult (org.apache.jmeter.samplers.SampleResult)379 Test (org.junit.Test)83 JMeterVariables (org.apache.jmeter.threads.JMeterVariables)71 Test (org.junit.jupiter.api.Test)59 JMeterContext (org.apache.jmeter.threads.JMeterContext)47 BeforeEach (org.junit.jupiter.api.BeforeEach)36 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)34 SampleEvent (org.apache.jmeter.samplers.SampleEvent)30 Sampler (org.apache.jmeter.samplers.Sampler)30 AssertionResult (org.apache.jmeter.assertions.AssertionResult)27 ArrayList (java.util.ArrayList)26 CompoundVariable (org.apache.jmeter.engine.util.CompoundVariable)20 HTTPSamplerBase (org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase)20 IOException (java.io.IOException)17 Arguments (org.apache.jmeter.config.Arguments)16 MethodSource (org.junit.jupiter.params.provider.MethodSource)13 CorrectedResultCollector (kg.apc.jmeter.vizualizers.CorrectedResultCollector)12 URL (java.net.URL)9 File (java.io.File)8 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7