Vous êtes sur la page 1sur 9

1. To set the Focus to the particular window.

Set_window ("Logical Name of the Window",time in millisecods");

Example
Set_window ("Calculator", 100);

2. How to check whether the edit box is displayed in the page?


set_window("calculator",100);
If (obj_exists ("Logical Name of the editbox", 100) == E_OK)
{
tl_step ("Checking whether the edit box is displayed in the Calculator
page",0,"The edit box is displayed");
}
else
{
tl_step("Checking whether the edit box is displayed in the Calculator
page",1,"The edit box is displayed");
}

3. Purpose of the tl_step command?


tl_step is used to print the status message.
tl_step("Description of the test case",status,"Actual Result");
status - 0 [Pass] or 1 [Fail]

4. Getting the path name of the test script?


path = getvar("testname");

5. What is the difference between Call and Call_close statement?


call test_name ( [ parameter1, parameter2, ... parametern ] );
call statement is used to invoke a test from within a test script.
call_close test_name ( [ parameter1, parameter2, ... parametern ] );
invokes a test from within a script and closes the test when the test is completed.

6. How to enter the values in the edit box using WR?


edit_set("Logical Name of the edit box","RTG");

7. In case edit_set statement is throwing the error message while entering the value
thru WR.What is the other alternate way to do that?
obj_type("Logical Name of the object","String Value");
Example
obj_type("Logical Name","RTG");

8. How to find the tool tip text for the object?


obj_get_info("Logical name of the object","alt",outValue);
"alt" is the name of the property for getting the tool tip text.
For web based
web_obj_get_info("Logical name of the object","alt",outValue);

9. How to select the value from the combo box or List?


list_select_item("Object name of the List box","Value to be selected");
Example : list_select_item ("Fly From:", "Frankfurt");

10. How to get the total no of elements in the list box?


list_get_info("Object name of the List box","count",outValue);
count is the property used to get the total no of elements.
outValue is the output value from the statement.

11. What is the purpose of the db_check statement?


It is used to compare current database data to expected database data.
db_check ( checklist, expected_results_file [ , max_rows [ , parameter_array ] ] );

Example:
db_check("list1.cdl", "dbvf1");
list1.cdl is the check list file which contains the actual data.
dbvf1 is the expected data.

12. How to execute the DOS command line function using WinRunner?
dos_system("DOS Command Line function");
Example:
dos_system("ipconfig > C:/ip1.txt");
The above example is to copy the IP information of the maching to the Text file.

13. How to invoke the browser from the WR?


web_browser_invoke ( browser, site );
invokes the browser and opens a specified site.

Example : web_browser_invoke(IE,"www.readytestgo.com");
supported browser : IE and Netscape 6.

14. What is the purpose of add_record_attr statement?


It is used to register the custom property.

add_record_attr ( attr_name, dll_name, query_func_name, verify_func_name );


attr_name The name of the custom property to register. This cannot be a
standard WinRunner property name.
dll_name The full path of the DLL in which the query and verify functions
are defined.
query_func_name The name of the query function included in the DLL.
verify_func_name A WinRunner standard property verification function (see
below) or a custom property verification function included in the DLL.
15. How will you add the objects dynamically to the GUI for a web based appln?

web_obj_get_child_item(object, table_row, table_column, object_type, index,


out_object);
split(out_object,arr,"\"");
GUI_add ( file path, window, object, physical_desc );
// perform some operation on the object.
GUI_delete ( file, window, obj );

16. How to connect the database from WR?


db_connect ( session_name, connection_string [, timeout] );

Example:
db_connect ("query1","DSN=Flight32",30);
connection string should be created manually.

17. How will you write the record set from the database to the text file?

db_write_records ( session_name, output_file [ , headers [ , record_limit ] ] );

session_name The logical name or description of the database session.


output_file The name of the text file in which the record set is written.
headers An optional Boolean parameter that will include or exclude the
column headers from the record set written into the text file.
record_limit The maximum number of records in the record set to be written
into the text file. A value of NO_LIMIT (the default value)
indicates there is no maximum limit to the number of records in the
record set.

Example:
db_write_records("query1","c:\\query1.txt",TRUE,5);

18. What is the purpose of the db_execute_query?

db_execute_query ( session_name, SQL, record_number );


This statement executes the query based on the SQL statement and creates a
record set.

session_name The logical name or description of the database session.


SQL The SQL statement.
total_records An out parameter returning the number of records in the result
query.

Example: db_execute_query ("query1","SELECT * FROM Orders",


total_records);
19. What is the purpose of db_disconnect statement?
disconnects from the database and ends the database session.

db_disconnect ( session_name );
session_name The logical name or description of the database session.
The db_disconnect function disconnects from the session_name database session.

20. What is the purpose of db_get_field_value?

It returns the value of a single field in the database.

db_get_field_value ( session_name, row_index, column );


session_name The logical name or description of the database session.
row_index The index of the row written as a string: "# followed by the
numeric index. (The first row is always numbered "#0".)
column Either the name of the field in the column, or the index of the
column within the database written as a string: "# followed by
the numeric index. (The first column is always numbered "#0".)

Example :
val = db_get_field_value ("query1","#1","#1");
val = db_get_field_value ("query1","#1","Customer_Name");

21. What is the purpose of Load command?


It loads a compiled module into memory.

load ( module_name [,1/0 [,1/0 ] ] );

module_name A string expression indicating the name of an existing compiled


module.

1|0 1 indicates a system module. 0 indicates a user module. The default value
is 0.
1|0 1 indicates that a user module will not remain open after it is loaded.
0 indicates that the module remains open in the WinRunner window. The
default value is 0.

Limitations for the compiled module


1. Only one compiled module can be loaded in a single test script at a time.
2. If you are working on GUI Map per test mode then GUI Map file cannot be
loaded inside the compiled module.
3. Analog statements are not allowed.

GUI_buf_get_desc Returns the physical description of an object in a GUI map


file.
GUI_buf_get_desc_attr Returns the value of an object property in a GUI
map file.
GUI_buf_get_logical_name Returns the logical name of an object in a GUI map
file.
GUI_buf_new Creates a new GUI map file.
GUI_buf_set_desc_attr Sets the value of a property in a GUI map file.

22. How to get the text from the web page?


win_get_text ( window, out_text [, x1, y1, x2, y2] );

window The window from which text is read.


out_text The output variable that holds the captured text.
x1,y1,x2,y2 An optional parameter that defines the location from which to read
text relative to the specified window in pixels.

The coordinate pairs can designate any two diagonally opposite corners of a
rectangle. The interpreter searches

for the text in the area defined by the rectangle.

23. How to get the value from frame window?


web_frame_get_text ( frame, out_text [, text_before, text_after, index ] );
eg:
web_frame_get_text("MainFrameData",text,"","",1);
x = index(text, "Search ARM Version");

24. How to select item from the menu?


menu_select_item ("Test Life Cycle");

25. How will check whether all the menu item are present in the menu or not?
menu_get_info("Test Process","count",outVal);
for(i=1;i<=outVal;i++)
{
menu_get_item("Test Process",i,mnuName);
report_msg(mnuName);
if(...)
{

}
}

26. What is batch test? How will you create the batch test?
using batch test mode you can call your test one by one using call or call_close
statement.
The main purpose is to execute all the test scripts at one shot.
eg:
strTestName = path & "\\..\\yourtest";
result = eval("call_close \"" & strTestName & "\"();");

27. How will you compare 2 columns in the Excel sheet?


Open the Excel Sheet using ddt_open(tablename,ddt_mode_read);
Get the row count of the Excel Sheet using

ddt_get_row_count ( data_table_name, out_rows_count );


for (i=1;i<=rows_count;i++)
{
ddt_set_row(data_table_name, i);
Get the value from the column1
a = ddt_val_by_row ( data_table_name, row_number, parameter );
Get the value from the column2
b= ddt_val_by_row ( data_table_name, row_number, parameter );
Comparison
if (a==b)
{
}
}

28. Can we have a single session for connecting multiple database?


Yes, You can connect two different database using the same session name.

29. What are the types of GUI Modes?


Global GUI Map Mode
GUI Map Per Test Mode

30. How to read the values from the Text file?


file_open("C:\\readme.txt",FO_MODE_WRITE);
i=0;
while(file_getline("C:\\readme.txt",line)==0)
{
i++;
file_printf("C:\\readme2.txt","%d "&toupper(line),i);
}
file_close("C:\\readme.txt");

31. What are all the Add-in's you used?


Java Add-in
VB
PB
Active-X
Web Test

32. Which window is active when two windows are open?


win_get_info ( window, property, out_value );
win_get_info("logical Name of the window","active",outValue);
if outValue = 1 means the Window is Active
if outValue = 0 means the Window is Inactive

33. What is the diff. between combobox and ListBox


Both controls are treated as the Class : List.
In the Combo box the user can select only one value where as in the List box the
user is having the liberty to select multiple values

34. How t o check the values in the combobox are alphabetical order or not?

35. How to add GUI info at runtime?


GUI_add ( file path, window, object, physical_desc );

36. What are all the problems which you faced in your earlier winrunner project?
Handling the dynamic objects.
Handling the Excel Sheets.

37. What are all the possible ways of connecting to the database?
1. using DSN

38. What are all the various types of exceptions?


TSL exception
Object Exception
Pop-up exception

39. How do you retrieve the values from and update to excel?
ddt_open
ddt_get_row_count
ddt_val
ddt_set_val

40. What are all the various checkpoints available in the WinRunner?
GUI Checkpoint (object,window, multiple objects)
Bitmap Checkpoint (screen area, bitma)
Database Checkpoint (custom check,default check,runtime check)
Syncronization checkpoint

41. Can we do performance testing using WR?

42. What is the configuration management tool used for the project?

43. What type of testing can be performed using WR?

44. How to assign a value to the variable at runtime?


45. What are the types of functions available in WR?
Analog functions - perform mouse and keyboard input
Context Sensitive functions - perform operations on GUI objects
Standard functions perform - basic programming-language operations
- Arithmetic, Array, Call statements, Compiled module, Exception handling,
I/O, Load testing, Miscellaneous,
Operating system, Password, QuickTest 2000, String, TDAPI,
TestDirector, Testing option/Configuration

parameter, Time-related
Customization functions - configure the testing tool according to your
requirements

46. What are all the various DataTypes available in the winrunner and their scope?
Auto - An auto variable can be declared only within a function and is local to that
function. It exists only for as long as the function is

running. A new copy of the variable is created each time the function is called.
static - A static variable is local to the function, test, or compiled module in which
it is declared. The variable retains its value untilthe test is terminated by a Stop
command.

public - A public variable can only be declared within a test or module, and
is available for all functions, tests, and compiled modules.

extern - An extern declaration indicates a reference to a public variable


declared outside of the current test or module.

47. How to stops execution of the current test?.


texit - to stop execution of the current test.

48. What is the diff. between pause() and wait() statement?


pause() - Pauses test execution and displays messagebox.
wait() - The wait function pauses test execution for the specified interval.

49. What are all the various type of string functions?


ascii Returns the ASCII code of the first character in a string.
compare_text Compares two strings.
index Indicates the position of one string within another.
length Counts characters in a string.
match Finds a regular expression in a string.
split Divides an input string into fields and stores them in an array.
sprintf Returns a formatted string to a variable.
substr Extracts a substring from a given string.
tolower Converts uppercase characters to lowercase.
toupper Converts lowercase characters to uppercase

50. What is the difference between web_sync() and wait()?


web_sync() - waits for the navigation of a frame to be completed.
wait() - The wait function pauses test execution for the specified interval.

Vous aimerez peut-être aussi