July 7, 2009

OpenSTA - SCL Code Boilerplate for HTTP Load Tests

(small code dump...)

OpenSTA (Open Systems Testing Architecture) is a popular open source web performance test tool. It uses a scripting language named SCL (Script Control Language), which seems to be heavily influenced by Fortran. It's a little bit dated and clumsy to program with, but suffices for writing scripts modeling complex web transactions.

Here is the basic structure I start with when modeling tests in OpenSTA:

!Browser:IE5


Environment
    Description "TEST SCRIPT"
    Mode HTTP
    WAIT UNIT MILLISECONDS


Definitions
    Include         "RESPONSE_CODES.INC"
    Include         "GLOBAL_VARIABLES.INC"
    CONSTANT        DEFAULT_HEADERS = "Host: www.goldb.org^J" &
                        "User-Agent: OpenSTAzilla/4.0"
    Integer         USE_PAGE_TIMERS
    Timer           T_Response
    CHARACTER*32768 logStuff, Local
    CHARACTER*512   USER_AGENT
    CHARACTER*256   MESSAGE


Code
    Entry[USER_AGENT,USE_PAGE_TIMERS]

    Start Timer T_Response

    PRIMARY GET URI "http://www.goldb.org/index.html HTTP/1.0" ON 1 &
        HEADER DEFAULT_HEADERS &
        ,WITH {"Accept: */*", "Accept-Language: en-us"}

    SYNCHRONIZE REQUESTS
    
    DISCONNECT FROM 1
    
    End Timer T_Response
  
Exit


ERR_LABEL:
    If (MESSAGE <> "") Then
        Report MESSAGE
    Endif

Exit

Nothing much to see here. If you use the OpenSTA recorder and record a simple HTTP GET request, it would generate a similar script for you.

Post a Comment