Guest post by Asaf Alster from TruClient, Performance Engineering Core R&D team
About this post
When creating performance tests, test engineers want to accurately simulate real-world scenarios where multiple users access the same server and authenticate with different credentials. This post explains how to do so using TruClient. TruClient is a tool for creating scripts that can then be used in load testing or monitoring Web applications. You can find more information about TruClient in the TruClient Help Center.
(Note: This post is intended for users that have a basic knowledge of using TruClient.)
All browsers supported by TruClient (Chrome, Chromium, Firefox, and Internet Explorer) have built-in support for BA using a native login prompt. TruClient identifies when the authentication dialog is opened by the browser, it and records the input entered by the script developer to a dedicated step. During the script replay process, TruClient identifies the authentication prompts, and inputs the recorded data into the appropriate fields.
Here are examples of authentication dialogs as they appear in browsers supported by TruClient:
Let’s see how TruClient’s advanced parameters mechanism simulates real-world conditions in which multiple users authenticate with different credentials.
Record the Authentication
1. Record your business flow, including navigating to a server that requires authentication.
2. When prompted for credentials, enter the username (including the domain) and password, and click OK.
Note: When recording a script using a Chromium or Internet Explorer browser, TruClient replaces the standard authentication dialog with a proprietary dialog. While these dialogs look different, they behave the same and are recorded as expected.
3. After authentication, two steps are created: “Navigate…” and “Enter credentials…”.
Note: The “Enter credentials…” step can also be added manually. For details, see Adding authentication dialog steps manually section later in this post.
4. Expand the Authentication dialog (“Enter credentials…”) step. You can see the typical TruClient step structure which contains a Step, Arguments, and Transactions
5. The Step section contains the selected “Dialog - Authenticate” action, as well as other step settings that are not addressed in this post. For more information, see the TruClient Help Center.
6. The Arguments section contains the credentials and domain that were entered.
When the Username is entered in the format [Domain]\[Username], TruClient splits the values between the Username argument and the Domain argument.
Note: During replay, if the Domain value exists, TruClient concatenates the Username and the Domain arguments using the format [Domain]\[User Name].
The Button argument represents the button on which to press in the Authentication dialog. Available options are OK (default) and Cancel.
7. You can now replay the script with the recorded arguments.
Parametrize the authentication dialog - best practice
Now we will demonstrate how to parametrize the Username argument. This enables you to use different values for different running users.
1. Expand the step Arguments section, and change the input mode of the Username argument to Parameter.
2. Highlight the argument text, and right-click it to open the context menu.
3. In the context menu, select Create New parameter from Selection…
4. In the Enter Parameter Name dialog, enter a name for the new parameter to use in the Username argument field.
5. Click OK to approve parameter creation. After the dialog closes, you should see the following:
- The selected text is replaced with the parameter name as the input of the Username argument.
- A parameter with the name “Username” is added to the Parameters List dialog.
- When using VuGen, you can open the Parameter List dialog from the Solution Explorer by clicking on the Parameters
7. Repeat the above steps for the Password and Domain arguments (making adjustments as necessary).
Note: Since we configured a couple of different parameters for the Authentication dialog, we would like to correlate their value’s selection. To do so, the parameters must use the same configuration for the Select next row and Update value one settings.
For more information on configuring parameters, see the VuGen Help Center.
Adding authentication dialog steps manually
All the various steps that are created by TruClient during recording can also be added manually to the script using TruClient Toolbox.
1. Open the TruClient Toolbox, and drag the Generic Browser Action step into the script.
2. Unfold the step, and expand the Step
3. Change the selected Action to “Dialog – Authenticate”.
4. Expand the Arguments section, and enter the appropriate value.
Note: During replay, if the Domain value exists, TruClient concatenates the Username and the Domain arguments using the format [Domain]\[Username].
5. The Button argument represents the button on which to press in the Authentication dialog. Available options are OK (default) and Cancel.
6. During replay, if the manually added step is positioned in the proper location in the script, it will identify an opened authentication dialog, and will act on it.
In this post, we have shown how to use TruClient to handle authentication dialogs to simulate real-world scenarios, where multiple user credentials are used for the authentication stage. TruClient records the authentication dialogs, which you can then enhance in the recorded script. Using parametrization to vary arguments enables you to build robust and random scripts, which are a best practice of load testing.
Problem: The authentication dialog does not appear during recording. This is possibly a result of a combination of the following:
- Custom Internet Explorer browser settings
- Web site with NTLM Authentication
- Domain account
Possible Solution: Use a non-domain user for the Windows login during script recording.
Make sure you also use a non-domain user for Windows login on the Load Generators.
References and Notes
- "RFC 1945 Section 11. Access Authentication". IETF. May 1996. p. 46. Retrieved 3 February2017.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.