API Load Testing using SOAPUI

Salesforce Load Testing using SOAPUI

Previously, I have added multiple posts in this blog on how you would face governor limit errors on each step of Salesforce implementation and how we can leverage selenium to perform load testing of Salesforce to some extent.

SOAP UI is powerful tool and in this post we will see how it can be used to perform load testing of Salesforce API.

Step 1 : Download PartnerWSDL from your Salesforce instance and create SOAP UI Project.

Step 2 : Create a Test Suite in SOAP UI

Step 3 : Create a Groovy script to generate random Account Name

def generator = { String alphabet, int n ->
  new Random().with {
    (1..n).collect { alphabet[ nextInt( alphabet.length() ) ] }.join()

def accName = generator( (('A'..'Z')+('0'..'9')).join(), 9 )
testRunner.testCase.getTestStepByName("AccParameter"). setPropertyValue("AccountName",accName)

def accNumber = testRunner.testCase. getPropertyValue("AccountNumber")

Step 4 : Create a Login request in SOAP UI using Partner WSDL, sample request looks like

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com">

Step 5 : Create property step to create two parameter as shown in below

Step 6 : Create Step with property transfer. In this step, we would read Salesforce session Id returned by Login API and pass it to create Account API. To compute X-Path, we can use xmlGrid website.

XPath to read Session of Salesforce


X-Path to pass Session Id in Create request


Step 7 : In this step we would insert Account using SessionId transferred from previous parameter transfer step

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com" xmlns:xsi="xsi">
         <urn:sessionId>Salesforce Session Id</urn:sessionId>
      	<urn:sObjects xsi:type="urn1:Account" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

In this step, you might get this error “Destination URL not reset. The URL returned from login must be set in the SforceService“. To resolve this, change URL of request in SOAP UI address bar. Shown in 30 Min Video below

Step 8 : Final step is to create a Groovy script to auto increment Account Number

def accNumber = testRunner.testCase.getTestStepByName("AccParameter"). getPropertyValue("AccountNumber").toInteger() 
accNumber = accNumber + 1 

testRunner.testCase.getTestStepByName("AccParameter"). setPropertyValue("AccountNumber", accNumber.toString()) 




Related Posts


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading