Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

how can i write user define functions in LoadRunner Script?

This is a discussion on how can i write user define functions in LoadRunner Script? within the LoadRunner forums, part of the Software Testing category; hi how can i write user define functions in LoadRunner Script? and can u explain below functions? __declspec (dllexpert) char* (char*, char*)...

Go Back   Geeks Talk > Software Testing > LoadRunner
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 11-26-2007
Junior Member
 
Join Date: Oct 2007
Location: Anantapur
Posts: 5
Thanks: 1
Thanked 2 Times in 2 Posts
bnswamyATP is on a distinguished road
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*)
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-26-2007
Contributing Member
 
Join Date: Nov 2007
Posts: 53
Thanks: 16
Thanked 7 Times in 5 Posts
srinii_vasu is on a distinguished road
Re: how can i write user define functions in LoadRunner Script?

yes, u can write the usedefined functions ...
Reply With Quote
  #3 (permalink)  
Old 11-26-2007
Expert Member
 
Join Date: Oct 2007
Location: Mumbai
Posts: 354
Thanks: 4
Thanked 58 Times in 47 Posts
bizzzzzare will become famous soon enough
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
__________________
Regards,

V.Umesh Krishnan
QA Consultant
Reply With Quote
  #4 (permalink)  
Old 11-30-2007
Contributing Member
 
Join Date: Sep 2007
Posts: 50
Thanks: 0
Thanked 2 Times in 2 Posts
SW_LoadRunnerGuru is on a distinguished road
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.
Reply With Quote
  #5 (permalink)  
Old 12-01-2007
Junior Member
 
Join Date: Oct 2007
Location: Anantapur
Posts: 5
Thanks: 1
Thanked 2 Times in 2 Posts
bnswamyATP is on a distinguished road
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
Reply With Quote
The Following User Says Thank You to bnswamyATP For This Useful Post:
  #6 (permalink)  
Old 12-17-2007
Contributing Member
 
Join Date: Sep 2007
Posts: 50
Thanks: 0
Thanked 2 Times in 2 Posts
SW_LoadRunnerGuru is on a distinguished road
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.
Reply With Quote
  #7 (permalink)  
Old 11-18-2008
Junior Member
 
Join Date: May 2007
Location: Hyderabad
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
raj808 is on a distinguished road
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.
Reply With Quote
Reply

  Geeks Talk > Software Testing > LoadRunner

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Can you write your own utility functions in QTP Geek_Guest QTP 1 12-21-2007 07:20 PM
Script Interaction User Defined Functions rashmi1 Testing Templates 0 08-31-2007 08:40 PM
How do we write script in expert view Geek_Guest QTP 0 06-08-2007 10:25 PM
Any help available for starters with user defined functions vjlaxmi QTP 2 04-04-2007 10:43 AM
how should we write the script? abraham_ahmed Testing Issues 4 02-15-2007 05:05 AM


All times are GMT -4. The time now is 03:35 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved