answersLogoWhite

0


Best Answer

WinRunner Coding Standards

1) No hard coded paths.

A WinRunner test should be able to be copied from one machine to another and run without any problems. Anything the test depends on (gui maps, text files, compiled modules, dll's) should be in the same parent folder as the test.

Exception:

Paths to permanent files on the K drive can be hard coded if absolutely necessary. (Warning – you may run into problems with tests running simultaneously on different machines accessing the same files on the K drive)

Wrong:

reload("C:\\WR_TESTS\\Acceptance_6\\acceptance_functions");

Right:

reload(getvar("testname") & "\\..\acceptance_functions");

2) Indent blocks of code for readability

Wrong:

for(counter = count - 24; counter < count - 1; counter++)
{
list_get_item("ListBox",counter,item);
str = str & item & "\r\n";
}

Right:

for(counter = count - 24; counter < count - 1; counter++)

{
list_get_item("ListBox",counter,item);
str = str & item & "\r\n";
}

Right:

for(counter = count - 24; counter < count - 1; counter++){
list_get_item("ListBox",counter,item);
str = str & item & "\r\n";
}


3) Avoid hard coding testing environment dependencies

Do not hardcode information which my change depending on testing environment. These include installation directories, DSN names, names of database servers, database usernames, and database passwords. It's better to define these in variables at the beginning of the test, so you do not have to make multiple changes throughout the script to implement an environmental change.

Wrong:

set_window("SQL Server Login",10);
edit_set("Login ID:", "sa");
edit_type("Password:", "password");

Right:

db_username = "sa";
db_password = "password";

set_window("SQL Server Login",10);
edit_set("Login ID:", db_username);
edit_type("Password:", db_password);

Wrong (also violates coding standard 1):

invoke_application("C:\\iAvenue\\Windows\\UAdmin.exe","","c:\\Power_db",SW_SHOW);

Right:

install_dir = "c:\\iAvenue\\Windows";

invoke_application(install_dir & "\\UAdmin.exe","",getvar("testname") & "\\..\Power_db",SW_SHOW);

4) Use text recognition as a last resort

Text recognition takes a lot of memory, can be unreliable, and can have varying results on different operating systems. It should therefore only be used if there is no other way to get the information from an object. Unfortunately, this is often the case, especially when the object is not recognized (class: object). In the following example, assume that "Assign Date" is class edit:

Wrong:

obj_get_text("Assign Date", text);

Right:

edit_get_text("Assign Date",text);

5) Do not use excessive wait statements. Try to use synchronization functions when waiting is required.

Wrong:

wait(40);

Right:

statusbar_wait_info("Status Bar","value","Sites processed = 20",40);

6) Do not use report_msg as a substitute for tl_step.

Nobody wants to read every line of the test results looking for a failure. It's much easier to look for green or red. It's OK to have a tl_step failure without a tl_step pass.

Wrong:

if(win_exists("Active Information Manager",1) == 0)
{
set_window("Active Information Manager", 1);
obj_get_text("AfxWnd42", text);
my_gui_checkpoint(text,"AIM.log");
}
else
report_msg("AIM failure! Window absent at startup");

Right:

if(win_exists("Active Information Manager",1) == 0)
{
set_window("Active Information Manager", 1);
obj_get_text("AfxWnd42", text);
my_gui_checkpoint(text,"AIM.log");
}
else
tl_step("AimReportRuns",FAIL,"AIM window absent at startup");


7) Use regular expressions to avoid multiple window instances in the gui map.

Wrong:


7) Use regular expressions to avoid multiple window instances in the gui map (continued)

Right:

8) Comment your code to make it more readable

#Please add comments

User Avatar

Wiki User

โˆ™ 2007-07-06 15:52:25
This answer is:
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
User Avatar

Add your answer:

Earn +20 pts
Q: Is there any coding standards available for Winrunner TSL?
Write your answer...
Submit
Related questions

How do you read a value from .pdf file using winrunner TSL scripting?

try with file_open command it will work. if not possible asume that as a image and then using coordinates you can get a value bye chanti


In what year did Trina Solar Limited - TSL - have its IPO?

Trina Solar Limited (TSL)had its IPO in 2006.


What is the market cap for Trina Solar Limited TSL?

As of July 2014, the market cap for Trina Solar Limited (TSL) is $813,300,960.72.


What is the best mud tire?

Super Swamper TSL or a Bogger


What is full form of tsl in outlook?

Transport Layer Security (TLS)


What does tsl stand for today?

TSL acronym may have various meanings. Some of these meanings are Texas State Library, Teen Second Life, Transport Layer Security, Test and Set Lock or Transmitter Studio Link.


Will a marshall tsl 100 head do thrash metal pantera early metallica megadeth well?

Absolutely will. Testament still uses marshall mode 4 amps and those are nowhere as good as the tsl. It will do classic metal just fine.


What is the airport code for Tamuรญn National Airport?

The airport code for Tamu&iacute;n National Airport is TSL.


What is the symbol for Trina Solar Limited in the NYSE?

The symbol for Trina Solar Limited in the NYSE is: TSL.


what are benefits of tefl certification?

you can teach English in abroad become tsl teacher.


What is the max load capacity the Swamper tires made by TSL can handle?

