Search in sources :

Example 6 with SampleResult

use of org.apache.jmeter.samplers.SampleResult in project jmeter by apache.

the class ViewResultsFullVisualizer method valueChanged.

/** {@inheritDoc} */
@Override
public void valueChanged(TreeSelectionEvent e) {
    lastSelectionEvent = e;
    DefaultMutableTreeNode node;
    synchronized (this) {
        node = (DefaultMutableTreeNode) jTree.getLastSelectedPathComponent();
    }
    if (node != null) {
        // to restore last tab used
        if (rightSide.getTabCount() > selectedTab) {
            resultsRender.setLastSelectedTab(rightSide.getSelectedIndex());
        }
        Object userObject = node.getUserObject();
        resultsRender.setSamplerResult(userObject);
        // Processes Assertions
        resultsRender.setupTabPane();
        // display a SampleResult
        if (userObject instanceof SampleResult) {
            SampleResult sampleResult = (SampleResult) userObject;
            if (isTextDataType(sampleResult)) {
                resultsRender.renderResult(sampleResult);
            } else {
                byte[] responseBytes = sampleResult.getResponseData();
                if (responseBytes != null) {
                    resultsRender.renderImage(sampleResult);
                }
            }
        }
    }
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) SampleResult(org.apache.jmeter.samplers.SampleResult)

Example 7 with SampleResult

use of org.apache.jmeter.samplers.SampleResult in project jmeter by apache.

the class AbstractScopedTestElement method getSampleList.

/**
     * Generate a list of qualifying sample results,
     * depending on the scope.
     *
     * @param result current sample
     * @return list containing the current sample and/or its child samples
     */
protected List<SampleResult> getSampleList(SampleResult result) {
    List<SampleResult> sampleList = new ArrayList<>();
    String scope = fetchScope();
    if (isScopeParent(scope) || isScopeAll(scope)) {
        sampleList.add(result);
    }
    if (isScopeChildren(scope) || isScopeAll(scope)) {
        for (SampleResult subResult : result.getSubResults()) {
            sampleList.add(subResult);
        }
    }
    return sampleList;
}
Also used : ArrayList(java.util.ArrayList) SampleResult(org.apache.jmeter.samplers.SampleResult)

Example 8 with SampleResult

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

the class JSONToXMLConverterTest method testSample.

/**
 * Test of sample method, of class JSONToXMLConverter.
 */
@Test
public void testSample() {
    System.out.println("sample");
    Entry e = null;
    JSONToXMLConverter instance = new JSONToXMLConverter();
    SampleResult expResult = null;
    SampleResult result = instance.sample(e);
}
Also used : Entry(org.apache.jmeter.samplers.Entry) SampleResult(org.apache.jmeter.samplers.SampleResult) Test(org.junit.Test)

Example 9 with SampleResult

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

the class JSONFormatterTest method testProcess_float.

@Test
public void testProcess_float() {
    System.out.println("process float");
    JSONFormatter instance = new JSONFormatter();
    JMeterContext threadContext = JMeterContextService.getContext();
    SampleResult res = new SampleResult();
    res.setResponseData("3.14", "UTF8");
    threadContext.setPreviousResult(res);
    instance.process();
}
Also used : JMeterContext(org.apache.jmeter.threads.JMeterContext) SampleResult(org.apache.jmeter.samplers.SampleResult) Test(org.junit.Test)

Example 10 with SampleResult

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

the class JSONFormatterTest method testProcess_array.

@Test
public void testProcess_array() {
    System.out.println("process array");
    JSONFormatter instance = new JSONFormatter();
    JMeterContext threadContext = JMeterContextService.getContext();
    SampleResult res = new SampleResult();
    res.setResponseData("[]", "UTF8");
    threadContext.setPreviousResult(res);
    instance.process();
}
Also used : JMeterContext(org.apache.jmeter.threads.JMeterContext) SampleResult(org.apache.jmeter.samplers.SampleResult) 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