JMeter Data Driven testing using Salesforce lightning

Share on facebook
Share on twitter
Share on linkedin
The following article elaborates in the detail on the how to use the above element when creating your performance testing scripts for Salesforce Lightning in JMeter Let us get started.

Using CSV DATA SET CONFIG element for Salesforce lightning Scripts 

First,  we will create a test plan. The Test Plan contains one Thread Group. The Thread Group consists of  “CSV Data Set Config” and “HTTP Request”. Also, we will add an “View Results Tree”. See Figure 1.

Jmeter Pic1

“View Results Tree” are listeners that are used for gathering results. So, let us look at the CSV Data Set Config configuration at Figure 2.

Jmeter Pic2

You will need to fill in at least three values in this screen:

  • Filename: if your file is in the /bin directory, this can just be the filename. If it’s somewhere else, use the full path to the file.
  • Variable names: this is the equivalent to a “column name” in a spreadsheet.
  • Delimiter: a comma is the default delimiter, but if your file uses tabs, this is the place to mention that.

The other fields are optional but they may be useful to you.

Here I have considered a scenario to create an Account record in Salesforce Lightning

You should be familiar with  HTTP(S) Test Script Recorder to assist the creation of JMeter test plans.

We have five variables that are sent for creating an Account record request in Salesforce Lightning.

They are accname, active,sla,slaexpiration,slaserial. Look at the Figure 3 to see what we have in data.csv

JMeter supports CSV files with quoted data that includes new lines.

By default, the file is only opened once, and each thread will use a different line from the file. However, the order in which lines are passed to threads depends on the order in which they execute, and it may vary between iterations. Lines are read at the start of each test iteration. The file name and mode are resolved in the first iteration.

Jmeter Pic7

Now let us switch to the Login request where the Account is created in Salesforce Lightning, Figure 4.

Jmeter Pic3

In this request, you can see the table with the following parameters that are passed with the request

All the variables in ‘CSV Data Set Config’ can be seen on the message which contains all the values that are passed along with the request

I have highlighted the fields that are required to create an Account record in Salesforce

JMeter Pic4

Now, we need to pass the variable names using construction ${….} means that this is a variable and not an absolute value as shown in Figure 6.

Jmeter pic5

Now, if we run the test plan, JMeter will parse ‘csv_data.txt’ and change ${accnname}, ${slaserial}, etc., with their values. The results are displayed in Figure 7.

Note: Every ‘CSV Data Set Config’ is visible to all Thread Groups by default. If you need to use separate the ‘CSV Data Set Config’ elements for each Thread,  then create multiple data files that you need, and set the ‘CSV Data Set Config’ element from “Sharing mode” to “Current Thread”.

Thank you..

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.