Knowing - Core Features of ACT

The dynamic test is a very powerful feature of ACT, which gives you the ability to record or manually create a list of HTTP requests that are sent to the Web server concurrently. Also, you can modify request header information such as referrer, user-agent, and query string. Dynamic test scripts can be created using Visual Basic Script (VBScript), Jscript, PERL, or any other COM-enabled scripting language. ACT only supports VBScript for recording a test script.


Concurrent users and ACT Simultaneous Browser Connections


A concurrent connection to the Web application making a single request or a series of requests contained in a ACT test script is measured in simultaneous browser connections (SBCs). Other stress tools use terms such as "stress threads" or "virtual users," which are synonymous with the ACT SBC (load level). We are often asked, "How do SBCs relate to concurrent users?" Equating SBCs with concurrent users is difficult, because we do not always know the rate at which customers will be requesting pages from the Web application. Test scripts played back with no sleep time (the user's think time during transaction execution) often produce a faster rate of execution and greater load against the Web server than would be produced by the user walking through the application from a Web browser. Therefore, you may need to include random sleep times comparable to actual user think time in your scripts to slow the request arrival rate on the Web server, allowing you to more closely relate one SBC to one user connection and to better simulate real-world Web traffic arrival rates.


Users Sleep Time


When creating test scripts, we will have the option of inserting user sleep times. These sleep times help simulate realistic usage of the application as they introduce user think times. For example, by inserting a 5-second sleep time in a script that simulates a user filling out an online form, you simulate a typical user's actions more accurately by taking into account the think time needed for the user to fill out the form. In ACT, Sleep is a method of the Test object


When an ACT test Script is recorded, the following code will be inserted:

fEnableDelays = False

If fEnableDelays = True then Test.Sleep (0)


By default, at the top of a recorded test script the fEnableDelays variable is set to false. To use a 5-second delay, or 5,000 milliseconds, you will need to change the following code in the ACT test script:


fEnableDelays = True

If fEnableDelays = True then Test.Sleep (5000)


If needed, a random sleep function can be used by inserting the following snippet of code into a test script and then calling this function between each request:


Function RandomSleep()

   Dim lMinSleep, lMaxSleep, lSleep

   lMaxSleep = 5000 ' 5 seconds

   lMinSleep = 1000  ' 1 second

   ' create a random int within our range

   Call Randomize()

   lSleep = Int((lMaxSleep - lMinSleep + 1) * Rnd(1) + lMinSleep)

   Call Test.Sleep(lSleep)

   ' return the delay time

   RandomSleep = lSleep

End Function



One negative aspect of sleep times is that they can decrease the amount of load a given client can produce. This could prevent you from identifying the true maximum concurrent usage. Also, if there is insufficient client capacity, you will have a much more difficult task detecting performance bottlenecks, because bottlenecks appear when maximum load is applied to the system. A test script with no sleep times simulates the transaction as if users had a pre-filled form which is being submitted immediately. Utilizing sleep times more accurately simulates production traffic and allows you to more precisely estimate concurrent usage numbers. When random sleep times are used, the argument can be made that one SBC equals one real-world user.


User and Groups


Users are handled in ACT dynamically by providing a single unique user and password for each entry located in the default user group. There is a one-to-one relationship between SBCs and users. For example, if you set the SBC level to 25 you will need a minimum of 25 users to run the test. If your Web application uses anonymous authentication, by default ACT automatically generates the users required. If your Web application requires Basic or Windows NT LAN Manager (NTLM) authentication, you must have predefined usernames and passwords. ACT provides the ability to customize users either by manually generating user data (from the user interface) or by importing data from a separate input file. When executing your test, each SBC will have a unique username and password. This data is exposed in your script by using the ACT Test Object.

The following code is an example of the Test.GetCurrentUser, which can be used to retrieve the username and password:


Dim oUser, sUserName, sPassword

Set oUser = Test.GetCurrentUser

sUserName = oUser.Name

sPassword = oUser.Password




For most Web applications, allowing ACT to control your HTTP cookies is the optimal method for handling cookies. However, cookies can be set up initially when the test starts and handled automatically by ACT thereafter. For any request that includes an HTTP header named "Cookie," ACT will show the exact response generated by the Web server, and it will be commented out by default when a test is recorded. The next line of code within your script will show the same request with the value "(Automatic)." The ACT help file covers the syntax for reading and modifying cookie information in more detail.



Headers are handled automatically, but they can be changed in your test script to modify information such as referrer, user-agent, host, HTTP version, and other information passed in the header.

For example, if your application contains logic that is dependent on multiple user-agents (different Web Browsers), you can modify the HTTP header of a request to dynamically change and pass a mix of user-agents:

Dim sUserAgent, sArray(3), sSeed

sArray(1) = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"

sArray(2) = "Mozilla/4.0(compatible;MSIE 4.0;Mac PowerPC)"

sArray(3) = "Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/

20001108 Netscape6/6.0"


sSeed = Int((3 * Rnd)+1)

sUserAgent = sArray(mySeed)


 Happy Testing with ACT !!!

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.