• Browser Agent
  • Windows Recorder

For security reasons, many websites do not allow the same user to log in more than once at the same time. When multiple attempts to log in with the same credentials are made simultaneously, the site will either log one of the users out, or lock the entire account.

This issue can arise when multiple Synthetic Classic nodes are attempting to test a single application with the same username/password credentials. The error that results can cause the Browser Agent to report site or script issues that are not actually occurring; the problem is really caused by concurrent logins.  

In Backbone, you can use Parameter Substitution by Node to force each node to log in with different credentials. However, this feature is not available in Last Mile or Private Last Mile because those tests are not assigned to run from the same peer (or machine) every test run; in Backbone, Parameter Substitution by Node assigns each substitution to a specific machine.  

Since assigning unique login credentials to every peer in the Last Mile network is not feasible, the next best option is to force the peers to select login credentials at random from a list. While this does not guarantee that two machines will never use the same login credentials at the same time, it does significantly reduce the risk of that happening. You can further reduce the risk of concurrent logins by increasing the number of login credentials from which the script is selecting, up to two or three times the number of logins needed. For example, if you are running 30 tests per hour, you may want to have 60 to 90 available logins.

There are two methods for randomizing your login credentials:

  • Randomize the number after the login name.
  • Select a username/password combination at random from an array.

Both of these methods are detailed below, with JavaScript code samples. Use a Custom action to add the JavaScript to your script. You can modify these samples to fit your needs.  

Original User Actions  

The original user actions will be used for both examples. These user actions all occur on the 'login' form.

  1. Type 'testuser1' into the 'username' field.
  2. Type 'p@ssw0rd' into the 'password' field.
  3. Click the 'loginbtn' submit button.

    // ---------- START ORIGINAL USER ACTIONS ---------- //
    // ---------- END ORIGINAL USER ACTIONS ---------- //


Method One  

This method is used when:

  • The username is the same for all of your login credentials except for a trailing number that increases for each login (i.e. testuser1, testuser2, testuser3, ...).
  • The password is the same for each login.

This method generates a random number and then adds that number to the end of the username string.  

The example below randomly generates usernames from 'testuser1' to 'testuser1000' and uses the password 'p@ssw0rd' for all usernames.

// ---------- START METHOD 1 ---------- //
var minval = 1;
var maxval = 1000;
var randNum = Math.round(Math.random() * (maxval - minval)) + minval;

var uname = 'testuser' + randNum;
var pword = 'p@ssw0rd'



// ---------- END MODIFIED USER ACTIONS 1 ---------- //


Method Two  

This method is used if the usernames are not similar, or if each password is unique to the username.  

Create two arrays, one with the list of usernames and the other with the corresponding passwords. The JavaScript below will select a random position in the arrays and use the values from that position to login to the application.  

The example below will randomly generate 5 usernames with 5 corresponding passwords. Please note that the first position in a JavaScript Array is 0, meaning that an Array with 5 values will have positions ranging from 0 to 4.


// ---------- START MODIFIED USER ACTIONS 2 ---------- //
var unameArray = new Array('testuser1', 'testuser2', 'testuser3', 'testuser4', 'testuser5');
var pwordArray = new Array(
'p@ssw0rd', 'mYpword', 's3cr3t',  'keyphr@se' 

, 'testingpassword');
var minval = 0;
var maxval = 4;
var randNum = Math.round(Math.random() * (maxval - minval)) + minval;

var uname = unameArray[randNum];
var pword = pwordArray[randNum];

// ---------- END MODIFIED USER ACTIONS 2 ---------- //


  • No labels