Software QA FYI - SQAFYI

Mercury WinRunner FAQ

Part:   1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25   26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45 

Q: How does winrunner invoke on remote machine?

Steps to call WinRunner in remote machine:
1) Send a file to remote machine particular folder (this may contains your test parameters)
2) write a shell script listener & keep always running the remotehost (this script will watching the file in folder mentioned in step 1)
3) write a batch file to invoke the winrunner, test name & kept it in remote machine
4) call the batch file thru shell script whenever the file exist as mentioned in step1


Q: WinRunner: How to connect to ORACLE Database without TNS?


The following code would help the above problem.
tblName = getvar("curr_dir")&table;
ddt_close_all_tables();
resConnection = "";
db_disconnect("session");
rc = ddt_open(tblName, DDT_MODE_READ);
if (rc != E_OK)
pause("Unable to open file");
else
{
dvr = ddt_val(tblName,"DRIVERNAME");
tnsName = ddt_val(tblName,"SERVER");
user = tolower(ddt_val(tblName,"UID"));
pass = tolower(ddt_val(tblName,"PWD"));
host = ddt_val(tblName,"HOSTNAME");
port = ddt_val(tblName,"PORT");
pro = toupper(ddt_val(tblName,"PROTOCOL"));
resConnection = db_connect("session", "driver="dvr";Database="tnsName";hostname="host";port="port";protocol="pro";
uid="user"; pwd="pass";");

if (resConnection != 0)
{
report_msg("There is a problem in connecting to the Database = "&tnsName&", Check it please..");
treturn;
}
else
{
report_msg("Connection to the Database is successful..");
rsEQ1 = db_execute_query("session","your database query",record_number1);
}
db_disconnect("session");
}
How to use this:
Assume you have saved the script in c:\winrunner as dbconnect
Save data table at same location, ie c:\winrunner as dbdetails.xls

give call to dbconnect from other script which aslo saved at same location
c:\winrunner as ==>call dbconnect("dbdetails.xls");
Because the above script is using getvar("curr_dir") function to get the current directory, looks at the same location for data table.


Q: WinRunner: How to Verify the data in excel spread sheet
[ A list box which is displaying report names and below that there is a multi line text box provided which is displaying the description of the report corresponding to each report. Able get all the descriptions by using below for loop. But have to verify against excel spread sheet where report descriptions are stored . please guide "how to proceed?"

list_get_info("Listbox1","count",count);
for(num = 1; num < count; num++)
{
row = num + 1;
list_select_item("Listbox1", "#"&num);
list_get_info("Listbox1","value",val);
report_msg(val);
edit_get_text("Textarea1",s) ;
report_msg(s);
}

#Open the excel spread sheet
# suppose spread sheet having 2 fields, Report_name and report_des
table = "E:\\test\\Datadriven\\default.xls";
rc = ddt_open(table, DDT_MODE_READ);
if (rc!= E_OK && rc != E_FILE_OPEN)
{
#loop the list box items
for(num = 0; num < count; num++)
{
list_get_info("Listbox1","value",val);
ddt_get_row_count(table,table_RowCount);
for(table_Row = 1; table_Row <= table_RowCount; table_Row ++)
{
ddt_set_row(table,table_Row);
report_name = ddt_val(table, "report_name");
if ( val == report_name)
{
report_des = ddt_val(table, "report_des");
# Compare the report description
}
}
}
}


Q: WinRunner: While invoking Win Runner, the error message displays
"The testing tool will be terminated because an error has occured.
Please look at the file:
C:\DOCUME~1\ADMI~1\LOCALS~1 \Temp\wrstderr
for more details."

Go to processes TAB on Task Manager panel and kill following processes
wrun.exe
crvw.exe
six_agnt.exe and wowexec.exe
Kill NTVDM.EXE and CRVW.EXE processes from task manager.

Once you have killed the winrunner process you need to remove the icon from the windows task bar which causes this error.Once done you can safely restart winrunner


Q: WinRunner: How to use data driven technology in GUI Check points for Objects ?

Here is a sample code which writen for web enviourment
web_obj_get_text("Client Name","#1","#3",text," "," ",1);
if(text==ddt_val(table,"WaveDesc")){
report_msg("done");
}
else
{
report_msg("Not Done");
}
so in each recursion it will check the text with data stored in the excell sheet. And the report's result will give a progress.


Q: How to handle 'Timeout expired' problem in WinRunner when dealingwith Complex SQL Queries??

While creating DSN which option you have selected for authenticity. If you have selected Windows NT authentication then no need to Enter userId and password or if you have selected SQL Server authentication then you need to enter userID and password during DSN creation it self.
Enter database user name and password while creating DSN. the script as follows:-
dbstatus = db_connect("GetRecs", "DSN=dsn name", 30);
if (dbstatus !=0)
{
report_msg ("GetRecs-FAILED-Could not open Database");
treturn("Stop");
}

Part:   1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25   26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45 

Mercury WinRunner FAQ