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: WinRunner: Do Java Add-Ins required for Web based Application?

You do not need any Java add-in to tests simple JSP pages. If you are using Java applets with some swing or awt components drawn on the applet then you need java add-in otherwise simple web add-in will server the purpose.


Q: How to generate unique name?

function unique_str()
{
auto t, tt, leng, i;
t = get_time();
leng = length(t);
tt = "";
for (i = 1; i <= leng; i++)
{
tt = tt & (sprintf("%c", 97 + i + substr(t, i, 1)) );
}
return tt;
}


Q; WinRunner: How to access the last window brought up? [set_window("{class: window, active: 1}");
rc = win_get_info("{class: window, active: 1}", property, result);
Is there something or some script that can determine the LAST WINDOW DISPLAYED or OPENED on the desktop and in order to use that information to gather the label.

there are a couple of solutions, depending on what you know about the window. If you know distinguishing characteristics of the window, use them and just directly describe the gui attributes. I assume that you do not have these, or you would likely have already done so.
If not, there is a brute force method. Iterate over all of the open windows prior to the new window opening and grab their handles. After your new window opens, iterate again. The 'extra' handle points to your new window. You can use it in the gui description directly to manipulate the new window. As I said, a bit brutish, but it works. You can use the same technique when you have multiple windows with essentially the same descriptors and need to iterate over them in the order in which they appeared.
Any object (or window) can be described by it's class and it's iterator. Ask yourself, if I wanted to address each of the individuals in a room and had no idea what their names were, but would like to do so in a consistent way would it not be sufficient to say - 'person who came into the room first', 'person who came into the room second', or alternately 'person who is nearest the front on the left', 'person who is second nearest the front on the left'. These are perfectly good ways of describing the individuals because we do two things: limit the elements we want to describe (people) and then give an unambiguous way of enumerating them.
So, to apply this to your issue - you want to do an 'exist' on a dynamically described element (window, in your case). So you make a loop and ask 'window # 0, do you exist', if the answer is yes, you ask for the handle, store it and repeat the loop.
Eventually you get to window n, you ask if it exists, the answer is no and you now have a list of all of the handles of all of the existing windows.. You should note that there will be n windows ( 0 to n-1, makes a count of n).
You may need to brush up on programmatically describing an object (or window), the syntax is a little lengthy but extremely useful once you get the feel for it. It really frees you from only accessing objects that are already described in the gui map.
Try this as a starting point, you'll need to add storing & sorting the handles yourself:
i = 0;
finished = FALSE;
while (finished == FALSE)
{
if (win_exists("{class: window, location: \"" & i & "\"}\"") == E_OK )
{
win_get_info("{class: window, location: \"" & i & "\"}\"", "handle", handle);
printf(" handle was " & handle);
i ++;
}
else
{
finished = TRUE;
}
}

Q: WinRunner: How to identifying dynamic objects in web applications ?

Check whether the object is present inside the table. If yes then the get the table name and the location of that object. Then by using web_obj_get_child_item function you can get the description of the Object. Once you get the Description then you can do any operation on that object.


Q: WinRunner: How to delete files from drive?

Here is a simple method using dos.
where speech_path_file is a variable.
example:
# -- initialize vars
speech_path_file = "C:\\speech_path_verified.txt";
.
.
dos_system("del " & speech_path_file);


Q: WinRunner: Could do we start automation before getting the build?

The manual test cases should be written BEFORE the application is available, so does the automation process. automation itself is a development process, you do start the development BEFORE everything is ready, you can start to draw the structure and maybe some basic codes. And there are some benefits of having automation start early, e.g., if two windows have same name and structure and you think it is trouble, you may ask developer to put some unique identifiers, for example, a static which has different MSW_id). If you (& your boss) really treat the automation as the part of development, you should start this as early as possible, in this phase it likes the analyse and design phase of the product.


Q: How to create a GUI map dynamically?

gmf = "c:\\new_file_name.gui";
GUI_save_as ( "", gmf );

rc = GUI_add(gmf, "First_Window" , "" , "");
rc = GUI_add(gmf, "First_Window" , "new_obj" , "");
rc = GUI_add(gmf, "First_Window" , "new_obj" , "{label: Push_Me}");

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