JMeter Test for Secured Proxy Service - Using Banshee Scripts

WSO2 ESB is a popular Mediation Bus for middleware messaging in any organization. WSO2 ESB server can expose a plain SOAP service with QOS applied (security, throttling, monitoring etc). Security is one of them which is very important.

Here, the idea is exposing the plain SOAP service as a proxy service and apply security for the proxy service. Following are options WSO2 ESB provides to secure a service.


  • UsernameToken
  • Non-repudiation
  • Integrity
  • Confidentiality
In this post I am referring to a proxy service secured by Username Token. 

When come to load testing this proxy, you cannot send the same SOAP message again and again to the secured proxy. Apache Rampart  which is the underlying security implementation, detect this as a vulnerability if you do so. You need to change these four things per message. 

  • <wsu:Created>
  • <wsu:Expires>
  • <wsse:Nonce EncodingType>
  • <wsu:Created> (UTC Time)

Creating a proxy service and applying security 


Let's first create a proxy service in WSO2 ESB. Refer this document  for more details. To apply security, in the Management Console, go to Services >> List and click on the proxy service you created.  On QOS Configuration, click on security. 


Choose "Enable Security?" as Yes and select Username Token. 


Now your proxy service is secured with WS security applied. Easy enough!!. 
This is the source code of my proxy. 

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="securedTestProxy1"
       transports="https"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="full"/>
         <respond/>
      </inSequence>
   </target>
   <parameter name="ScenarioID">scenario1</parameter>
   <enableSec/>
   <policy key="conf:/repository/axis2/service-groups/securedTestProxy1/services/securedTestProxy1/policies/UTOverTransport"/>
   <description/>
</proxy>
                                

Creating a JMeter SOAP project


Now let us see how to invoke this service using JMeter. You can download Apache JMeter from here. Go to <JMeter_Home>/bin and run

sh jmeter.sh

In the JMeter console choose File >> Templates and choose as below.


Now Build you test, changing SOAP request, invocation path, http headers, assertions etc. 
Now to find the correct SOAP request to be sent you can use ESB itself. As soon as message comes into ESB in-sequence, use log mediator to log the message. 


Parameterizing SOAP request


Now we want to parameterize the SOAP request. In order to do that, we use BeanShell Preprocessor Script. We need to put what is to be parameterized in the SOAP body as below. 

