MyITBlog.com - IT Professionals Online Journal
 
  Home  |   Site News  |   About Us  |   Privacy  |   FAQ  |   Contact   Add Blog Entry  |  Login  |  Register   
 My Account
Username
Password
Remember me
Lost Password?


 Categories


  HOME  >  Programming  >  TestingPrint


0
Votes
WinRunner - Advantages of using Compiled Module in Testing   
by jkodadhala on 15 Nov 2005, 05:34     Read jkodadhala's Blog
Total Hits: 3549    Comments: 0   

A Compiled Module is a script containing a library of user-defined funtions that you want to call from other scripts or test runs.When you load a compiled module , its functionas are automatically compiled and remain in memory.


Test script can call those functions directly from with in test.

Important note is that this script should be saved as compiled module in WinRunner.


Other benefits by using Compiled module.

 

1)You can declare public variables and these variables can be used any where in test where this compiled module has been called.

 

2)Create variables which has values of
A)lengthy file name paths (network drive file path or local drive file path)
B)Database connection strings
C)Browser URLs

 

use these variables in test scripts where ever you want.The main advantage using this method is when file somehow replaced different location in system , you don't need to change the file path in each script.


3)you can declare winrunner default message or custom error messages.
example:
public const E_NOT_OPEN               = -20011;
public const E_INVALID_INPUT          = -20005;

4)Create public Arrays so that these arrays can be called any script.

 


here is the small example for user defined function

 

#**********************************************************************
# Function Name  :fYearDateTime  
#         
# Description : fYearDateTime function takes current system time 
#         and date and passes those value into variables.
#
#
#**********************************************************************
public function fYearDateTime(inout year,inout date,inout date_time,inout nospaces)
{
static a[]={"total"};
auto i,rc,mytime,split_arr[];
mytime=time_str();
a["total"]=mytime;
rc=split(a["total"],split_arr," ");
a["total"]="";
for(i=1;i<=rc;i++)
{
a["total"]=a["total"] & split_arr[i];
}

nospaces=a["total"];
year=substr(mytime,21,4);
date=substr(mytime,5,6);
date_time=substr(mytime,9,11);
}

 

Now date , time , year variable values can be used in any script to compare with other existed date fields for validation ( future date validation , past data validation , AM, PM validation )


 

Post Comment

Copyright © 2008 MyITBlog.com