Saturday, March 15, 2008

JSession Id in OpenSTA

JSession Id in OpenSTA

Directive 1: Script header

The script header should be as follows :
!------------------------------------------------------------
!Copyright (c) 2001, Load Test Professionals.com
!
!Project: XYZ
!
!File Name: Search.htp
!
!Description: Search the web site functionality
!
!Implemented Actions:
! 1. Login
! 2. Search
! 3. Logout
!
!Author: John Lennon ( johnl@loadtestprofessionals.com )
!
!------------------------------------------------------------

The script header should be located above the Environment section of the script.

Directive 2 : Comments

Before each transaction start and end enter a comment for the same. This helps later on in debugging and makes script mode clear.
e.g ! navigate to search page --------------------------

It is recommended to enable the option ‘Add comments for Cookies’

Directive 3: Wait time

The wait time should be added to ensure the earlier post was successfully complete. A time varying from 5 sec to 20 seconds is optimum for the same
e.g. Wait 5000 ! Since time is measured in milliseconds

Directive 4: Transaction timers

Ensure a timer is recorded for each web transaction even if the web page is not of importance to the client/development team. This helps unnecessary modification of the script later on.

It is recommended that the transactions timers should be noted for each web page.
e.g.
Start Timer Home_page
PRIMARY GET URI "http://10.236.133.27:9065/cgi-bin/immedium/broadway/scripts/bw_login.jsp HTTP/1.0" ON 1
................
................
End Timer Home_page

Ensure no Wait command is recorde in the start timer and end timer. This may results is misleading data being collected.

Example of bad code used for transaction timers

Start Timer Home_page
PRIMARY GET URI "http://10.236.133.27:9065/cgi-bin/immedium/broadway/scripts/bw_login.jsp HTTP/1.0" ON 1

Wait 1100

GET URI "http://10.236.133.27:9065/broadway/images/bw_banner.gif HTTP/1.0" ON 5

Wait 110
................
................
End Timer Home_page

This code will add to the response time and give increased value for the latency that may trigger false alarm among the team.

Example of good code used for transaction timers

Start Timer Home_page
PRIMARY GET URI "http://10.236.133.27:9065/cgi-bin/immedium/broadway/scripts/bw_login.jsp HTTP/1.0" ON 1

GET URI "http://10.236.133.27:9065/broadway/images/bw_banner.gif HTTP/1.0" ON 5
................
................
End Timer Home_page

Directive 5: Naming conventions for Transaction timers

The naming convention that reflects the user activity or functionality should be used. Good examples for the same are
Navigate_home_page
Login
Navigate_to_search_page
Perform_search etc

Directive 6: Using proper size for Character Variables

The size of character variables should be taken into consideration when they are declared. A response being used to parameterize data on the fly should have a higher value than a regular used character
E.g.
CHARACTER*3584 UDLV_response ! for response file received from AUT
CHARACTER*256 UDLV_bvsessionid ! for small parameters being trapped as session identifier

The variable definition should be in the section Definitions of the script.

Directive 7: Automatic Cookies generation

Opensta handles cookies by themselves. The option ‘Automatic Cookie Generation’ is enabled by default in the Gateway dialog. Disabling this may results in the test engineer handling cookie operation by himsef that may be an extra task at hand during scripting.

It is also recommended to enabel the option ‘Add comments for Cookies’. This may help later during debugging,

Directive 8: Debugging messages

Debugging messages are recommended to be used during unit testing of script in the script modeller. Use of Log is recommended
For debugging script at ‘Test’ level use the Note command.
(It is observed at times the Note command does not perform as intended)

Directive 9: Synchronize Requests

It is recommended to use the Synchronize Requests command in the script before each end transaction timer. This will ensure all the responses are received from the AUT before the script continues to the next statement of the script.
e.g.
Start Timer home_page
PRIMARY GET URI "http://www.yahoo.com/ HTTP/1.0" ON 1
CONNECT TO "10.236.133.78:80" ON 2
GET URI "http://us.i1.yimg.com/us.yimg.com/i/mntl/re/whcpl4sale2.gif HTTP/1.0" ON 2
.........................
DISCONNECT FROM 2
......................
SYNCHRONIZE REQUESTS
End Timer home_page
WAIT 5000
Start Timer search

Directive 10:Using Start Test-case function

It is recommended to use test case function if specific test case needs to be tested during load test, if required as per the test case documented for the load testing

START TEST-CASE "totaltransactiontest"
IF ( UDLV_totaltrans == 1000) THEN
PASS TEST-CASE
ENDIF
END TEST-CASE

Directive 11: Error handling to confirm the page is loaded

It is necessary to ensure that the web page being tested is loaded before the next post is posted to the server by the script
e.g.
PRIMARY GET URI "http://www.yahoo.com/ HTTP/1.0" ON 1
LOAD RESPONSE_INFO BODY ON 4 &
INTO UDLV_seasuc &
,WITH "HTML(0)/BODY(1)/TABLE(3)/TBODY(0)/TR(0)/TD(0)/TR(2)/TD(0)/FONT(0)/B(0):TEXT:(0)"

START TEST-CASE "Search check"
IF ( UDLV_seasuc <> " Home") THEN
FAIL TEST-CASE
ENDIF
END TEST-CASE

or something like

PRIMARY GET URI "http://www.yahoo.com/ HTTP/1.0" ON 1
Load Response_Info Header on 1 Into UDLV_status
Set UDLV_status_temp = ~Locate("HTTP/1.1 200 OK", UDLV_status)
if (UDLV_status_temp = -1 ) Then
TRACE "Login.jsp not displayed hence quitting"
Exit, Keepalive
Endif

Directive 12: Dynamic data Parameterization
Use of function as Load Response_Info Header, Load Response_Info Body; are used for the same.
For detail documentation on how to perform the same, refer to
http://opensta.org/docs/ug13/os-model.htm#13793

Directive 13: Parameterization of data whose position is dynamic

The ‘Dynamic data Parameterization’ fails when the data in the HTML returned by the web AUT si not fixed.
For parameterization of the data whose position in the HTML is not fixed use the following code snipped

PRIMARY GET URI "http://10.236.133.27:9065/cgi-bin/immedium/broadway/scripts/bw_login.jsp HTTP/1.0" ON 1
! Trap session id start ---------------------

Load Response_info Body on 1 Into UDLV_response !&

Set UDLV_offset =0

Set UDLV_temp = ~Extract(UDLV_offset, 1988, UDLV_response)

Set UDLV_offset = 13 + ~Locate("BV_SessionID=",UDLV_temp)

Set UDLV_offset2 = 12 + ~Locate("BV_EngineID=",UDLV_temp)

Set UDLV_bvsessionid = ~Extract(UDLV_offset, 29, UDLV_temp)

Set UDLV_bvengineid = ~Extract(UDLV_offset2, 33, UDLV_temp)

Log "BV session id :", UDLV_bvsessionid

Log "BV engine id :", UDLV_bvengineid

! Trap session id end ---------------------

Directive 14: Bypassing Proxy server during script recording

To bypass the proxy server
If the web application under test lies in the cognizant network, try to bypass the proxy server by disabling the proxy setting on the browser (in the LAN Settings dialog). This will reduce the latency caused by the proxy server.

If there is no other option but to use proxy (in case the web application under test is located on Internet) then the IE browser setting should be left as they are when the user normally accesses Internet.

Directive 15: Static data parameterization

It may be necessary to use different user names or parameter values during the test A example for the same is documented below

!‘Definitions’ section -------------------------------------------
CHARACTER*512 USERNAME ( "phillip", "allan", "david" &
, "robert", "donna" ), SCRIPT
CHARACTER*512 PASSWORD ( "pillihp", "nalla", "divad" &
, "trebor", "annod" ), SCRIPT

!‘Code’ section -------------------------------------------

ACQUIRE MUTEX "LOGIN"
NEXT USERNAME
NEXT PASSWORD
SET MY_USERNAME = USERNAME
SET MY_PASSWORD = PASSWORD
RELEASE MUTEX "LOGIN"

No comments: