Blog

  • VuGen: Detailed Logging

    Posted on September 19, 2012 by Admin

    The purpose of this VuGen code is so you have one place to enter the URL for the application and grab all the Load Generator and Controller information, and send it to the execution output logs for troubleshooting purposes. Variables are set at top of the action file that it can be changed by modifying one line of code instead of all the code within the script.

    Put this code in the vuser_init() section of the script outside the vuser_init function
    //*******************************************************************
    //* GLOBA Read Entire Entry

  • More Old School Vugen Code For Randomization

    Posted on September 17, 2012 by Admin

    Here is some old code I had laying around which simply illustrates how to randomize a VuGen parameter by using srand and randomizing a value used within the array. This assumes you are grabbing multiple values in the array using the web_reg_save_param() function with the ORD=ALL argument.
    // Randomize based on total numbers of Beneficiaries and selecting one

    srand( time(NULL) );
    rnum1 = (rand () % atoi(lr_eval_string(“{pBeneficiary_count}”)) +1);

    // Merge Parameter to include the random number just selected

    spri Read Entire Entry

  • VuGen: Make SOAP Calls With The SOAP/WEB Protocol

    Posted on September 10, 2012 by Admin

    This post will attempt to explain how VuGen SOAP calls look by comparing the WEB/HTTP protocol and the SOAP protocol. Below is an example of raw XML that is received from a request.
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <soap-env:Envelope xmlns:soap-env=”http://schemas.xmlsoap.org/soap/envelope/”>
    <soap-env:Header>
    <Authentication soap-env:mustUnderstand=”1″>
    <UserID>xxxx</UserID>
    <Password>xxxx</Password>
    </Authentication>
    <Appl Read Entire Entry

  • VuGen: Find A Shorter String Within A Longer One

    Posted on September 3, 2012 by Admin

    We had a web application which was easy to script, but had an unusual situation dealing with the business rules that we had to work around. This was an application where users update their personal information, emergency contacts, and other forms.

    The problem was the Emergency Contacts. Since this was a brand new application to the company, most users would not have anything listed and would need to input this information. The first time the user accesses the page, they would get a message that they are required to have at least on Read Entire Entry

  • Run A Windows Batch Program From LoadRunner VuGen

    Posted on August 29, 2012 by Admin

    I am surprised that many people who script with LoadRunner on a regular basis do know know that you can run external programs in Windows that are kicked off by code in Vugen scripts. The system() function allows you to do this. There have been times where I needed to run a portion of a script and then kick off a program that would run on my local machine for a few minutes. I created a Windows Batch (.BAT) file with it’s own set of instructions on running and how to exit out. When I am ready to kick this BAT file off, I just put one Read Entire Entry

  • LoadRunner Run-Time Settings: Additional Attributes

    Posted on August 27, 2012 by Admin

    Many times I want to set up Vugen scripts so that I can easily move from one environment to another. Often, the environment being tested if not the same one I script in because of logistics in getting the environments ready. Without getting into the issue of poor configuration management between environments screwing up your scripts – and most LoadRunner scripters know how bad of a problem this is –  I wanted to demonstrate the use of the “Additional Attributes” run-time setting to easily change environments without changing the Read Entire Entry

  • VuGen Custom Function: Right

    Posted on August 22, 2012 by Admin

    Today’s posting comes courtesy of Brian Wilson of TechSouth Consulting. This is a completely working example of Right() (rightmost characters) just like you can do in VB. I’d create a library of functions like this in a header (.h file) and include them in your scripts where you’re doing string manipulation.
    char* Right(char* String, char* TempBuffer, int Nr)
    {
    if(strlen(String) >= Nr)
    {
    strcpy(TempBuffer, &String[strlen(String) – Nr]);
    TempBuffer[Nr] = ‘\0’;
    return TempBuffer;
    }
    else return Strin Read Entire Entry

  • VuGen Custom Function: Left() (leftmost characters)

    Posted on August 20, 2012 by Admin

    Today’s code is courtesy of Brian Wilson of TechSouth Consulting. This is a completely working example of a VuGen Left() (leftmost characters) function, just like you can do in VB. I’d create a library of functions like this in a header (.h file) and include them in your scripts where you’re doing string manipulation.
    char* Left(char* String, char* TempBuffer, int Nr)
    {
    if(strlen(String) >= Nr)
    {
    strcpy(TempBuffer, String);
    TempBuffer[Nr] = ‘\0’;
    return TempBuffer;
    }
    else return String;
    }

    int vuser_ini Read Entire Entry

  • Vugen: RTE Custom Function – CheckForErrors()

    Posted on August 15, 2012 by Admin

    Today’s updated comes courtesy of Brian Wilson of TechSouth Consulting. This is a function for the RTE protocol called CheckForErrors(). It checks for specific errors and returns the application state to the initial iteration state. Use this as a starting point to create your own conditions to check for, as the ones here are specific to the application being tested at the time. The point here is to demonstrate the stricmp function to check for various condition matches.
    Usage : CheckForErrors()
    CheckForErrors(int icount)
    {
    char Read Entire Entry

  • Vugen: Writing To An External Log File

    Posted on August 13, 2012 by Admin

    Writing information to the Vugen execution log file is pretty basic stuff, but what happens when you need to write data to an external log file on your the local drive? I can think of a few reasons you might want to do this, but there are a couple of ways I have found using some basic ANSI C code, and I keep this handy in case I ever need it.
    This first example prototypes the memset function at the beginning of the init section.
    That would look like this:

    extern int memset (char *, int, int);
    Declare some variables needed at the to Read Entire Entry