16 November 2016

Performance Testing Best Practices: User Scenarios

Grant Engle

Most engineers new to load testing first ask, "How many concurrent users am I expecting to hit my website/app/API?”

This isn’t far off from a proper starting point, but based on our more than 2 million performance tests, we recommend you put aside total traffic numbers for a minute and think about what you expect users to actually do.

That’s because user scenarios are the cornerstone of your load test. To put it simply: Detailed, realistic user scenarios mean your load tests will produce actionable data you can use to optimize your websites, apps, APIs and infrastructure.

So, let’s explore user scenarios and share some best practices.

What is a User Scenario?

A user scenario defines what URLs or web pages simulated users will request during a load test.

IDE user scenario screenshot.png

Deciding what to include in your user scenario

This is usually pretty straightforward. Odds are, as a consultant or a stakeholder in the website or app you’re testing, you probably have a good idea of what you expect users to do.

There’s no need to reinvent the wheel here. For example, if your company is running a sale for multiple items on its website, then you might create a user scenario where the user:

  • Enters the website
  • Clicks on a sales banner or some kind of button
  • Browses the available items
  • Clicks on an item to see the full description
  • Adds the item to the cart
  • Signs in to the website using a username and password (HTTP authentication)
  • Completes purchase
  • Receives confirmation email

If you have some experience with writing user scenarios and performance testing, those eight steps shouldn’t take you too long to script. (And they’re easy to script using Lua or our scripting API.)

But not everybody has experience with performance and load testing — so we’ve made creating user scenarios easy. Seriously: E-Z.

The Load Impact User Scenario Recorder

The Load Impact User Scenario Recorder is our world-famous Chrome Extension. This powerful little tool allows you to record a session in your own browser then automatically converts it into a load script.

If you wanted to create the example scenario above, all you’d have to do is click "Start Recording” from the extension’s drop-down menu, then go through the eight steps on your own.

You’ll save a ton of time compared to writing your own script, and the user scenario is editable in our app, so you’ll be able to improve the script after the recording.

You can learn how to do it in two minutes. Check out the intro video:

Mobile Performance Testing: The Proxy Recorder

We live in the mobile age, and it’s extremely important that your potential customers (and loyal customers) have a good mobile experience with your product.

If you were asking yourself, "What about testing my website or app from a mobile device?” — then you’re in luck. We’ve got you covered.

This process is pretty simple, too, but there are a few additional things to configure.

Here are the extra steps before you can get into the scenario-creating:

Then you just behave as you expect your users will, and the scenario will automatically generate upon completion, just like the Chrome extension.

The Load Impact IDE

For software engineers who still like to go into an IDE and pound out a few hundred lines of code for fun, we still have ours available for when you need it.

The IDE is a great tool for people testing APIs. When testing an API, you’re no longer concerned with Virtual Users — you’re thinking in terms of requests per second — and you can easily manipulate that with a few lines of code in your script.

Check out this article to see an example of how people use our IDE when testing an API.

pen and paper user scenarios.jpg

Important Note

You’ll certainly have expectations when it comes to what your users will do, but it’s also very important that you look at your analytics to see the average session duration for your site or application.

The average session duration — we’re using the Google Analytics terminology because that’s pretty much the accepted industry standard — is how long visitors generally stay on your site.

As you could probably guess, that’s a great starting point when thinking about the duration of your user scenarios.

Happy testing!

< Back to all posts