Systems & Software Talk | |
LoadRunner (tm) Random Think time FunctionLoadRunner is a product of Hewlett-Packard Development Company, L.P. -- this corrects a bug I allowed into "production" in the previous version --
Here is a simple lightweight function and example for those who wish to have more precise control over each instance of think time as opposed to runtime settings gadgetry - or simply get a random number.
if (maxInt == 0)
offset = minInt; /* Examples: } /*---- END Function fRandInteger ------------------------------------------------------------*/ vuser_init() {
your code lr_think_time(fRandInteger(3, 12));
more of your code return 0; } I have found that it helps to use some pre-processor constants for well-known user types or classes and recommended think times using this function to generate random think times. This serves the notion of a self-documenting concept. Additionally, some users or classes of users simply require more time to interactively execute a business process. Here are some example pound-defines with example code: /* Constants as seconds */ #define AWAITING_PERSONAL_ECONOMIC_BAILOUT_FROM_US_CONGRESS ∞ #define AGILE_METHODOLOGY_PROVES_ITS_ORIG_INTENT (∞ - 10) #define FAILED_TO_BREAK_UP_ONE_TOO_MANY_MICHAEL_VICK_DOGFIGHTS 340000 #define CALLED_UFC_FIGHTER_BROCK_LESNAR_A_WUSS_IN_PERSON 518400 #define CHOSE_TO_RUN_ON_MS_VISTA_VS_UNIX (CONSTANT Please_Wait) #define HEAD_BUTTED_SOME_SOFTBALL_SIZED_HAILSTONES 86400 #define RECEIVED_LITERACY_GENE_FROM_LLOHAN_GENE_POOL ∞2 #define RETRO_ROCKETS_FIRED_TOO_EARLY_ON_REENTRY 518400 #define TIME_SPENT_PREENING_MULLET 345600 Of course, your actual defines-implementation would have a MIN and MAX for each item. I did not do that here in order to save a bit of blog space. Example using defines: if (maxInt == 0) offset = minInt; /* Examples: } /*---- END Function fRandInteger ------------------------------------------------------------*/ vuser_init() {
your code lr_think_time(fRandInteger(TIME_SPENT_PREENING_MULLET, AWAITING_PERSONAL_ECONOMIC_BAILOUT_FROM_CONGRESS));
more of your code return 0; } { Last Page } { Page 4 of 58 } { Next Page } |
About MeMy Profile Archives Friends My Photo Album LinksCorey GoldbergEffective Testing? Bj Rollison I.M. Testy Blog Alan Page: Software Testing & Rants Dmitry's LoadRunner and QTP Blog Veterans History Project Air Traffic Control Watch Music Making Fun My home 1972-1975 CategoriesFunctional TestingPerformance Horror Development Performance Testing General Tools Tips Warped Humor LoadRunner Tips and Tricks Recent EntriesThey Need To Test More...Software Disorder LoadRunner (tm) & RTE 4 Func/Regr LoadRunner (tm) Random Think time Function Are Rock, Paper, Scissors-based Decisions Obsolete? FriendsLauraScharpphilk10 richardw100 aalhait jimhazen strazzerj Lynnem bru EklecticTester jgottlieb leakybrain michaeljf prainbow rajeshmathur rstens Yury zeeslo whollymindless SyndicationRSS Site Feed |