Tips and Tricks creating Load Testing Scripts – LoadStorm

A script is a browser recorded HAR file that you can modify in LoadStorm. Parameterizing scripts for a load test can seem like a daunting task, but we have a few tips on making it go more smoothly.

1. Keep load testing scripts simple.

Making the script perform dynamically for each virtual user will depend greatly on the complexity of the application and the recording behavior. Generally we recommend keeping each script as simple as possible because the goal is to test the target server’s scalability, but testing functionality at scale is also good within reason. Sometimes this simple ability to record what you’re doing in a browser can lead to overdoing the user behavior.

Here are some examples of different complexities of recorded user behavior:

  • Simple – Visit a site to browse some pages.
  • Normal – Browse a site, Log in, submit a form, and log out.
  • Complex – Browse a site, Log in, begin editing an ajax form that dynamically changes as you choose options, save the form, and log out.

Some web applications cannot avoid complexity during scripting due to their infrastructure. This is understandable as there are a vast number of ways to build a web application. Some of this complexity can be seen when modifying form data vs payloads.

2. Modify multiple requests at once.

One of my favorite time saving tricks is selecting a bunch of requests that have the a Query String, Form Input, Cookie, or Request Header that each need the same dynamic token or user data parameterization and making that change to all of them at once. This option, like everything, has its pros and cons. If one of those requests also needs a modification for a parameter that it does not share with the other requests you just lumped together in a multi-request modification then you’ll need to modify it on its own. You have to be careful though to not overwrite the parameter you just modified in the multi-request modification.

3. Recover a different script version with the History tab.

A recovery option is nice to have if there is ever a problem with a script executing, or you simply wish to look at the modifications you made in an earlier execution. You can switch to the script’s History tab to open up a previous execution as a copy. This new copy will contain all of the request modifications that were present during that execution.

4. Swap servers in a script.

Sometimes you have a development server that you built your recording from, or you did so from your production server. Now you’ve got another domain, sub-domain, or IP address that you wish to change the current script to. Normally we recommend to make a new recording of the other domain, but if it’s an exact copy of the site all you need to do is change the target server to fix the script. This can be helpful for saving time on making parameterizations to a script all over again. The process is fairly straight-forward which you can use the following steps or watch this video tutorial:

  1. Open the script you wish to modify.
  2. Switch to the Parameterization tab.
  3. Use the servers drop-down filter to select the server that you wish to change.
  4. Click the Select All button.
  5. From the modification options below the requests table, click the Server button.
  6. Using the constant option type the new server address you wish to replace it with and include https:// if it will change to a secure connection.
  7. Close the modification window.
  8. Repeat these steps if you have more than one server you need to change.
  9. At the top-right click the Execute now button to commit the pending modifications.

5. Record file uploads with Firefox.

Occasionally customers wish to test their target server’s ability to handle many file uploads. Unfortunately this is somewhat limited, but still doable. Using Firefox it is possible to record the entire file you wish to upload as a base64 encoded string within the request payload. Depending on the size of the file this string gets very large and possibly too large to be recorded properly. We recommend to limit this to very small files preferable 1MB or less. The process of recording this is the same as any Firefox recording, but it actually stores the upload in the request while other browser omit the base64 string from the HAR file. Here is an example of what this request’s payload would look like:

Final Thoughts

Thank you for checking out this post on tips and tricks creating load testing scripts, and please check out the previous tips and tricks on troubleshooting scripts. If you’re new to LoadStorm we offer step-by-step instructions to get you started on your first test, and for in-depth documentation visit our learning center and video tutorials. As always, ask for help or more tips if there is a particular area that you’re having trouble with.

Similar Posts