<wsu:Created>${#timeC#}</wsu:Created>
            <wsu:Expires>${#timeE#}</wsu:Expires>


Thus, following is my parameterized SOAP message. 

<soapenv:Envelope xmlns:ser="http://services.samples" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://services.samples/xsd">
<soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsu:Timestamp wsu:Id="TS-05CB7D74E166EF0AB614268666650771109">
            <wsu:Created>${#timeC#}</wsu:Created>
            <wsu:Expires>${#timeE#}</wsu:Expires>
        </wsu:Timestamp>
        <wsse:UsernameToken wsu:Id="UsernameToken-05CB7D74E166EF0AB614268666650771108">
            <wsse:Username>chanaka</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">chanaka</wsse:Password>
            <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">${#nonce#}</wsse:Nonce>
            <wsu:Created>${#UTtimeC#}</wsu:Created>
        </wsse:UsernameToken>
    </wsse:Security>
</soapenv:Header>
<soapenv:Body>
    <ser:getQuote>
        <!--Optional:-->
        <ser:request>
            <!--Optional:-->
            <xsd:symbol>IBM</xsd:symbol>
        </ser:request>
    </ser:getQuote>
</soapenv:Body>
</soapenv:Envelope>


Special thing should be noted here. This XML should be formatted very accurately without additional spaces and line breaks, specially on username and password tags. Keep one xml element to a single line. 

Now Beanshell script can be written like this. It is like Java.

import org.apache.jmeter.protocol.http.sampler.WebServiceSampler;
import org.apache.jmeter.protocol.http.sampler.SoapSampler;
import org.jboss.ws.extensions.security.nonce.DefaultNonceGenerator; //(jbossws­core.jar)
import org.jboss.util.Base64; //this class is called inside the DefaultNonceGenerator class (jboss­common.jar)
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

//generating NONCE
DefaultNonceGenerator nonce_Gen = new DefaultNonceGenerator();
String nonce = nonce_Gen.generateNonce();
//generating relevant Timestamps
long ctmilli = System.currentTimeMillis(); // current time in milliseconds
SimpleDateFormat dformat1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");    // timestamp format with nonce
SimpleDateFormat dformat2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");  //timestamp format for usernametoken, with miliseconds
Date dtime = new Date();
dformat1.setTimeZone(TimeZone.getTimeZone("UTC"));
dtime.setTime(ctmilli);  // current time
String timeCreated = dformat1.format(dtime); // timestamp created in format1
String uttimeCreated = dformat2.format(dtime); // timestamp created in format2
dtime.setTime(ctmilli+2000); // setting the timeout  for 2seconds, change the timeout as required
String timeExpire = dformat1.format(dtime);  // expiration timestamp in format1
vars.put("#timeC#",timeCreated);
vars.put("#timeE#",timeExpire);
vars.put("#nonce#",nonce);
vars.put("#UTtimeC#",uttimeCreated);

Note how the parameters are replaced by generated values. Ultimately, JMeter project structure should look like this.



Generated .jmx file


Following is my .jmx file. 

<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.8" jmeter="2.13 r1665067">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
    </TestPlan>
    <hashTree>
      <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments">
          <elementProp name="host" elementType="Argument">
            <stringProp name="Argument.name">host</stringProp>
            <stringProp name="Argument.value">wsf.cdyne.com</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
            <stringProp name="Argument.desc">Host of Webservice</stringProp>
          </elementProp>
        </collectionProp>
      </Arguments>
      <hashTree/>
      <ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="HTTP Request Defaults" enabled="true">
        <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
          <collectionProp name="Arguments.arguments">
            <elementProp name="Accept-Encoding" elementType="HTTPArgument">
              <boolProp name="HTTPArgument.always_encode">false</boolProp>
              <stringProp name="Argument.value">gzip,deflate</stringProp>
              <stringProp name="Argument.metadata">=</stringProp>
              <boolProp name="HTTPArgument.use_equals">true</boolProp>
              <stringProp name="Argument.name">Accept-Encoding</stringProp>
            </elementProp>
          </collectionProp>
        </elementProp>
        <stringProp name="HTTPSampler.domain">127.0.0.1</stringProp>
        <stringProp name="HTTPSampler.port">8243</stringProp>
        <stringProp name="HTTPSampler.connect_timeout"></stringProp>
        <stringProp name="HTTPSampler.response_timeout"></stringProp>
        <stringProp name="HTTPSampler.protocol">https</stringProp>
        <stringProp name="HTTPSampler.contentEncoding"></stringProp>
        <stringProp name="HTTPSampler.path">/services/StockQuoteSecure.StockQuoteSecureHttpsSoap11Endpoint</stringProp>
        <stringProp name="HTTPSampler.concurrentPool">4</stringProp>
      </ConfigTestElement>
      <hashTree/>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Number of Users" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">0</stringProp>
        <longProp name="ThreadGroup.start_time">1375525852000</longProp>
        <longProp name="ThreadGroup.end_time">1375525852000</longProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Soap Request" enabled="true">
          <boolProp name="HTTPSampler.postBodyRaw">true</boolProp>
          <elementProp name="HTTPsampler.Arguments" elementType="Arguments">
            <collectionProp name="Arguments.arguments">
              <elementProp name="" elementType="HTTPArgument">
                <boolProp name="HTTPArgument.always_encode">false</boolProp>
                <stringProp name="Argument.value">&lt;soapenv:Envelope xmlns:ser=&quot;http://services.samples&quot; xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xsd=&quot;http://services.samples/xsd&quot;&gt;&#xd;
&lt;soapenv:Header&gt;&#xd;
    &lt;wsse:Security soapenv:mustUnderstand=&quot;1&quot; xmlns:wsse=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd&quot; xmlns:wsu=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;&gt;&#xd;
        &lt;wsu:Timestamp wsu:Id=&quot;TS-05CB7D74E166EF0AB614268666650771109&quot;&gt;&#xd;
            &lt;wsu:Created&gt;${#timeC#}&lt;/wsu:Created&gt;&#xd;
            &lt;wsu:Expires&gt;${#timeE#}&lt;/wsu:Expires&gt;&#xd;
        &lt;/wsu:Timestamp&gt;&#xd;
        &lt;wsse:UsernameToken wsu:Id=&quot;UsernameToken-05CB7D74E166EF0AB614268666650771108&quot;&gt;&#xd;
            &lt;wsse:Username&gt;chanaka&lt;/wsse:Username&gt;&#xd;
            &lt;wsse:Password Type=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText&quot;&gt;chanaka&lt;/wsse:Password&gt;&#xd;
            &lt;wsse:Nonce EncodingType=&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary&quot;&gt;${#nonce#}&lt;/wsse:Nonce&gt;&#xd;
            &lt;wsu:Created&gt;${#UTtimeC#}&lt;/wsu:Created&gt;&#xd;
        &lt;/wsse:UsernameToken&gt;&#xd;
    &lt;/wsse:Security&gt;&#xd;
&lt;/soapenv:Header&gt;&#xd;
&lt;soapenv:Body&gt;&#xd;
    &lt;ser:getQuote&gt;&#xd;
        &lt;!--Optional:--&gt;&#xd;
        &lt;ser:request&gt;&#xd;
            &lt;!--Optional:--&gt;&#xd;
            &lt;xsd:symbol&gt;IBM&lt;/xsd:symbol&gt;&#xd;
        &lt;/ser:request&gt;&#xd;
    &lt;/ser:getQuote&gt;&#xd;
&lt;/soapenv:Body&gt;&#xd;
&lt;/soapenv:Envelope&gt;</stringProp>
                <stringProp name="Argument.metadata">=</stringProp>
              </elementProp>
            </collectionProp>
          </elementProp>
          <stringProp name="HTTPSampler.domain">127.0.0.1</stringProp>
          <stringProp name="HTTPSampler.port">8243</stringProp>
          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
          <stringProp name="HTTPSampler.response_timeout"></stringProp>
          <stringProp name="HTTPSampler.protocol">https</stringProp>
          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
          <stringProp name="HTTPSampler.path">/services/securedTestProxy1</stringProp>
          <stringProp name="HTTPSampler.method">POST</stringProp>
          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
          <stringProp name="HTTPSampler.implementation">Java</stringProp>
          <boolProp name="HTTPSampler.monitor">false</boolProp>
          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
        </HTTPSamplerProxy>
        <hashTree>
          <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
            <collectionProp name="HeaderManager.headers">
              <elementProp name="" elementType="Header">
                <stringProp name="Header.name">Content-Type</stringProp>
                <stringProp name="Header.value">text/xml; charset=utf-8</stringProp>
              </elementProp>
              <elementProp name="" elementType="Header">
                <stringProp name="Header.name">SOAPAction</stringProp>
                <stringProp name="Header.value">urn:mediate</stringProp>
              </elementProp>
            </collectionProp>
          </HeaderManager>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="1638474297">&lt;xsd:symbol&gt;</stringProp>
              <stringProp name="0"></stringProp>
            </collectionProp>
            <stringProp name="TestPlan.comments">Verify content in response</stringProp>
            <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
            <boolProp name="Assertion.assume_success">false</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
        <BeanShellPreProcessor guiclass="TestBeanGUI" testclass="BeanShellPreProcessor" testname="BeanShell PreProcessor" enabled="true">
          <stringProp name="filename"></stringProp>
          <stringProp name="parameters"></stringProp>
          <boolProp name="resetInterpreter">false</boolProp>
          <stringProp name="script">import org.apache.jmeter.protocol.http.sampler.WebServiceSampler;
import org.apache.jmeter.protocol.http.sampler.SoapSampler;
import org.jboss.ws.extensions.security.nonce.DefaultNonceGenerator; //(jbossws­core.jar)
import org.jboss.util.Base64; //this class is called inside the DefaultNonceGenerator class (jboss­common.jar)
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

//generating NONCE
DefaultNonceGenerator nonce_Gen = new DefaultNonceGenerator();
String nonce = nonce_Gen.generateNonce();
//generating relevant Timestamps
long ctmilli = System.currentTimeMillis(); // current time in milliseconds
SimpleDateFormat dformat1 = new SimpleDateFormat(&quot;yyyy-MM-dd&apos;T&apos;HH:mm:ss&apos;Z&apos;&quot;);    // timestamp format with nonce
SimpleDateFormat dformat2 = new SimpleDateFormat(&quot;yyyy-MM-dd&apos;T&apos;HH:mm:ss.SSS&apos;Z&apos;&quot;);  //timestamp format for usernametoken, with miliseconds
Date dtime = new Date();
dformat1.setTimeZone(TimeZone.getTimeZone(&quot;UTC&quot;));
dtime.setTime(ctmilli);  // current time
String timeCreated = dformat1.format(dtime); // timestamp created in format1
String uttimeCreated = dformat2.format(dtime); // timestamp created in format2
dtime.setTime(ctmilli+2000); // setting the timeout  for 2seconds, change the timeout as required
String timeExpire = dformat1.format(dtime);  // expiration timestamp in format1
vars.put(&quot;#timeC#&quot;,timeCreated);
vars.put(&quot;#timeE#&quot;,timeExpire);
vars.put(&quot;#nonce#&quot;,nonce);
vars.put(&quot;#UTtimeC#&quot;,uttimeCreated);</stringProp>
        </BeanShellPreProcessor>
        <hashTree/>
      </hashTree>
      <ResultCollector guiclass="StatGraphVisualizer" testclass="ResultCollector" testname="Aggregate Graph" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>false</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>false</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>true</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>true</responseDataOnError>
            <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
            <hostname>true</hostname>
            <threadCounts>true</threadCounts>
            <sampleCount>true</sampleCount>
          </value>
        </objProp>
        <stringProp name="filename">/work/jmeter_workplace/secureProxyTestResults</stringProp>
      </ResultCollector>
      <hashTree/>
      <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
            <threadCounts>true</threadCounts>
          </value>
        </objProp>
        <stringProp name="filename"></stringProp>
      </ResultCollector>
      <hashTree/>
      <ResultCollector guiclass="kg.apc.jmeter.vizualizers.LatenciesOverTimeGui" testclass="ResultCollector" testname="jp@gc - Response Latencies Over Time" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
            <threadCounts>true</threadCounts>
          </value>
        </objProp>
        <stringProp name="filename"></stringProp>
        <longProp name="interval_grouping">500</longProp>
        <boolProp name="graph_aggregated">false</boolProp>
      </ResultCollector>
      <hashTree/>
      <ResultCollector guiclass="kg.apc.jmeter.vizualizers.TimesVsThreadsGui" testclass="ResultCollector" testname="jp@gc - Response Times vs Threads" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
            <threadCounts>true</threadCounts>
          </value>
        </objProp>
        <stringProp name="filename"></stringProp>
        <longProp name="interval_grouping">500</longProp>
        <boolProp name="graph_aggregated">false</boolProp>
      </ResultCollector>
      <hashTree/>
      <ResultCollector guiclass="kg.apc.jmeter.vizualizers.TransactionsPerSecondGui" testclass="ResultCollector" testname="jp@gc - Transactions per Second" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
            <threadCounts>true</threadCounts>
          </value>
        </objProp>
        <stringProp name="filename"></stringProp>
        <longProp name="interval_grouping">1000</longProp>
        <boolProp name="graph_aggregated">false</boolProp>
      </ResultCollector>
      <hashTree/>
      <ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="Aggregate Report" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
            <threadCounts>true</threadCounts>
          </value>
        </objProp>
        <stringProp name="filename"></stringProp>
      </ResultCollector>
      <hashTree/>
      <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" testname="Summary Report" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>true</time>
            <latency>true</latency>
            <timestamp>true</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <bytes>true</bytes>
            <threadCounts>true</threadCounts>
          </value>
        </objProp>
        <stringProp name="filename"></stringProp>
      </ResultCollector>
      <hashTree/>
    </hashTree>
  </hashTree>
</jmeterTestPlan>

You can also add a constant throughput timer to control the throughput.

How to test the script 


>>Run ESB server by issuing sh wso2server.sh command at <ESB_HOME>/bin 

>>Navigate to <ESB_HOME>/samples/axis2Server/src/SimpleStockQuoteService ant issue ant command and build the service. Then go to <ESB_HOME>/samples/axis2Server and run the inbuilt axis2 Server by command sh axis2server.sh. This is used as the Back-end service by proxy service created above.

>>Run the JMeter script 

These are some of the results I got. Please note that I have used plugins for JMeter (Standard and Extras). 













Hasitha Hiranya

No comments:

Post a Comment

Instagram