They should never have more than 10,000lbs placed on them.


How much does Ashley Tisdale get paid?

Ashley tisdale gets payed 200 a sec!wow!:)She gets paid $35,000 per episode of TSL. She got paid $250,000 for appearing in Donnie Darko and she got paid $1,000,000 for HSM. I don't know how much she made for HSM2.from July 2007 to July 2008, she made 5.5 million on product endorsements, HSM things, TSL and Phineas and Ferb. Hope that helps!


How much Ashley Tisdale earn?

She gets paid $35,000 per episode of TSL. She got paid $250,000 for appearing in Donnie Darko and she got paid $1,000,000 for HSM. I don't know how much she made for HSM2.


What is the website for Holland Studio Craft Limited?

hi, this is the only source there is left to date. All pieces of the collection are shown here. It is not a selling site, only info http://www.thesorcererslibrary.com/TSL/fables/fables_fullcatalogue.htm greetings Emile


Was the Texas state treasurer's office abolished?

"A constitutional amendment in 1996 abolished the office of State Treasurer and transferred its functions to the Office of Comptroller of Public Accounts." Source: http://www.lib.utexas.edu/taro/tslac/10211/tsl-10211.html


What is a Director.?

This question depends on the type of company, but in the radio world, the Promotion Director is the person that coordinates all of the on-air contests, live remotes, dj appearances, etc. The Promotion Director is the bridge between the Sales and Programming departments. Sometimes promotions are "sales promotions" which are created solely for the sales department to go out and use as a revenue generating tool. Other times, promotions are strictly "programming promotions" where the intent of the promotion is geared towards increasing the "Time Spent Listening" (TSL). The perfect promotion is one that can successfully bring in revenue from the sales department as well as generate TSL.


You made a mistake in Online application form for the post of clerkin corporation bank did anyone know how to edit the application?

you will not be able to edit the information in the same application. you can fill out one more form and take a printout. you can use the same TSL no because it will be valid.


What are the biggest street legal tires?

While a few states have maximum tire size laws, most only require that tires be DOT approved. The largest DOT approved tires as of 2010 are 54" tall (Interco TSL Boggers and Mickey Thompson TTC Claws).


What are the sign languages and their sign patterns?

Korean Sign Language (Hangeul &#49688;&#54868;, Hanja: &#25163;&#35441;, Soo-hwa/Su-hwa) Japanese Sign Language (JSL)(&#26085;&#26412;&#25163;&#35441;, Nihon Shuwa) Taiwanese Sign Language (TSL) Zambian sign language Zimbabwe sign language


Where can you get aerodactyl on Pokemon pearl?

you get it from something called 'old amber' from the under ground and then you have to go to the museum in oreburgh city and give it to the man behind the counter. he will tell you to go outside for a minute so do it then go straight back inside and tsl to him again and he will have your aerodactyl.(just remember to leave one of your 6 Pokemon out so you have space to put aerodactyl). This should work even though i found out on the internet by googling it. hope it works


Can anyone recommend a UHF RFID reader for use with mobile devices?

Check out the Bluetooth-compatible 1128 UHF RFID reader from TSL. Because it's Bluetooth enabled, it works with a range of different mobile devices, including enterprise handhelds, consumer phones, touchscreen MP3 players, tablets and PCs running pretty much any operating systems -- Android, iOS, Windows Mobile, WinCE and Windows.


What is a promotion director?

This question depends on the type of company, but in the radio world, the Promotion Director is the person that coordinates all of the on-air contests, live remotes, dj appearances, etc. The Promotion Director is the bridge between the Sales and Programming departments. Sometimes promotions are "sales promotions" which are created solely for the sales department to go out and use as a revenue generating tool. Other times, promotions are strictly "programming promotions" where the intent of the promotion is geared towards increasing the "Time Spent Listening" (TSL). The perfect promotion is one that can successfully bring in revenue from the sales department as well as generate TSL.


Can a stock 1990 Toyota 4Runner with a 3 litter V6 power 31 inch tires in mud and on the road?

Sure it will. My Buddy has a 1989 Toyota 4 runner that is completely stock and he runs 31 by 10.50 mud tires on it. He only has a 2.4 four cylinder in his. My brother has a 1992 Toyota pickup with the 3 liter V6 and he runs 34 by 10.50 TSL LTB super swampers and it turns them just fine. You will probably see a drop in mpg with you new tires but nothing serious.


Will 35 inch tires fit on 88-98 Chevy truck with 3 inch body 2 inch suspension?

Yes it will. I have a 1998 GMC Sierra 4wd with only a 3 inch body lift and are clearing 35 inch nitto tires and it has no suspension lift what so ever I have a 1999 2 door Tahoe with 3 inch body lift and keys cranked up and clearing 35/15.50/r15 tsl sx's with little cutting but rubbs when turning and flexing the front suspension.


Will 33x9.5x15 tires fit on a stock 1994 Toyota pickup?

34 9.5 15 tsl fit on my stock 94 4runner with a 3/4 torsion bar crank. recommend suspension upgrades. i would say the same for a 33 unless the "33" inch tire is closer to 32 inched tall. manufactures are not always accurate. a tire with actual dimensions of 32.6 inches tall by less than 11 inches wide will work on almost any stock Toyota truck