Pages

Wednesday, January 4, 2012

Testing : WinRunner

Subject: Testing : WinRunner

Questions 

1. Give one line answer about WR? 
Ans. WinRunner helps you automate the testing process, from test development to 
execution. You can create adaptable and reusable test scripts that challenge the 
functionality of your application. Prior to a software release, you can run these 
tests in a single overnight run—enabling you to detect defects and ensure 
superior software quality. 
2. How do you define WR on your own? 
Ans. WR can be used for functional testing for both the Desktop and Web based applications. 
3. WR is suitable for which type of applications? 
Ans. WinRunner is suitable for any type of application whether it is a desktop application, web application or a client server application. 
4. What kind of applications WR suits? 
Ans. Visual Basic, Power Builder, Active-X, Java and Web Applications 
5. What are all the different types of recordings available in WR? 
Ans. WinRunner has 2 types of recording modes namely 
a. Context Sensitive Recording mode : identifies the GUI objects with their logical names 
b. Analog Recording Mode : identifies the GUI objects based on the screen coordinates 
6. When do you go for Context Sensitive and Analog? What's the difference between them? 
Ans. Analog is opted when we perform GUI Testing and Context sensitive for Functionality testing. 
7. What's the WR version no you used for your applications? 
Ans. I have been working with WinRunner Version Number 7.0. 
8. What is Module? What's Compiled Module? 
Ans. Compiled modules are libraries of frequently-used functions. You can save user defined functions in compiled modules and then call the functions from your test scripts. 
A compiled module is a script containing a library of user-defined functions that you want to call frequently from other tests. When you load a compiled module, 
its functions are automatically compiled and remain in memory. You can call them directly from within any test. 
A module is a separable part of the system which can be executed individually. 
9. What are User Defined Functions? What are all the different types of Functions available in WR? What is Function? Types of Functions? 
Ans. The Functions which are written by the user to accomplish a specific functionality of his requirement are called user defined functions. The user defined functions are stored in a compiled module so that any test can use this function after loading the compiled module. 
The different types of functions in WinRunner are 
a. Context Sensitive Functions 
b. Analog Functions 
c. Standard Functions 
d. Custom Functions 
10. Where do you use Private/Public function in your script? 
Ans. A private function defined in a script can be used/called from only that script where as a public function can be used/called from any script. 
11. How do you forcibly capture an Object using WR (when WR not able identify it)? 
Ans. GUI Map Configuration 
12. How TSL looks like? What are all the default files does WR generate when you create a script? 
Ans. TSL looks like c language. In fact its c only. The files/folders that are generated by WinRunner when a script is created is db, exp and res. 
13. What is the extension for the check points? 
Ans. The extension for the checklist are .ckl 
14. How do you invoke an application using TSL? 
Ans. Using Invoke_application function. 
15. What's the use of GUI Map Editor? 
Ans. GUI Map Editor is used to record the objects in the Current Window of your application. 
16. What's Data Driven Test? 
Ans. Testing the same set of functionality using WinRunner with different inputs is called Data Driven Testing. 
17. What's the File Format used in Data Table? 
Ans. The File Format used for Data Table in Data Driven Testing in WinRunner is Microsoft Excel. 

