SF-PERFORMANCE TESTING USING APACHE – JMETER

JMeter is an open-source and performance testing tool. Using JMeter, we can evaluate and measure the performance of different software services and products. It is a pure Java open source software?used?for testing Web Application or FTP application. It is?used?to execute performance testing, load testing and functional testing of web applications.

Introduction 

  • JMeter is an open-source and performance testing tool. 
  • Using JMeter, we can evaluate and measure the performance of different software services and products. 
  • It is a pure Java open source software?used?for testing Web Application or FTP application. 
  • It is?used?to execute performance testing, load testing and functional testing of web applications. 
  • On this learning, we are going see how to record and validate Lead creation in Salesforce Lightning using JMeter. 

Prerequisite: 

  • To run JMeter tool we need to check that the system is updated with the latest  java 8+ and it is installed properly. 

           Java Download link: https://www.oracle.com/java/technologies/javase-downloads.html 

  • Download and install Apache JMeter from the given link.  

          Apache JMeter download link: http://jmeter.apache.org/download_jmeter.cgi 

          Note: File extension .tgz for Mac OS and .zip for Windows. 

  • Need a Salesforce Practice account to validate Lead Creation. 

Level 1.0: 

Setting up Browser Certificates: 

  • Open Firefox Browser  
  • Click on Browser Menu >> Click on  Options 
  • On the  box, search for Certificates 
  • Now, click the View Certificates button >> Authorities >> Import 
  • Import the .crt from C:\apache-jmeter-5.2.1\bin >> folder ‘ApacheJMeterTemporaryRootCA’ 

Level 1.1: 

Setting up Browser proxy: 

  • Open Firefox Browser  
  • Click on Browser Menu >> Click on  Options 
  • On the box, search for Network Settings 
  • Now, click on the Settings Button 
  • Under Connection Settings,  change the radio button from No Proxy to Manual Proxy configuration 
  • Set the Http proxy as given in the below snapshot 

Level 2.0: 

JMeter Tool Handson:  

  • Go to JMeter folder C:\apache-jmeter-5.2.1\bin and double click on jmeter.bat file  

  • Now, a commend prompt with JMeter Home window will open.

Level 2.1: 

How to create new project? 

  • Right click on the Test Plan >> Add >> Non-Test Elements >> HTTP(S) Test Script Recorder

  • From Add >> Config Elements include HTTP Header, Cookie, Cache Manager. 
  • In HTTP(S) Test Script Recorder under Test Plan Creation, set the Target Controller as Test Plan > HTTP(S) Test Script Recorder. 

  • Set the Global Settings Port number: 8888 as given in the browser manual proxy settings. 
  • Now, under Requests Filtering column, click the Add suggested Excludes button. This will add the default URL Patterns to exclude those while recording the main scriptsThis will save our time during our postscript recording works. 

Level 3.0: 

How to record the script for Lead Creation on Salesforce lightning? 

  • Now, click the Start button on the HTTP(S) Test Script Recorder for recording. 

  • Now, go to Firefox browser and enter your test salesforce login. 
  • And perform the following actions: 
  1. Login 
  2. Go to Lead Object 
  3. Create a new Lead with your name 
  4. Fill in all the mandatory fields and save the Lead 
  5. Logout 
  • Now, come back to the JMeter tool and click the Stop button for stop recording. 

Level 3.1: 

How to Filter Scripts? 

  • Now, right click the Test Plan >> Add >> Threads (Users) >> Thread Group 

  • Now, copy & paste the recoded scripts into the newly created Thread Group.       

          Note: Thread group is used to Execute the recorded script 

  • To filter and to monitor the script activity status, we need to add View Tree Listener by right clicking on Thread Group >> Add >> Listener >> View Results Tree 

  • Now, click Start Icon on the menu bar. 
  • You will get an initial output on the Tree Listener. Now, based on the results using RegExp Tester search for Aura Token from top to bottom clicking the scripts manually in the View Results Tree Listener. 
  • Once you have identified the Aura Token Rename the Http Request scripts it will help us to sort the script effectively. 
  • Now, add a regular Expression to the identified Http Request, by giving a unique variable name. 

  • In this Example, I have identified two Tokens; one is in the Home Page and other one is on the Lead Home Page. So, I have added two Regular expressions with the variable name aura0 and aura1. 

  • Now, replace the Aura token value to variable name for all Http requests 

1.In-between aura0 to aura1 replace the value to aura0 

2.After aura1 Regular Expression, replace the value to aura1 

Level 4.0: 

Identify the Lead creation area, sort the script finer, and view the result on the Salesforce Lead Object:  

  • Sort and identify the lead creation area.  

         Note: Salesforce Lighting scripts are something different from Salesforce Classic scripts  

  • Copy and paste the message values to a notepad and customize the values based on your requirement. 

  • Now, replace the edited values to the message box and save the operation. 
  • To make the script refined and most effective for testing purpose, disable the current Thread – Create a New Thread as Main and move the sorted main scripts from the Trial Thread Group to Main Thread Group. 

  • Now, you can run the Main Thread Group and check the final output on the Salesforce Lead Object (One Lead Record will get created with the customized value) 

Pro Tips:  

  1. If your requirement is to create more than one record on a single run, you Just change the Number of Threads Users value in the Thread Group, or you can use Loop Controller to handle a specific area. 
  2. Handling Aura Token is more important in Lightning Scripts to generate an output. If you fail to identify your token values, you no need to worry – just take a break and restart your recording from the scratch. 
  3. Add Http Header, Cookie and Cache Manager before start recording the script. 

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.