While creating a Web Application Task for the Load Test one can provide some variable data that will be used in the tasks of the device. For example, this allows us to simulate different users logging in, visitors searching for different products, or dynamic URL testing by specifying dynamic variables.
As an illustration, consider testing of login page where multiple users have to log in under different usernames. First, the script for a single user logging in needs to be created, and then Context Parameters for user login and password input in the script must be set up. To set up and manage Context Parameters in EveryStep Scripting Tool, see the Adding Context Parameters to a Script article.
When the script is saved and the device is configured the list of Dynamic Variables (the set of logins and passwords for dynamic users simulation) must be specified in the test scenario. See Uploading Dynamic Variables to the Test Scenario for more details. View the whole process in action in the Using Dynamic Variables video.
When to Use Dynamic Variables and How to Generate a Test Dataset
Load testing of a web application includes the recording of a test script. Generally, a test script reproduces end-user interactions with a web application such as logging in to the application, searching, filling and submitting web forms, or simple navigation in a real browser window. Thus, similar to a real-life use case scenario, the majority of test cases will include some data input steps.
Testing your web application with the same input data hardly reproduces a real-life use case when several users execute the login step or fill out a search box with different data at a time. Moreover, in some cases, a target web application may not support concurrent login and you won’t be able to execute several simultaneous virtual users with the same login and password values.
But is it possible to make each load test session unique? The answer is yes, all you need to make your web application load test scenarios more realistic, is to parametrize the test scenario’s script. In other words, introduce dynamic variables for input data in your test script and use unique values for these variables in each test session while executing the load test.
Dynamic variables is a great option to emulate web transactions like:
- Logging in with different user credentials.
- Filling a search box with the different text of a search request.
- Submit a web form with unique input data (unique phone or email address on registration).
LoadView supports the import of dynamic values from external CSV files to a load test scenario. If you know in advance how you can parametrize your load test scenario, you can create a CSV file with a set of dynamic values for the corresponding parameters in the EveryStep Scripting Tool script. LoadView will read the lines from the CSV file and dynamically pass unique values to the corresponding dynamic variables in the load test script while running the load test.
Now let’s discuss some particularities of the dynamic test data generation process.
There is no universal approach to generating test data. As a rule of thumb, the first thing to do is to analyze the features of a web application. At this point, the type of test data and their structure should be discussed with the application developers. The data generation process can be carried out by both a QA engineer and a development team.
Before starting a load test, it is important to make sure that the amount of test data you have generates is enough for the correct test execution. For example, in the case of concurrent logging in each concurrent virtual user must have a unique user-password pair. Otherwise, after the first login, all subsequent attempts with the same access credentials will result in script execution errors. Therefore, it is important to ensure that the number of generated dynamic variable values equals or exceeds the maximum number of concurrent virtual users.
When generating user credentials for a load test, it is important to ensure that the test usernames and passwords are unique and meet the application’s security requirements. It is recommended to use predefined templates for generating user accounts.
You can generate user accounts through the web application interface or create automated scripts to generate API requests to create accounts (for a large number of users), or you can create accounts directly in the database of the target application.
Another example where you might need to generate test values for dynamic variables is a web form submit transaction. During the execution of the script, the system will use the data from the provided CSV file to fill in the form fields. To successfully submit the form, the format of the dynamic variable values must correspond to the specified format of the web form fields. Therefore, it is necessary to predefine a supported format of values for all dynamic variables (for example, phone numbers).