18. How do you link a Data Table in your script? 
Ans. Using the ddt_open function in TSL we will be linking to the data table from our script. 
19. What are all the different languages that can be called using TSL in between the scripts? 
Ans. Mostly C language 
20. What are all the Limitations & Advantages of WR? 
Ans. You cannot install WinRunner 7.0 over network installations of previous versions of WinRunner. 
Workaround: When performing a network installation of WinRunner, either remove installations of previous versions first, or install the new version in a different location. 
Refer ReadMe document ….for more number of limitations 
21. Where do you find that WR cannot be used for automation? 
Ans. Automation is not preferred if the project size is small, manual intervention is necessary. 
22. What is meant by Synchronization? How do you implement it in WR? 
Ans. A synchronization point in your test script instructs WinRunner to 
suspend running the test until the application being tested is ready, and then to 
continue the test. 
23. What is meant by Checkpoints? Types of Checkpoints? In what situation will you use it? 
Ans. Checkpoints allow you to compare the current behavior of the application being 
tested to its behavior in an earlier version. Various check points are 
• GUI Checkpoint 
• Bitmap Checkpoint 
• Database Checkpoint 
• Text checkpoints 
24. How do you handle an Exception in WR? Types of Exception available in WR? 
Ans. Exceptions in WinRunner are handled using the Exceptional Handling Concepts. And the different types of exceptions available in WinRunner are as follows: 
• Pop-up exceptions: Instruct WinRunner to detect and handle the appearance of a specific window. 
• TSL exceptions: Instruct WinRunner to detect and handle TSL functions that return a specific error code. 
• Object exceptions: Instruct WinRunner to detect and handle a change in a property for a specific GUI object. 
• Web exceptions: When the Web Test add-in is loaded, you can instruct WinRunner to handle unexpected events and errors that occur in your Web site during a test run. 
25. How do you define an Exception for complete application or for a particular function? 
Ans. We first define a TSL Function and then write a handler function in the compiled module for that exception and load that particular compiled module in the script in which you want to handle the exception through out the application…mostly in the main script. 
26. What are all the different platforms that WR can be used? 
Ans. WinRunner can be used only on Windows Platforms namely Windows 95, Windows 98, Windows NT, Windows 2000 and XP(wr ver 7.5). 
27. What does GUI Spy mean? 
Ans. GUI Spy is used to identify the properties of an object on the desktop. 
You can use the Spy pointer to point to an object, and the GUI Spy displays the properties and their values in the GUI Spy dialog box. You can choose to view all the properties 
of an object, or only the selected set of properties that WinRunner learns. 
28. Can you test DB using WR? What are all the different DB Checkpoints that WR can support? 
Ans. Yes we can check the database using WinRunner. There are all together 3 types of database checkpoints in WinRunner namely Default Database Checkpoint, Custom Database Checkpoint, and Runtime Database Checkpoint. 
29. How do you set a Query to get/fetch data from the DB? 
Ans. We can do that in two ways one is using the wizard and another is writing the script manually in winrunner. 
The second method is as follows: 
#db_connect("Test","DSN=test"); 
if (db_connect("Test","DRIVER=SQL Server;SERVER=Rani;UID=sa;APP=Microsoft Development Environment;WSID=RANI;DATABASE=BugTracker;LANGUAGE=us_english;User Id=sa;PASSWORD=;")==E_OK) 

query="SELECT UserID, UserName, TeamName, PhoneExt,LoginName, Password FROM UserDetails"; 
#db_check("list1.cdl", "dbvf1"); 
db_execute_query("Test",query,recordnum); 
report_msg("The no of records returned is "&recordnum); 
db_write_records("Test","c:\query.txt",TRUE); 
db_disconnect("Test"); 

else 
report_msg("Not Connected"); 
30. Apart from Record and Replay what else can be done using WR? 
Ans. store and replay, customization based on user requirements, integration with test management tools like test director, etc.. 
31. What are different types of Test Run Modes? 
Ans. Verify/Debug/Update Modes 

32. When do you use Verify/Debug/Update Modes? 
Ans. 
• Verify mode, to check your application. WinRunner compares the current response of your application to its expected response. Any discrepancies between the current and expected responses are captured and saved as verification results. When you finish running a test, by default the Test Results window opens for you to view the verification results. 
• Debug mode, to debug your test script. Running a test in Debug mode is the same as running a test in Verify mode, except that debug results are always saved in the debug folder. Because only one set of debug results is stored, the Run Test dialog box does not open automatically when you run a test in Debug mode. Once you run a test in Debug mode, that remains the default run mode for the current WinRunner session until you activate another mode. 
• Update mode, to update the expected results or to create a new expected results folder. For example, you could update the expected results for a GUI checkpoint that checks a push button, in the event that the push button default status changes from enabled to disabled. You may want to create an additional set of expected results. After a test has run in Update mode or been aborted, Verify automatically becomes the default run mode again. WinRunner saves expected results in the exp folder, overwriting any existing expected results. 
33. When do you use Break Points ? 
Ans. A breakpoint marks a place in the test script where you want to pause a test run. 
Breakpoints help to identify flaws in a script. 
34. What's the role of GUI Map Editor? 
Ans. Its connects logical name in the script to the physical attributes of the object in the GUI Map 
35. What does Function Generator mean? (F7). 
Ans. Function Generator is the repository with system defined functions and also we can organize user-defined functions. 
36. How do you load GUI Map? 
from the GUI MapAns. using the GUI_load function or Editor 
37. What is TSL? Which 4GL is it similar too? 
Ans. TSL is WR scripting language, TSL is based on C language style, TSL has a set of different functions. 
38. What databases can Test Director reside on? 
39. Name a couple of standard web function found in the function generator? And explain their purpose. 
Ans. Web_browser_invoke, web_image_click, web_obj_click, web_refresh,web_label_click, 
Web_link_click, web_sync, web_url_valid 

40. Explain data parameterization in WinRunner.(Refer UserGuide PgNo. 769) 
Ans. Parameterization means dynamically passing different values to the application under test. 
41. Explain the project tree in Test Director. 
42. What's the purpose of the wrun.ini? 
Ans. Stores the configuration related to winrunner's editor 
43. What are the two GUI Map modes available in WR? 
Ans. The two modes of having a GUI Map file are : 
GUI Map file per test mode : A new GUI Map file will be created for each script 
Global GUI Map: A Single GUI Map file is used for all the scripts. 

44. Big + of Winrunner over other market tools viz. silk, robot etc.? 
45. How does Winrunner identify GUI Objects? 
Ans. Winrunner will identify the GUI objects by its "Phy Desc" of particular object. 
46. What is the use of rapid test script wizard? 
Ans. The Rapid Test Script wizard systematically opens the windows in your application and learns the description of every GUI object. The wizard stores this information in a GUI map file. 
47. How will you synchronize tests using WR? When should you synchronize? Synch.settings? 
Ans. A synchronization point tells Winrunner to pause the test run in order to wait for a specified response in the application. 
48. How do you check GUI objects? 
Ans. We can check the GUI objects by GUI Check Points 
49. How do you check a bitmap? 
50. How do you program tests with TSL? 
51. How do you run tests on a new version of WR? 
52. What are data driven tests & How Do you create it in WR? 
Ans. Testing the same set of functionality using WinRunner with different inputs is called Data Driven Testing. Data Driven test can be done through Wizard or manually writing the TSL script. Data driven is available in Tool menu. 
53. How do you read text from an application? 
54. What is a batch test? How do you program a batch test? 
Ans.Running a set of scripts through CALL method is called batch test. 
55. What happens when user interface changes? 
Ans. When user interface changes WinRunner cannot find the objects which are stored in GUI map editor. Then we need to modify the physical description in the Gui Map Editor. 
56. Does load testing possible using WR? 
Ans. Yes. 
57. Does WR help you in web testing? 
Ans. Yes , Winrunner will help in web testing. 
58. How do you manage test data, test result? 
59. Any knowledge of Test Director? 

60. Questions on TSL: How to generate Functions? 

61. Running tests from the command line? 
Ans. 
62. Last question (most imp.): Explain Winrunner Testing Modes? 
Ans. Context Sensitive mode : which identifies the GUI objects with their logical names 
Analog Mode identifies the objects with the screen coordinates
  1. Write a function to retrieve the script name? 
    Ans. call_chain_get_attr ("testname", 0, testnameX); or 
    getvar("testname"); 
    64. Can we read and assign the content of a text file to a variable. 
    Ans. 
    file_open(file_name); 
    str = ""; 
    line=""; 
    while(file_getline(file_name,line)==0) 

    str = str & line; 

    65. How to clear the contents of a text file using WinRunner command? 
    Ans. Open the file with Write mode file_open (filename,FO_MODE_WRITE); 
    66. How to find a item is present in a list or not? 
    Ans. 
    if (list_get_item_number("ListName", "ItemName", number) != E_OK) 

    report_msg("Not in list"); 

    else 

    report_msg("Item is number " & number & " in list"); 

    67. What are the scripts we can include in start up of WinRunner? 
    Ans. 
    You should add the following types of statements to your startup test: 
    • Load statements, which load compiled modules containing user-defined functions that you frequently call from your test scripts. 
    • GUI_load statements, which load one or more GUI map files. This ensures that WinRunner recognizes the GUI objects in your application when you run tests. 
    • Statements that configure how WinRunner records GUI objects in your application, such as set_record_attr or set_class_map. 
    • an invoke_application statement, which starts the application being tested. 
    • Statements that enable WinRunner to generate custom record TSL functions when you perform operations on custom objects, such as add_cust_record_class. 
    68. How to round a number 
    Ans. 
    public function round (num, place) 

    return sprintf ("%."place"f", num); 

    69. What is the difference between tl_return and tl_exit 
    Ans. 
    tl_return is used at the end of a called test. 
    tl_exit is used at the end of normal test. 

    70. How to get focused html frame name? 
    Ans. 
    if (win_exists("{MSW_class: html_frame, focused: 1}",1) == E_OK) 

    win_get_info("{MSW_class: html_frame, focused: 1}","html_name",name); 
    pause(name); 


    71. How to find whether the given sub string is present in a string. 
    y = "ABCD ABCD XXXX"; 
    z = index(y,"XXXX"); 
    if (z == 0) 

    pause("No such string is found"); 

    else 

    pause("String is found at position " & z); 


    72. What string of characters, when inserted into a string , will create a new line in a message displayed by a pause statement. 
    72. letters["a"] = "A"; 
    letters["b"] = "B"; 
    letters["c"] = "C"; 
    How to write TSL statement that loops thro the array and displays the contents. 
    NOTE: You can't initialize another array. 
    Ans. 
    73. How to use the 'in' operator in an Array? 
    Ans. in checks if the index is set for the array, not the assigned value of that array element. Thus if I have this array: 
    myArray[0] = "zero"; 
    myArray[1] = "one"; 
    myArray[2] = "two"; 
    myArray[99] = "last one"; 
    (0 in myArray) will return true, (5 in myArray) will return false (nothing yet assigned to myArray[5]). ("zero" in myArray) will return false (it's a value, not an index). 
    74. What is the difference between tl_step and report_msg? 
    Ans. tl_step will divide the script into sections and inserts a status message in the test report for the previous section. In tl_step we can set whether the action is passed or failed. 
    Report_msg is used to write a message in the test results. 
    75. What is the difference between win_activate and set_window functions? 
    Ans. win_activate method activates the window. Set_window specifies the window to receive subsequent input and (optionally) specifies the amount of time to wait for the specified window. 
    76. Without adding an object to the guimap file, can we execute the script on a particular object?? 
    Ans. Yes. We can execute the script on a particular object without adding it to the gui map file by giving the physical description of the object directly in place of the logical name. 
    76. What is the difference between the set_window and _set_window functions?

    Ans. The set_window specifies the window to receive the subsequent input and optionally specifies the amount of time to wait for the specified window. The parameter given for specifying the window is the windows logical name. 
    _set_window specifies a window to receive input. Here the window's physical description is given to identify the window. 
    I think you know the difference between logical name and Physical description of a object. set_window is used by giving logical name and you can give physical description.

    But _set_window needs only physical description. 
    _set_window does not change the active window in the gui map. 
    set_window(window1); 
    _set_window(window2);

    this will set window1 as the active "application window" and the active "gui window". When you _set_window on window2, the "application window" is shifted to the physical description of window2, but the gui map still "thinks" you are looking at window1. 
    This can be useful if you have a lot of windows with similar child objects (edit boxes, radio buttons, etc). This can allow you to make a single GUI map entry for multiple windows.

    Likewise, you can shift the focus of the active GUI map window without shifting the currently active "application window" like this: 
    set_window(window1); 
    GUI_set_window(window2); 
    77. Is there any need for the GUI Map while working with Analog mode? 
    Ans. No. There is no need for the GUI Map file when we are working with analog mode 
    78.What is Silent Mode in WinRunner? 
    Ans. In silent mode, WinRunner suppresses messages during a test run so that a test can run unattended. When you run a test remotely from TestDirector, you must run it in silent mode, because no one is monitoring the computer where the test is running to view the messages. 
    79. What are the modes in which you can organize your GUI Map files? 
    Ans. We can organize the GUI Map files in any of the below two modes: 
    • In the GUI Map File per Test mode, WinRunner automatically creates a new GUI map file for every new test you create. 
    • In the Global GUI Map File mode, you can use a single GUI map for a group of tests. 
    80. What is treturn and texit. 
    Ans. Treturns, stops a called test and returns control to the calling test. 
    Texit, stops execution of the current test. 
    81. What is location and Index.How WR will identify the same gui objects in a window. 
    82. Can we change the phy desc of a gui object in GUI MAP EDITOR through script. 
    83. What is the WR testing process. 
    Ans.There are total 6 steps 
    1.Create Gui map 
    2.Create Test 
    3.Debug Test 
    4.Run Test 
    5.View Results 
    6.Report Defects 
    84. What is Runtime data base check point. 
    Ans. 
    86. What is Standard data base check point. 
    Ans. You can create the standard check points to compare the current values of the properties of the result set to the expected values captured during the record time or otherwise set before the test run. 
    In Standard database check points 
    1.Default checkpoint 
    2.Custom checkpoint (This checkpoints appears in your test script as a db_check statement) 

    87. What is Default data base checkpoint. 
    Ans.You this default checkpoint to check entire contents of a result set 
    88. What is Custom data base checkpoint. 
    Ans.Custom check points are used to check partial contents (i.e.) Number of rows, Number of columns of a result set. 

No comments:

Receive All Free Updates Via Facebook.