Search in sources :

Example 41 with SampleResult

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

the class FifoPutTest method testExecute.

@Test
public void testExecute() throws Exception {
    System.out.println("execute");
    SampleResult previousResult = null;
    Sampler currentSampler = null;
    FifoPut instance = new FifoPut();
    String expResult = "FifoPuttest";
    LinkedList<CompoundVariable> list = new LinkedList<>();
    list.add(new CompoundVariable("FifoPuttest"));
    list.add(new CompoundVariable("FifoPuttest"));
    instance.setParameters(list);
    String result = instance.execute(null, null);
    Assert.assertEquals(expResult, result);
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) Sampler(org.apache.jmeter.samplers.Sampler) SampleResult(org.apache.jmeter.samplers.SampleResult) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 42 with SampleResult

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

the class FifoSizeTest method testExecute.

/**
 * Test of execute method, of class FifoSize.
 */
@Test
public void testExecute() throws Exception {
    System.out.println("execute");
    SampleResult previousResult = null;
    Sampler currentSampler = null;
    LinkedList<CompoundVariable> list;
    list = new LinkedList<>();
    list.add(new CompoundVariable("test"));
    list.add(new CompoundVariable("test"));
    FifoSize instance = new FifoSize();
    instance.setParameters(list);
    String expResult = "0";
    String result = instance.execute(null, null);
    Assert.assertEquals(expResult, result);
}
Also used : CompoundVariable(org.apache.jmeter.engine.util.CompoundVariable) Sampler(org.apache.jmeter.samplers.Sampler) SampleResult(org.apache.jmeter.samplers.SampleResult)

Example 43 with SampleResult

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

the class AggregateReportGuiTest method testAdd.

/**
 * Test of add method, of class StatVisualizerAccessorGui.
 */
@Test
public void testAdd() throws IOException {
    System.out.println("add");
    AggregateReportGui instance = new AggregateReportGui();
    SampleResult res = new SampleResult();
    instance.add(res);
    SampleResult res2 = new SampleResult();
    instance.add(res2);
    ResultCollector rc = new ResultCollector();
    rc.setListener(instance);
    rc.sampleOccurred(new SampleEvent(res, ""));
    rc.sampleOccurred(new SampleEvent(res2, ""));
    File f = File.createTempFile("test", ".csv");
    instance.getGraphPanelChart().saveGraphToCSV(f);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) ResultCollector(org.apache.jmeter.reporters.ResultCollector) File(java.io.File) SampleEvent(org.apache.jmeter.samplers.SampleEvent) Test(org.junit.Test)

Example 44 with SampleResult

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

the class SynthesisReportGuiTest method testAdd.

/**
 * Test of add method, of class SynthesisReportGui.
 */
@Test
public void testAdd() throws IOException {
    System.out.println("add");
    SynthesisReportGui instance = new SynthesisReportGui();
    SampleResult res = new SampleResult();
    instance.add(res);
    SampleResult res2 = new SampleResult();
    instance.add(res2);
    ResultCollector rc = new ResultCollector();
    rc.setListener(instance);
    rc.sampleOccurred(new SampleEvent(res, ""));
    rc.sampleOccurred(new SampleEvent(res2, ""));
    File f = File.createTempFile("test", ".csv");
    instance.getGraphPanelChart().saveGraphToCSV(f);
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) ResultCollector(org.apache.jmeter.reporters.ResultCollector) File(java.io.File) SampleEvent(org.apache.jmeter.samplers.SampleEvent) Test(org.junit.Test)

Example 45 with SampleResult

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

the class WebDriverSamplerTest method shouldReturnFailureSampleResultWhenScriptSetsSampleResultToFailure.

@Test
public void shouldReturnFailureSampleResultWhenScriptSetsSampleResultToFailure() throws MalformedURLException {
    sampler.setScript("WDS.sampleResult.setSuccessful(false);");
    final SampleResult sampleResult = sampler.sample(null);
    assertThat(sampleResult.isSuccessful(), is(false));
    assertThat(sampleResult.getResponseCode(), is("500"));
    assertThat(sampleResult.getResponseMessage(), not("OK"));
    assertThat(sampleResult.getResponseDataAsString(), is("page source"));
    assertThat(sampleResult.getURL(), is(new URL("http://google.com.au")));
    verify(browser, times(1)).getPageSource();
    verify(browser, times(1)).getCurrentUrl();
}
Also used : SampleResult(org.apache.jmeter.samplers.SampleResult) URL(java.net.URL) Test(org.junit.Test)

Aggregations

SampleResult (org.apache.jmeter.samplers.SampleResult)381 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