Last active
July 23, 2016 06:33
-
-
Save sufw/5844188 to your computer and use it in GitHub Desktop.
soapUI project to load test SSL performance. Specifically meant for the ABAP HTTP handler at https://gist.github.com/sufw/5746443, but can be adapted to any other HTTP resource
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<con:soapui-project activeEnvironment="Default" name="SSL Performance Test" resourceRoot="" defaultScriptLanguage="Groovy" soapui-version="4.5.1" abortOnError="false" runType="SEQUENTIAL" xmlns:con="http://eviware.com/soapui/config"><con:settings/><con:interface xsi:type="con:RestService" wadlVersion="http://wadl.dev.java.net/2009/02" name="Fibonacci Generator" type="rest" basePath="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:settings/><con:definitionCache type="TEXT" rootPart=""/><con:endpoints><con:endpoint>https://server.local:443</con:endpoint><con:endpoint>http://server.local:80</con:endpoint></con:endpoints><con:resource name="fibonacci" path="/mmg/fibonacci"><con:settings/><con:parameters/><con:method name="GET" method="GET"><con:settings/><con:parameters><con:parameter><con:name>count</con:name><con:value>149</con:value><con:style>QUERY</con:style><con:default>149</con:default></con:parameter><con:parameter><con:name>cache</con:name><con:value>true</con:value><con:style>QUERY</con:style><con:default>true</con:default></con:parameter></con:parameters><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType>text/html; charset=utf-8</con:mediaType><con:status>401</con:status><con:params/><con:element>html</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType>text/plain; charset=utf-8</con:mediaType><con:status>200</con:status><con:params/><con:element>data</con:element></con:representation><con:representation type="FAULT"><con:mediaType>text/html</con:mediaType><con:status>500</con:status><con:params/><con:element>html</con:element></con:representation><con:representation type="RESPONSE"><con:mediaType xsi:nil="true"/><con:status>0</con:status><con:params/><con:element>data</con:element></con:representation><con:request name="SSL" mediaType="application/xml" sslKeystore=""><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>https://server.local:443</con:endpoint><con:request/><con:credentials><con:authType>Global HTTP Settings</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:request><con:request name="Plaintext" mediaType="application/xml" sslKeystore=""><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>http://server.local:80</con:endpoint><con:request/><con:credentials><con:username></con:username><con:password></con:password><con:authType>Global HTTP Settings</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:request><con:request name="SSL via Web Dispatcher" mediaType="application/xml" sslKeystore=""><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>https://server.local:1443</con:endpoint><con:request/><con:credentials><con:authType>Global HTTP Settings</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters/></con:request></con:method></con:resource></con:interface><con:testSuite name="Fibonacci Generator TestSuite"><con:description>TestSuite generated for REST Service [Fibonacci Generator]</con:description><con:settings/><con:runType>SEQUENTIAL</con:runType><con:testCase failOnError="true" failTestCaseOnErrors="true" keepSession="false" maxResults="0" name="Default Test Case" searchProperties="true" id="ec38c625-d727-4724-90fe-29e22e1c2987" timeout="0" wsrmEnabled="false" wsrmVersion="1.0" wsrmAckTo="" amfAuthorisation="false" amfEndpoint="" amfLogin="" amfPassword=""><con:settings/><con:testStep type="delay" name="Delay" disabled="true"><con:settings/><con:config><delay>${=(int)(Math.random()*200)}</delay></con:config></con:testStep><con:testStep type="restrequest" name="fibonacci_plaintext" disabled="true"><con:settings/><con:config service="Fibonacci Generator" resourcePath="/mmg/fibonacci" methodName="GET" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="fibonacci_plaintext" mediaType="application/xml" sslKeystore=""><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>https://server.local:443</con:endpoint><con:request/><con:assertion type="GroovyScriptAssertion" name="Script Assertion"><con:configuration><scriptText>// check whether this is running from a Load Test; if so, save the response time for later. | |
if (context.LoadTestContext != null){ | |
if (context.runCounter == 0){ | |
// this is the initial run. Save its response time separately from subsequent runs. | |
context.LoadTestContext.responseTimes.plain.initial.push((int)(messageExchange.getTimeTaken())); | |
} else { | |
// save the response times for subsequent runs in a different list | |
context.LoadTestContext.responseTimes.plain.subseq.push((int)(messageExchange.getTimeTaken())); | |
} | |
} | |
//log.info( context.LoadTestContext.responseTimes);</scriptText></con:configuration></con:assertion><con:assertion type="Valid HTTP Status Codes" name="Valid HTTP Status Codes"><con:configuration><codes>200</codes></con:configuration></con:assertion><con:credentials><con:username></con:username><con:password></con:password><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters> | |
<con:entry key="cache" value="${#TestCase#cache}"/> | |
<con:entry key="count" value="${#TestCase#count}"/> | |
</con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="restrequest" name="fibonacci_ssl"><con:settings/><con:config service="Fibonacci Generator" resourcePath="/mmg/fibonacci" methodName="GET" xsi:type="con:RestRequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><con:restRequest name="fibonacci_ssl" mediaType="application/xml" sslKeystore=""><con:settings><con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting></con:settings><con:endpoint>https://server.local:443</con:endpoint><con:request/><con:assertion type="GroovyScriptAssertion" name="Script Assertion"><con:configuration><scriptText>// check whether this is running from a Load Test; if so, save the response time for later. | |
if (context.LoadTestContext != null){ | |
if (context.runCounter == 0){ | |
// this is the initial run. Save its response time separately from subsequent runs. | |
context.LoadTestContext.responseTimes.ssl.initial.push((int)(messageExchange.getTimeTaken())); | |
} else { | |
// save the response times for subsequent runs in a different list | |
context.LoadTestContext.responseTimes.ssl.subseq.push((int)(messageExchange.getTimeTaken())); | |
} | |
} | |
//log.info( context.LoadTestContext.responseTimes);</scriptText></con:configuration></con:assertion><con:assertion type="Valid HTTP Status Codes" name="Valid HTTP Status Codes"><con:configuration><codes>200</codes></con:configuration></con:assertion><con:credentials><con:username></con:username><con:password></con:password><con:authType>Preemptive</con:authType></con:credentials><con:jmsConfig JMSDeliveryMode="PERSISTENT"/><con:jmsPropertyConfig/><con:parameters> | |
<con:entry key="cache" value="${#TestCase#cache}"/> | |
<con:entry key="count" value="${#TestCase#count}"/> | |
</con:parameters></con:restRequest></con:config></con:testStep><con:testStep type="groovy" name="Loop Controller"><con:settings/><con:config><script>if (context.runCounter != null){ | |
context.runCounter += 1; | |
} | |
if (context.runCounter < testRunner.testCase.getPropertyValue("loopsInTestCase").toInteger()){ | |
testRunner.gotoStepByName("Delay"); | |
} | |
</script></con:config></con:testStep><con:loadTest name="LoadTest 1"><con:settings><con:setting id="HttpSettings@close-connections">false</con:setting><con:setting id="HttpSettings@include_request_in_time_taken">false</con:setting><con:setting id="HttpSettings@include_response_in_time_taken">false</con:setting></con:settings><con:threadCount>50</con:threadCount><con:startDelay>500</con:startDelay><con:sampleInterval>250</con:sampleInterval><con:calculateTPSOnTimePassed>true</con:calculateTPSOnTimePassed><con:resetStatisticsOnThreadCountChange>true</con:resetStatisticsOnThreadCountChange><con:historyLimit>-1</con:historyLimit><con:testLimit>20</con:testLimit><con:limitType>COUNT_PER_THREAD</con:limitType><con:loadStrategy><con:type>Simple</con:type><con:config><testDelay>0</testDelay><randomFactor>0.0</randomFactor></con:config></con:loadStrategy><con:assertion type="Step Status" name="Step Status"/><con:maxAssertionErrors>9999</con:maxAssertionErrors><con:statisticsLogFolder/><con:statisticsLogInterval>0</con:statisticsLogInterval><con:logStatisticsOnThreadChange>false</con:logStatisticsOnThreadChange><con:cancelOnReachedLimit>false</con:cancelOnReachedLimit><con:cancelExcessiveThreads>true</con:cancelExcessiveThreads><con:strategyInterval>500</con:strategyInterval><con:setupScript>context.responseTimes = [ | |
plain:[ | |
initial:[], | |
subseq:[] | |
], | |
ssl:[ | |
initial:[], | |
subseq:[] | |
] | |
]; | |
</con:setupScript><con:tearDownScript>for (type in ["plain", "ssl"]){ | |
for (subtype in ["initial", "subseq"]){ | |
values = []; | |
// Ugly big try/catch block here to handle some steps being disabled in the Test Suite | |
try { | |
values = context.responseTimes[type][subtype].sort(); | |
} catch (e) { | |
// do nothing | |
} | |
if (values.size() > 0){ | |
//printStats(type, subtype, values); | |
log.info(subtype + " " + type + ": " + values); | |
} else { | |
log.info("No stats captured for " + subtype + " " + type); | |
} | |
} | |
} | |
</con:tearDownScript><con:updateStatisticsPerTestStep>false</con:updateStatisticsPerTestStep></con:loadTest><con:setupScript>context.runCounter = 0;</con:setupScript><con:tearDownScript/><con:properties><con:property><con:name>count</con:name><con:value>149</con:value></con:property><con:property><con:name>cache</con:name><con:value>true</con:value></con:property><con:property><con:name>loopsInTestCase</con:name><con:value>10</con:value></con:property></con:properties></con:testCase><con:properties/></con:testSuite><con:properties/><con:wssContainer/></con:soapui-project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment