Results 1 to 9 of 9

Thread: how can i write user define functions in LoadRunner Script?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Oct 2007
    Answers
    4

    Question how can i write user define functions in LoadRunner Script?

    hi

    how can i write user define functions in LoadRunner Script? and can u explain below functions?


    __declspec (dllexpert) char* (char*, char*)


  2. #2
    Contributing Member
    Join Date
    Nov 2007
    Answers
    88

    Re: how can i write user define functions in LoadRunner Script?

    yes, u can write the usedefined functions ...


  3. #3
    Expert Member
    Join Date
    Oct 2007
    Answers
    375

    Smile Re: how can i write user define functions in LoadRunner Script?

    hi Swamy,

    Yes we can create User-defined functions in LR. But when using User-defined functions to subsitute paramter values, you would have to create a external DLL library for the same.

    This is achieved by using the syntax u had specified -

    __declspec(dllexport) char *(char *, char *)

    Both the arguments passed are NULL for this function.

    An User-defined function could be :
    __declspec(dllexport) char *GetSysDate(char *, char *)

    This would return the system date. You could substitute this returned value for a parameter instead.

    Do revert back incase of any queries.....

    Cheers....
    Bizzzzzare


  4. #4
    Contributing Member
    Join Date
    Sep 2007
    Answers
    50

    Re: how can i write user define functions in LoadRunner Script?

    To add my two cents:

    Once the .dll is created (in Visual Studio or some other Microsoft Tool) you can use the following command in the LoadRunner script to use the functions directly from the .dll.

    lr_load_dll("mydll.dll")

    Then you can call the functions in the .dll directly:
    date = GetSysDate(char1, char2)


    Good Luck and let us know if you have any questions regarding this.


  5. #5
    Junior Member
    Join Date
    Oct 2007
    Answers
    4

    Re: how can i write user define functions in LoadRunner Script?

    Quote Originally Posted by SW_LoadRunnerGuru View Post
    To add my two cents:

    Once the .dll is created (in Visual Studio or some other Microsoft Tool) you can use the following command in the LoadRunner script to use the functions directly from the .dll.

    lr_load_dll("mydll.dll")

    Then you can call the functions in the .dll directly:
    date = GetSysDate(char1, char2)


    Good Luck and let us know if you have any questions regarding this.
    thanks for giving answer actually i didn't understand that what is this char1, char2 and pls can u explain with full detail it will better for me


  6. #6
    Contributing Member
    Join Date
    Sep 2007
    Answers
    50

    Re: how can i write user define functions in LoadRunner Script?

    char1 and char2 and the names of my variables that I'm passing into the function. These variables could've been named anything I wanted to name them.


  7. #7
    Junior Member
    Join Date
    May 2007
    Answers
    5

    Re: how can i write user define functions in LoadRunner Script?

    You can also define other user defined functions within a header file to be called within the script. This process is followed in most of the situations as working with DLL is costlier for simple functions which can be created within a header file.


  8. #8
    Junior Member
    Join Date
    Jan 2014
    Answers
    6

    Re: how can i write user define functions in LoadRunner Script?

    I have a website which generates a "session id" and I couldn't find it in correlation both manual as well as in auto as it is a hidden parameter.

    If I want to declare a user generated function which will store the session id as string and ignore in the script when it comes.

    Please help me regarding this.


  9. #9
    Junior Member
    Join Date
    Jan 2014
    Answers
    6

    Re: how can i write user define functions in LoadRunner Script?

    Anybody ??


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact