﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-qileilove-随笔分类-loadrunner</title><link>http://www.blogjava.net/qileilove/category/51344.html</link><description>不想做屌丝的码农，不是好项目经理！屌丝生涯从此开始！</description><language>zh-cn</language><lastBuildDate>Wed, 03 Dec 2014 06:24:56 GMT</lastBuildDate><pubDate>Wed, 03 Dec 2014 06:24:56 GMT</pubDate><ttl>60</ttl><item><title>LoadRunner脚本开发-字符串编码转换</title><link>http://www.blogjava.net/qileilove/archive/2014/12/03/420980.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 03 Dec 2014 05:44:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/12/03/420980.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/420980.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/12/03/420980.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/420980.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/420980.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">相关函数</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　lr_convert_string_encoding函数</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　功能：字符串编码转换</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">原型：</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　int lr_convert_string_encoding(const char *sourceString, const char *fromEncoding, const char *toEncoding, const char *paramName);</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　返回值：0(执行成功)、-1(执行失败)</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">参数说明：</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　sourceString：要转换的字符串</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　fromEncoding：源字符的编码</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　toEncoding：保存在参数parmaName中的字符串编码，即要转换的目标编码</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　paramName：保存转换编码后的字符串</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　说明：</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1.lr_convert_string_encoding支持system locale,Unicode,UTF-8字符串编码的相互转换，参数paramName中保存结果字符串，该结果字符串包含字符串结束符NULL</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2.结果字符串中的可打印字符在VuGen和日志中按实际字符显示，不可打印字符则以十六进制显示，例如：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　rc = lr_convert_string_encoding("A", NULL, LR_ENC_UTF8, "stringInUnicode");</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　结果字符串(即stringInUnicode参数值)显示为：A\x00, 而不是\x41\x00,因为A为可打印字符串.</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3.fromEncoding and toEncoding可选值：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49810" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/12/14982672_201412031053051WFko.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　loadrunner &lt;wbr&gt;脚本开发-字符串编码转换</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">例子：</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Action()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">int rc = 0;</div><div style="word-break: break-all; margin: 10px 0px;">char *converted_buffer_unicode = NULL;</div><div style="word-break: break-all; margin: 10px 0px;">rc = lr_convert_string_encoding("hello", NULL, LR_ENC_UNICODE, "stringInUnicode");</div><div style="word-break: break-all; margin: 10px 0px;">if(rc &lt; 0)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_output_message("convert_string_encoding failed ");</div><div style="word-break: break-all; margin: 10px 0px;">// error</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　输出结果：</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49811" target="_blank" style="word-break: break-all; color: #45a2fc; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/12/14982672_2014120310530521Jkq.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><img src ="http://www.blogjava.net/qileilove/aggbug/420980.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-12-03 13:44 <a href="http://www.blogjava.net/qileilove/archive/2014/12/03/420980.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何让Loadrunner运行日志的警告显示红色</title><link>http://www.blogjava.net/qileilove/archive/2014/11/28/420803.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 28 Nov 2014 02:19:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/11/28/420803.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/420803.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/11/28/420803.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/420803.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/420803.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">先看一段脚本</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.727233886719px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Action()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("userSessionID2",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=userSession value=",</div><div style="word-break: break-all; margin: 10px 0px;">"RB=&gt;",</div><div style="word-break: break-all; margin: 10px 0px;">"Search=Body",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_url("WebTours",</div><div style="word-break: break-all; margin: 10px 0px;">"URL=http://127.0.0.1:1080/WebTours/",</div><div style="word-break: break-all; margin: 10px 0px;">"TargetFrame=",</div><div style="word-break: break-all; margin: 10px 0px;">"Resource=0",</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=text/html",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=",</div><div style="word-break: break-all; margin: 10px 0px;">"Snapshot=t1.inf",</div><div style="word-break: break-all; margin: 10px 0px;">"Mode=HTML",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">lr_think_time(13);</div><div style="word-break: break-all; margin: 10px 0px;">web_submit_data("login.pl",</div><div style="word-break: break-all; margin: 10px 0px;">"Action=http://127.0.0.1:1080/WebTours/login.pl",</div><div style="word-break: break-all; margin: 10px 0px;">"Method=POST",</div><div style="word-break: break-all; margin: 10px 0px;">"TargetFrame=",</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=text/html",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",</div><div style="word-break: break-all; margin: 10px 0px;">"Snapshot=t4.inf",</div><div style="word-break: break-all; margin: 10px 0px;">"Mode=HTML",</div><div style="word-break: break-all; margin: 10px 0px;">ITEMDATA,</div><div style="word-break: break-all; margin: 10px 0px;">"Name=userSession", "Value={userSessionID}", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px;">"Name=username", "Value=test2", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px;">"Name=password", "Value=test2", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px;">"Name=JSFormSubmit", "Value=on", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px;">"Name=login.x", "Value=63", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px;">"Name=login.y", "Value=9", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_url("SignOff Button",</div><div style="word-break: break-all; margin: 10px 0px;">"URL=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1",</div><div style="word-break: break-all; margin: 10px 0px;">"TargetFrame=body",</div><div style="word-break: break-all; margin: 10px 0px;">"Resource=0",</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=text/html",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&amp;in=home",</div><div style="word-break: break-all; margin: 10px 0px;">"Snapshot=t5.inf",</div><div style="word-break: break-all; margin: 10px 0px;">"Mode=HTML",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　可以看到，脚本中在引用关联函数的时候，名称和实际的关联函数名称是不一致的。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　再看下运行结果</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49642" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411261037461Uv0h.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　从Warning信息中可以看出，也提示了userSessionID也不是一个有效的关联值，所以实际上并未关联成功，但Warning信息的文字颜色为黑色，所以在查看日志信息的时候，不能很快了解实际的运行状态，有没有什么方法可以将Warning的颜色也显示为红色或者蓝色？</div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/420803.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-11-28 10:19 <a href="http://www.blogjava.net/qileilove/archive/2014/11/28/420803.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试过程模型</title><link>http://www.blogjava.net/qileilove/archive/2014/11/14/420053.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 14 Nov 2014 01:43:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/11/14/420053.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/420053.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/11/14/420053.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/420053.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/420053.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;"><a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">自动化测试</strong></u></a>生命周期方法，我们称之为"<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>过程通用模型"，具体如下：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">1.测试的前期准备阶段</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　a.系统基础功能验证，该活动主要确保当前需要进行性能测试的应用已经具备了进行测试的条件</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　b.组建测试团队</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　c.测试工具需求确认</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">2.测试工具引入阶段</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　a.选择工具</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　b.工具应用的技能培训</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　c.确定工具的应用过程</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">3.测试计划阶段</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　a.性能测试领域分析</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49383" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_2014111311344610evO.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　b.用户活动剖析与业务建模</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　用户活动剖析与业务建模活动用来寻找用户的关键性能关注点。用户对系统性能的关注往往集中在少数几个业务活动上，在确定性能目标之前，需要先把用户的关注点找出来，从而确定最贴近用户要求的性能目标。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　用户活动剖析的方法大体分为两种：系统日志分析和用户调查分析。系统日志分析是指通过应用系统的日志了解用户的活动，分析出用户最关注、最常用的业务功能的操作路径；用户调查分析是在不具备系统日志分析的条件(如该系统尚未交付用户运行实际的业务)时采用的一种估算方法，可以通过用户调查问卷、同类型系统对比的方法获取用户最关注、最常用的业务功能等内容。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　c.确定性能目标</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　性能测试目标根据性能测试需求和用户活动分析结果来确定，确定性能测试目标的一般步骤是首先从需求和设计中分析出性能测试需求，结合用户活动剖析与业务建模的结果，最终确定性能测试的目标</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　d.制定测试时间计划</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　e.测试设计与开发阶段</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">1&gt;.测试环境设计</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　对于能力验证领域的性能测试，首先明确是在特定的部署环境上进行，因此不需要特别为性能测试设计环境，只需要保证用于测试的环境与今后系统运行的环境一致即可。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　对于规划能力领域的性能测试，测试环境不特定，但也需要设计一个基准的环境。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　对于性能调优领域的性能测试，因为调优过程是一个反复的过程，在每个调优小阶段的末尾，都需要有性能测试来衡量调优的效果，因此必须在开始就给出一个衡量的环境标准，并在整个调优过程中保证每次测试时的环境保持不变。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　这里所说的测试环境包括：系统的软硬件环境+数据环境设计+环境的维护</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">2&gt;.测试场景设计</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　测试场景模拟的一般是实际业务运行的剖面</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　3&gt;.测试用例设计</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　4.测试执行与管理</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　5.测试分析</div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/420053.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-11-14 09:43 <a href="http://www.blogjava.net/qileilove/archive/2014/11/14/420053.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner常用的分析要点都有哪些</title><link>http://www.blogjava.net/qileilove/archive/2014/11/13/420005.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 13 Nov 2014 02:12:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/11/13/420005.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/420005.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/11/13/420005.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/420005.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/420005.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　提供了生产负载的虚拟用户运行状态的相关信息，可以帮助我们了解负载生成的结果。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Rendezvous(负载过程中集合点下的虚拟用户)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　当设置集合点后会生成相关数据，反映了随着时间的推移各个时间点上并发用户的数目，方便我们了解并发用户的变化情况。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Errors(错误统计)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　通过错误信息可以了解错误产生的时间和错误类型，方便定位产生错误的原因。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Errors per Second(每秒错误)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　了解在每个时间点上错误产生的数目，数值越小越好。通过统计数据可以了解错误随负载的变化情况，定为何时系统在负载下开始不稳定甚至出错。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Average Transaction Response Time(平均事务响应时间)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　反映随着时间的变化事务响应时间的变化情况，时间越小说明处理的速度越快。如果和用户负载生成图合并，就可以发现用户负载增加对系统事务响应时间的影响规律。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Transactions per Second(每秒事务)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　TPS吞吐量，反映了系统在同一时间内能处理事务的最大能力，这个数据越高，说明系统处理能力越强。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Transactions Summary(事务概要说明)</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　统计事物的Pass数和Fail数，了解负载的事务完成情况。通过的事务数越多，说明系统的处理能力越强;失败的事务数越小说明系统越可靠。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Transaction performance Summary(事务性能概要)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　事务的平均时间、最大时间、最小时间柱状图，方便分析事务响应时间的情况。柱状图的落差越小说明响应时间的波动小，如果落差很大，说明系统不够稳定。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Transaction Response Time Under Load(用户负载下事务响应时间)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　负载用户增长的过程中响应时间的变化情况，该图的线条越平稳，说明系统越稳定。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Transactions Response time(事务响应时间百分比)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　不同百分比下的事务响应时间范围，可以了解有多少比例的事物发生在某个时间内，也可以发现响应时间的分布规律，数据越平稳说明响应时间变化越小。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Transaction Response Time(各时间段上的事务数)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　每个时间段上的事务个数，响应时间较小的分类下的是无数越多越好。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Hits per Second(每秒点击)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　当前负载重对系统所产生的点击量记录，每一次点击相当于对服务器发出了一次请求，数据越大越好。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Throughput(吞吐量)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　系统负载下所使用的带宽，该数据越小说明系统的带宽依赖就越小，通过这个数据可以确定是不是网络出现了瓶颈。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　HTTP Responses per Second(每秒HTTP响应)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　每秒服务器返回各种状态的数目，一般和每秒点击量相同。点击量是客户端发出的请求数，而HTTP响应数是服务器返回的响应数。如果服务器的响应数小于点击量，那么说明服务器无法应答超出负载的连接请求。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Connections per Second(每秒连接)：</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　统计终端的连接和新建的连接数，方便了解每秒对服务器产生连接的数量。同时连接数越多，说明服务器的连接池越大，当连接数随着负载上升而停止时，说明系统的连接池已满，通常这时候服务器会返回504错误。需要修改服务器的最大连接来解决该问题。</div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/420005.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-11-13 10:12 <a href="http://www.blogjava.net/qileilove/archive/2014/11/13/420005.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Loadrunner的自我摸索—LoadRunner12的下载与安装</title><link>http://www.blogjava.net/qileilove/archive/2014/11/07/419642.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 07 Nov 2014 02:26:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/11/07/419642.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/419642.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/11/07/419642.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/419642.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/419642.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">最近做了一段时间的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">手机</strong></u></a>端<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>，发现性能测试还是挺好玩的，决定要学一下<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner12</strong></u></a>。毕竟前台的很多性能数据都受后台影响。以后会持续更新<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>自学过程中遇到的问题、解决办法以及<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">学习</strong></u></a>成果。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　1.下载</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　直接进入hp官网下载。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　1）点击&#8220;立即获取LoadRunner&#8221;</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　2）填个人信息，随便填就可以了，带*号必填</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　3）同意条款</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　4）有三个东西可以下载：HP LoadRunner 12 Community Edition、HP LoadRunner 12 community Edition Addtional Components、Hp LoadRunner tutorial。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49231" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_2014110611223415WbO.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　HP LoadRunner 12 Community Edition，这个就是LoadRunner12了。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　HP LoadRunner 12 community Edition Addtional Components是LoadRunner12的附加组件，具体什么用我也不知道。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　Hp LoadRunner tutorial是LoadRunner教程，挺详细的可以下载学习。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">2.安装</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　双击下载后的HP LoadRunner 12 Community Edition的安装包，就可以安装了。要是提示缺少Microsoft Visual C++ 2005 Redistributable Package可进入官网下载。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　安装Microsoft Visual C++ 2005 Redistributable Package时出现找不到vcredist.msi时，参考</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　安装Microsoft Visual Studio 2005出现如下提示</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=49232" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/11/14982672_201411061122342DSvS.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　找不到vcredist.msi？</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　方法1：</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　解压安装包 &nbsp;vcredist_x86.EXE，里面将包含 vcredist.msi</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">方法2：</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　使用方法1，提示不是有效的安装文件，可以用下面的地址下载一个vcredist.msi</div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/419642.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-11-07 10:26 <a href="http://www.blogjava.net/qileilove/archive/2014/11/07/419642.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于Loadrunner12的测试总结</title><link>http://www.blogjava.net/qileilove/archive/2014/11/04/419470.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 04 Nov 2014 02:21:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/11/04/419470.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/419470.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/11/04/419470.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/419470.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/419470.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">今天做了个比较全面的<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>，简单在这里说一下吧</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　1.LR12是11.52的完成版本，确实觉得整体舒服多了，用起来不是那么别扭了，有些菜单的优化还是不错的</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　2.对于win8.1和ie11支持确实很好，采用了新的证书策略，效果不错</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　3.trueclient的录制模式还是和以前差不多</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　4.对于<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">手机</strong></u></a>端的模拟测试多了不少的平台，包括nexus7之类的平台也有了</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　5.录制支持chrome了，但是我用最新的33还是出现了无响应的问题，不过奇怪的是UFT12对chrome33这样的最新版本支持的很好。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　6.提供了直接的端口代理录制模式，用起来很方便直接修改应用的代理地址到LR配置的地址就行了，但是用IE11走代理模式出现了请求录制成功，但返回的页面没有出现的情况，就是请求出去了，但是没返回到浏览器中的情况，实际就是还是没法用啊。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　7.runtime setting的这类跟踪调试功能貌似增强了。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">总结：</strong></div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　如果你已经习惯用lr11.52了，那么12还是非常值得升级的版本，确实很多地方人性了。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　如果你还是传统用户，个人觉得11还是一个最合适的版本，至少用起来还是比12快不少。我的虚拟机是i7 930 2X2+4G内存+raid0硬盘，应该不算很差了。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　如果某些特殊的东西实在LR11不支持，你可以试试LR12.</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　如果你还不知道怎么&#8220;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">学习</strong></u></a>版&#8221;的话，LR12的默认50个用户策略和可能一直免费的License，会让你少处理很多东西。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　如果你是新学LR，个人还是建议你用老版本，因为LR12真没啥学习资料。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　如果你是老手，用LR12就和普通的一样，道理明白了新版本真没啥新意。</div><div style="word-break: break-all; line-height: 21.6000022888184px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.8181819915771px; background-color: #ffffff;">　　ps.貌似有个bug就是默认装完了第一次用Load generator的时候系统自动选的是localhost但是其实是没有这个负载生成机的，需要自己去列表里面添加一个再选择了才能跑负载。</div> <div><div id="SL_button" class="ImTranslatorLogo" style="display: none; background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><div id="SL_shadow_translation_result2" style="display: none;"></div><div id="SL_shadow_translator" style="display: none;"><div id="SL_planshet" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png) #f4f5f5;"><div id="SL_TB"><div id="bubblelogo" class="ImTranslatorLogo" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png);"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td class="SL_td" align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><td class="SL_td" align="left" width="20%"><select id="SL_lng_to"><option value="af">Afrikaans</option><option value="sq">Albanian</option><option value="ar">Arabic</option><option value="hy">Armenian</option><option value="az">Azerbaijani</option><option value="eu">Basque</option><option value="bn">Bengali</option><option value="be">Belarusian</option><option value="bg">Bulgarian</option><option value="ca">Catalan</option><option value="zh-CN">Chinese&nbsp;(Simp)</option><option value="zh-TW">Chinese&nbsp;(Trad)</option><option value="hr">Croatian</option><option value="cs">Czech</option><option value="da">Danish</option><option value="nl">Dutch</option><option value="en">English</option><option value="eo">Esperanto</option><option value="et">Estonian</option><option value="tl">Filipino</option><option value="fi">Finnish</option><option value="fr">French</option><option value="gl">Galician</option><option value="ka">Georgian</option><option value="de">German</option><option value="el">Greek</option><option value="gu">Gujarati</option><option value="ht">Haitian&nbsp;Creole</option><option value="iw">Hebrew</option><option value="hi">Hindi</option><option value="hu">Hungarian</option><option value="is">Icelandic</option><option value="id">Indonesian</option><option value="ga">Irish</option><option value="it">Italian</option><option value="ja">Japanese</option><option value="kn">Kannada</option><option value="ko">Korean</option><option value="lo">Lao</option><option value="la">Latin</option><option value="lv">Latvian</option><option value="lt">Lithuanian</option><option value="mk">Macedonian</option><option value="ms">Malay</option><option value="mt">Maltese</option><option value="no">Norwegian</option><option value="fa">Persian</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ro">Romanian</option><option value="ru">Russian</option><option value="sr">Serbian</option><option value="sk">Slovak</option><option value="sl">Slovenian</option><option selected="" value="es">Spanish</option><option value="sw">Swahili</option><option value="sv">Swedish</option><option value="ta">Tamil</option><option value="te">Telugu</option><option value="th">Thai</option><option value="tr">Turkish</option><option value="uk">Ukrainian</option><option value="ur">Urdu</option><option value="vi">Vietnamese</option><option value="cy">Welsh</option><option value="yi">Yiddish</option></select></td><td class="SL_td" width="13%" align="center">&nbsp;</td><td class="SL_td" width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_copy" title="Select text" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_bbl_font_patch" onclick="alert('Not available for dictionary');"></div><div id="SL_bbl_font" title="Font size" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png);"></div></td><td class="SL_td" width="8%" align="center"><div id="SL_TH" title="Translation history" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png);"></div></td><td class="SL_td" width="5%"></td><td class="SL_td" width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png);"></div></td></tr></tbody></table></div></div><div id="SL_shadow_translation_result" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg.png) #ffffff;"></div><div id="SL_bbl_donate" title="Make a small contribution" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png);"></div><div id="SL_Balloon_options" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg3.png) #f4f5f5;"><a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/options-bbl.html" target="_blank" class="SL_options" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" class="SL_options" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" class="SL_options" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" class="SL_options" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png);">Text-to-speech function is limited to 100 characters</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/419470.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-11-04 10:21 <a href="http://www.blogjava.net/qileilove/archive/2014/11/04/419470.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner之调用远程负载</title><link>http://www.blogjava.net/qileilove/archive/2014/09/18/418043.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 18 Sep 2014 01:30:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/18/418043.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418043.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/18/418043.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418043.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418043.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">原因：</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　据经验，每生成一个虚拟用户，需要花费负载生成器大约 2M-3M 的内存空间。通常运行 controller的主机很少用作负载生成器。负载生成器的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>多由其他装有 LR Agent的PC 机来担任。如果负载生成器内存的使用率大于了 70%，负载生成器就会变成系统的瓶颈，导致<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>成绩下降。这种问题需要添加负载生成器来解决。一台 512M内存的 PC 机大约可以生成 80 个左右的负载，而一台 256M 内存的 PC 机大约可以生成50到 60 个左右的负载。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　实现借用远程加压机：</strong></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　所以通常做大量用户的负载时，就需要借用其它的机器来加压。此时借用的加压机需要首先安装<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>的Load Generator这个部分组件。再按照以下操作执行：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　LoadRunner在测试<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>应用的时候，最常用的是分布式性能测试，也就是说由多个负载发起机向应用服务器发起请求。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　那么LR(loadrunner)是如何做到的呢？</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　首先，这要多亏于LR的架构，LR是由controller做测试控制的，scenario做测试场景的控制，Vuser模拟用户和load generator做负载产生。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　这样我们就很容易想到，只要分布的其他负载发起机上有Vuser和load generator就能做分布式测试了。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　对了，LR就是这么做的，它通过MI listener(跨防火墙监听)来达到以上的目的，默认接受数据的端口是54345，默认发送数据的端口是50500。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　第一步，我们要安装LR，这样的教程网上已经很多了我就不详述了。不过要注意一点，LR在win2000上安装后就自动打开了上述的端口，而在winXP上需要手动开启。具体步骤见第二步。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在负载发起机上我们要安装如下组件</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=48413" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171126551JQm8.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　第二步，我们要启动监听的服务，如下步骤</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　启动代理</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　　<a href="http://www.51testing.com/batch.download.php?aid=48415" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171127521emAX.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　设置代理</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=48416" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171127522tXZx.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　按Settings，在这个选项卡中我们可以配置一些用户名和密码(如果有需要的话)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　　<a href="http://www.51testing.com/batch.download.php?aid=48417" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171127523diSs.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">第三步，设置场景来连接负载发起机</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　创建场景</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　<a href="http://www.51testing.com/batch.download.php?aid=48419" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171127525OOhN.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　点击load generator图标</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　<a href="http://www.51testing.com/batch.download.php?aid=48420" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171127526taiC.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　点击Add按钮，来增加负载发起机</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　<a href="http://www.51testing.com/batch.download.php?aid=48421" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171127527pnYN.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　在Name 处填入IP地址，点击确定</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　<a href="http://www.51testing.com/batch.download.php?aid=48422" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171127528nqEO.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　这样我们就配置了一个负载发起机，重复上述步骤我们可以添加多个负载发起机。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　然后，我们测试下能不能连上负载发起机，选中负载发起机，点击Connect</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　<a href="http://www.51testing.com/batch.download.php?aid=48414" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171126552jqYA.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; text-align: left;">　　看到Status里出现Ready字样，我们就连上了一个负载发起机。</div></a></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　按确定退出，会在任务栏上看到如下图标</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　　<a href="http://www.51testing.com/batch.download.php?aid=48418" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/09/14982672_2014091711275241w5x.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><img src ="http://www.blogjava.net/qileilove/aggbug/418043.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-09-18 09:30 <a href="http://www.blogjava.net/qileilove/archive/2014/09/18/418043.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner启动自带例子Web Tours报错</title><link>http://www.blogjava.net/qileilove/archive/2014/09/15/417932.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 15 Sep 2014 02:32:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/15/417932.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417932.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/15/417932.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417932.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417932.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">1.启动Samples-Web-Start&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Web</strong></u></a>&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Server</strong></u></a>时，提示Could not open port 1080-Port is already used by another server(wsaeaddrinuse)</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　解决方法：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　找到xitami.cgf,将protbase=1000改为2000</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　[C:\Program Files\HP\LoadRunner\WebTours]</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2.启动Samples-Web-Start Web Server时，提示your request was unsuccessful，Cannot create CGI process</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　解决方法：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　a.可能未安装strawberry-perl.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　b.如正常安装，请打开WebTours文件夹下的run.bat，查看其SET PATH路径设置是否正确，尤其是perl安装路径，此BAT后默认perl安装在C盘，c:\strawberry\c\bin;c:\strawberry\perl\bin &nbsp;如你安装strawberry并非此路路径，在此修改BAT保存是没用的，需重新安装perl到C盘，或COPY一份到C盘下。重启start web server.服务.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3.LoadRunner Sample WebTours 点击Flights出现空白解决方法</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　解决方法：找环境变量，发现PERL5LIB变量中的值与LOG文件的匹配，值为：D:\oracle\product\10.2.0\db_2\perl\5.8.3\lib\MSWin32-x86;D:\oracle\product\10.2.0\db_2\perl\5.8.3\lib;D:\oracle\product\10.2.0\db_2\perl\5.8.3\lib\MSWin32-x86;D:\oracle\product\10.2.0\db_2\perl\site\5.8.3;D:\oracle\product\10.2.0\db_2\perl\site\5.8.3\lib;D:\oracle\product\10.2.0\db_2\sysman\admin\scripts;</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　去除所有带5.8.3的值，修改后的值为D:\oracle\product\10.2.0\db_2\sysman\admin\scripts;</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　此时sample运行正常。但不知道对ORACLE有什么影响。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　怕对oracle有影响，我在StartServer.bat里加上了对这个变量的设置</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　编辑StartServer.bat &nbsp;在最上面加上SET PERL5LIB=C:\oracle\product\10.2.0\db_1\sysman\admin\scripts</div><img src ="http://www.blogjava.net/qileilove/aggbug/417932.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-09-15 10:32 <a href="http://www.blogjava.net/qileilove/archive/2014/09/15/417932.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner中90%响应时间的理解</title><link>http://www.blogjava.net/qileilove/archive/2014/09/01/417554.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 01 Sep 2014 02:38:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/01/417554.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417554.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/01/417554.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417554.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417554.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">最近有几个学员问道关于90%的响应时间不太理解，顾摘录如下内容供大家参考：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　官方解释：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Solution: The 90th percentile is the value for which 90% of the data points are smaller</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　The 90th percentile is a measure of stastical distribution, not unlike the median. The median is the middle value. The median is the value for which 50% of the values were bigger, and 50% smaller. The 90th percentile tells you the value for which 90% of the data points are smaller and 10% are bigger.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Statistically, to calculate the 90th percentile value:</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1. Sort the transaction instances by their value.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2. Remove the top 10% instances.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3. The highest value left is the 90th percentile.</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　由此可见，仅仅有平均事务响应时间是不够的。因为平均事务响应时间满足了性能需求，未必就表示系统的性能已经满足了绝大多数用户的要求。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　假如有两组<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>结果，响应时间分别是 {1，3，5，10，16} 和 {5，6，7，8，9}，它们的平均值都是7，你认为哪次测试的结果更理想？</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　所以</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1）90%响应时间它是统计响应时间的参数，带有统计学意义，是科学性的；</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2）可以这样理解，这个事务所有的运行次数中，90％的次数落在这个响应时间里；（90%的响应时间不超过XX秒）</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3）90%响应时间可以在<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>中根据需要进行自由设置的，例如70%，95%；</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　4）为了真实的评估软件性能，建议让测试场景执行较长的时间，让工具采集更多数据，数据越多，在概率论中的数据分布中看，最具有真实性；</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　5）该参数是<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>结果的一个算法，与测试工具无关，无论你是使用LoadRunner、JMeter或其它<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试工具</strong></u></a>，该理论同样适用。</div><img src ="http://www.blogjava.net/qileilove/aggbug/417554.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-09-01 10:38 <a href="http://www.blogjava.net/qileilove/archive/2014/09/01/417554.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用LoadRunner进行服务器性能测试</title><link>http://www.blogjava.net/qileilove/archive/2014/08/27/417393.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 27 Aug 2014 02:32:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/27/417393.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417393.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/27/417393.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417393.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417393.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　由于项目进入尾声,需要进行<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>,没有专业的性能测试工程师,只好自己动手,研究一下loadrunner.</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　发现loadrunner对<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>测试介绍比较多,牵涉到winsocket测试的资料极少,不过到处找一找,研究一下,也是可行的.</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　先说一下我们的协议,采用tcp协议,与客户端采用自定义二进制流的方式进行通信.遵从普通的自定义协议的方式,即协议结构采用包头+包体的形式,包头为固定大小的长度,并在包头中加入包体总长度的字段.</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　好了,下面可以用loadrunner进行协议测试了.首先想法在PC上实现一个简单的协议生成软件,我采用python进行编制,将协议跑一遍,然后用loadrunner进行录制.由于是针对单个的协议录制,因而在loadrunner中生成的脚本一目了然.考虑到同一条协议根据不同的条件,返回的数据是不一样的,因此脚本稍有点复杂.</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　录制的脚本默认采用函数lrs_receive()来接收脚本,根据loadrunner的匹配规则,默认用data.ws中recv buf 中指定的长度来进行匹配,这样,由于同一个协议返回的数据总是不断变化的,就必然导致测试不通过的情况.在网上查到,可以通过某个设置使得每次达到录制时的数据量即可,但这样做有个明显的缺陷,每次读到到指定的数据后就不读取了,针对短连接,或是只测试一次的还可以,要是长连接,需要不停发送和接收的,必然出现测试不准确的问题.</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　以下为解决方法,将lrs_receive改为lrs_receive_ex,并将一次读取改为两次读取,第一次读取固定大小的包头,读完包头后,解析出包体的大小,然后再读取包体.</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　此方法适用所有自定义winsocket协议,附上相关脚本.</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">/********************************************************************* * Created by Mercury Interactive&nbsp;<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Windows</strong></u></a>&nbsp;Sockets Recorder * * Created on: Fri Jul 13 16:08:19 *********************************************************************/</div><div style="word-break: break-all; margin: 10px 0px;">#include "lrs.h"</div><div style="word-break: break-all; margin: 10px 0px;">vuser_init()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lrs_startup(257);</div><div style="word-break: break-all; margin: 10px 0px;">lr_start_transaction("create_socket");</div><div style="word-break: break-all; margin: 10px 0px;">lrs_create_socket("socket0", "TCP", "RemoteHost=127.0.0.1:110", &nbsp;LrsLastArg);</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction("create_socket", LR_AUTO);</div><div style="word-break: break-all; margin: 10px 0px;">return0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">/********************************************************************* * Created by Mercury Interactive Windows Sockets Recorder * * Created on: Fri Jul 13 16:08:19 *********************************************************************/</div><div style="word-break: break-all; margin: 10px 0px;">#include "lrs.h"long getNextRecvLen(char* socketID)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">int NumberOfBytes = 0;</div><div style="word-break: break-all; margin: 10px 0px;">int NextRecvLen = 0;</div><div style="word-break: break-all; margin: 10px 0px;">char *Buffer;</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_last_received_buffer(socketID, &amp;Buffer, &amp;NumberOfBytes);</div><div style="word-break: break-all; margin: 10px 0px;">memcpy((char*)&amp;NextRecvLen, Buffer+20, 4);</div><div style="word-break: break-all; margin: 10px 0px;">lr_log_message("last_received:%d, NextRecvLen:%d", NumberOfBytes, NextRecvLen);</div><div style="word-break: break-all; margin: 10px 0px;">return NextRecvLen;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">int receive_ex(char* socketID, char* buf)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">long NextRecvLen = getNextRecvLen(socketID);//getNextRecvLen("socket0");char flag[50];</div><div style="word-break: break-all; margin: 10px 0px;">memset(flag, 0, sizeof(flag));</div><div style="word-break: break-all; margin: 10px 0px;">sprintf(flag, "NumberOfBytesToRecv=%d", NextRecvLen);</div><div style="word-break: break-all; margin: 10px 0px;">lr_log_message(flag);</div><div style="word-break: break-all; margin: 10px 0px;">lrs_receive_ex(socketID, buf, flag, LrsLastArg);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">void doOneThing(int index)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">char sendbuf[50];</div><div style="word-break: break-all; margin: 10px 0px;">char recvbuf1[50];</div><div style="word-break: break-all; margin: 10px 0px;">char recvbuf2[50];</div><div style="word-break: break-all; margin: 10px 0px;">char transbuf[50];</div><div style="word-break: break-all; margin: 10px 0px;">memset(transbuf, 0, sizeof(transbuf));</div><div style="word-break: break-all; margin: 10px 0px;">sprintf(transbuf, "one_send_recv_%d", index);</div><div style="word-break: break-all; margin: 10px 0px;">lr_start_transaction(transbuf);</div><div style="word-break: break-all; margin: 10px 0px;">memset(sendbuf, 0, sizeof(sendbuf));</div><div style="word-break: break-all; margin: 10px 0px;">memset(recvbuf1, 0, sizeof(recvbuf1));</div><div style="word-break: break-all; margin: 10px 0px;">memset(recvbuf2, 0, sizeof(recvbuf2));</div><div style="word-break: break-all; margin: 10px 0px;">sprintf(sendbuf, "buf%d", 2*index);</div><div style="word-break: break-all; margin: 10px 0px;">sprintf(recvbuf1, "buf%d", 2*index+1);</div><div style="word-break: break-all; margin: 10px 0px;">sprintf(recvbuf2, "dbuf%d", index);</div><div style="word-break: break-all; margin: 10px 0px;">lrs_send("socket0", sendbuf, LrsLastArg);</div><div style="word-break: break-all; margin: 10px 0px;">lrs_receive_ex("socket0", recvbuf1, "NumberOfBytesToRecv=32", LrsLastArg);</div><div style="word-break: break-all; margin: 10px 0px;">receive_ex("socket0", recvbuf2);</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction(transbuf, LR_AUTO);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">Action()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_rendezvous("read_all_req_0");</div><div style="word-break: break-all; margin: 10px 0px;">doOneThing(0);</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">/********************************************************************* * Created by Mercury Interactive Windows Sockets Recorder * * Created on: Fri Jul 13 16:08:19 *********************************************************************/</div><div style="word-break: break-all; margin: 10px 0px;">#include "lrs.h"</div><div style="word-break: break-all; margin: 10px 0px;">vuser_end()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lrs_close_socket("socket0");</div><div style="word-break: break-all; margin: 10px 0px;">lrs_cleanup();</div><div style="word-break: break-all; margin: 10px 0px;">return0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　由于是分两次读取数据,必然读取的内容与录制的会稍有不同,幸好我们判断成功与否不是用返回的数据进行比较,而只是核对一下数据的大小,因此完全可以手动修改数据脚本,以下为在录制的基础上手工修改的脚本(注意,只是更改了接收端)</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">send &nbsp;buf0 28</div><div style="word-break: break-all; margin: 10px 0px;">"Test"</div><div style="word-break: break-all; margin: 10px 0px;">"\x00\x1b\x00\x00\x00"</div><div style="word-break: break-all; margin: 10px 0px;">"\x00\x00\x00\x00"</div><div style="word-break: break-all; margin: 10px 0px;">"\x12\x01\x00\x00\x00\x01\x00\x00\x00"</div><div style="word-break: break-all; margin: 10px 0px;">"\x02\x00\x01\x00\x01\x00"</div><div style="word-break: break-all; margin: 10px 0px;">recv &nbsp;buf1 -1</div><div style="word-break: break-all; margin: 10px 0px;">recv rbuf0 -1</div></td></tr></tbody></table></div></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"></div><div id="weixin_s" style="word-break: break-all; line-height: 21.600000381469727px; margin: 0px 0px 10px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; width: 182px; height: 32px; display: inline-block; position: relative; background-image: url(http://www.51testing.com/html/wx.jpg); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: no-repeat;"></div>&nbsp;<img src ="http://www.blogjava.net/qileilove/aggbug/417393.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-08-27 10:32 <a href="http://www.blogjava.net/qileilove/archive/2014/08/27/417393.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner同一个脚本运行两次结果相差很大的原因</title><link>http://www.blogjava.net/qileilove/archive/2014/08/21/417175.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 21 Aug 2014 01:48:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/21/417175.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417175.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/21/417175.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417175.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417175.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=47795" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408201047041BbEz.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">如果同一个脚本运行两次结果相差特别大.后一次的响应时间比前一次的响应时间慢了特别多,而期间开发又未修改过程序排查问题:</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1.查看下linux内存利用情况 free -m 是查看内存情况 (通常可用内存占10%是可接受范围内) 如果可用内存很小的话 :一种可能是程序有问题 :另一种可能是磁盘空间不足了 当磁盘空间不足就会去写内存</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2.可以先看下第二种情况成立否 : 命令 tf -m 查看磁盘空间情况结果看到磁盘空间为0了</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3.查看哪个进程占用了这么多 ，最好通过log日志进行分析。在运行<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>脚本前一定要确认好log日志的级别,如果设置debug,程序就会不断的写日志,影响性能测试结果 通常都是设置成error级别 当然如果再运行脚本过程中 两次运行结果不可能完全一样.通常相差时间要小于100ms是可接受的</div><img src ="http://www.blogjava.net/qileilove/aggbug/417175.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-08-21 09:48 <a href="http://www.blogjava.net/qileilove/archive/2014/08/21/417175.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>通过LoadRunner - Analyze详细分析页面元素请求</title><link>http://www.blogjava.net/qileilove/archive/2014/08/13/416888.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 13 Aug 2014 01:58:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/13/416888.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/416888.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/13/416888.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/416888.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/416888.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">众所周知<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>录制某个链接，包括动态请求与js、css、jpg等静态请求。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">web_custom_request("动态请求",</div><div style="word-break: break-all; margin: 10px 0px;">"URL=http://www.baidu.com/",</div><div style="word-break: break-all; margin: 10px 0px;">"Method=GET",</div><div style="word-break: break-all; margin: 10px 0px;">"Resource=0",</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=text/html",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=",</div><div style="word-break: break-all; margin: 10px 0px;">"Snapshot=t1.inf",</div><div style="word-break: break-all; margin: 10px 0px;">"Mode=HTTP",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_custom_request("静态请求",</div><div style="word-break: break-all; margin: 10px 0px;">"URL=http://www.baidu.com/img/baidu_jgylogo3.gif",</div><div style="word-break: break-all; margin: 10px 0px;">"Method=GET",</div><div style="word-break: break-all; margin: 10px 0px;">"Resource=1",</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=image/gif",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=http://www.baidu.com/",</div><div style="word-break: break-all; margin: 10px 0px;">"Snapshot=t2.inf",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　针对页面每一个请求元素，怎么定位具体分析呢？</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1、通过<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Analyze</strong></u></a>生成<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Web</strong></u></a>&nbsp;Page Diagnostics图。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　<a href="http://www.51testing.com/batch.download.php?aid=47431" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408121108551eHdI.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">图一</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2、针对每一个请求元素分析</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=47432" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408121108552jNHb.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　图二</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">　<a href="http://www.51testing.com/batch.download.php?aid=47433" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/08/14982672_201408121108553v8eo.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">图三</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3、根据单请求元素响应时间图、Download时间图、First Buffer图，确定性能瓶颈。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;"></strong></u></a><u style="word-break: break-all; line-height: normal !important;"><strong style="word-break: break-all;"><a target="_self" style="word-break: break-all; color: #202859; text-decoration: none;"><u style="word-break: break-all;"><strong style="word-break: break-all;">敏捷</strong></u></a>测试</strong></u>团队，不再仅仅是在coding之后。而是和研发人员贯穿在需求分析、规格说明、自动化<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">单元测试</strong></u></a>、自动化验收测试、静态代码分析、技术债等环节中。所以敏捷项目必定在将来效率的趋势下成为主流。</div><img src ="http://www.blogjava.net/qileilove/aggbug/416888.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-08-13 09:58 <a href="http://www.blogjava.net/qileilove/archive/2014/08/13/416888.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用LoadRunner编写socket性能测试脚本</title><link>http://www.blogjava.net/qileilove/archive/2014/08/05/416568.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 05 Aug 2014 01:53:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/05/416568.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/416568.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/05/416568.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/416568.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/416568.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　一、概述</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Loadrunner</strong></u></a>拥有极为丰富的工具箱，供予我们制造出各种奇妙魔法的能力。其中就有此次要讨论的socket套接字操作。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">二、socket概述</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　socket是<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">操作系统</strong></u></a>中I/O系统的网络延伸部分，它扩展了操作系统的基本I/O到网络通信，使进程和机器之间的通信成为可能。如果想完全地理解socket在Loadrunner中如何<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>的，熟悉一些关于它的历史会很有帮助。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　当前常用的socket，最早起源于BSD UNIX类的操作系统。在UNIX系统上，比如BSD，把对网络的支持加入操作系统，以一种扩展现有文件描述符(后注)结构的方法来实现的。Socket 可以被看成一个标准的文件描述符。在 UNIX 类的平台上，其中包括open()、read()、write()和close()。很多时间，程序并不需要知道它正在把数据写进一个文件、终端、或是一个TCP连接。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　系统调用被加入并和socket一起工作，而很多现有的系统调用同样能和socket一起工作。因此，一个socket允许您使用标准的操作系统和其他的计算机，以及您自己机器上的不同进程来通信。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　然而，socket的确存在一些不同工作方式。最明显地就是建立socket的方法。很多文件是通过调用open()函数来打开的，但socket是通过调用socket()函数来建立的，并且还需要另外的调用来连接和激活他们。recv()和send()这两个系统调用和read()和write()极为相似。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Socket是一套建立在TCP/IP协议上的接口不是一个协议，只要底层实现TCP IP协议，都可以用socket进行通信。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　应用层： &nbsp;HTTP &nbsp;FTP &nbsp;SMTP &nbsp;Web</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　传输层： &nbsp;在两个应用程序之间提供了逻辑而不是物理的通信基于流的TCP和基于数据包的UDP</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　文件描述符一般是指一个文件或某个类似文件的实体。内核（kernel）利用文件描述符（file descriptor）来访问文件。文件描述符是非负整数。打开现存文件或新建文件时，内核会返回一个文件描述符。读写文件也需要使用文件描述符来指定待读写的文件。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　文件描述符在形式上是一个非负整数。实际上，它是一个索引值，指向内核为每一个进程所维护的该进程打开文件的记录表。当程序打开一个现有文件或者创建一个新文件时，内核向进程返回一个文件描述符。在程序设计中，一些涉及底层的程序编写往往会围绕着文件描述符展开。但是文件描述符这一概念往往只适用于UNIX、<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Linux</strong></u></a>这样的操作系统。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">三、SOCKET连接过程</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　根据连接启动的方式以及本地套接字要连接的目标，套接字之间的连接过程可以分为三个步骤：服务器监听，客户端请求，连接确认。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　服务器监听：是服务器端套接字并不定位具体的客户端套接字，而是处于等待连接的状态，实时监控网络状态。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　客户端请求：是指由客户端的套接字提出连接请求，要连接的目标是服务器端的套接字。为此，客户端的套接字必须首先描述它要连接的服务器的套接字，指出服务器端套接字的地址和端口号，然后就向服务器端套接字提出连接请求。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　连接确认：是指当服务器端套接字监听到或者说接收到客户端套接字的连接请求，它就响应客户端套接字的请求，建立一个新的线程，把服务器端套接字的描述发给客户端，一旦客户端确认了此描述，连接就建立好了。而服务器端套接字继续处于监听状态，继续接收其他客户端套接字的连接请求。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　　四、开发原理</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　服务器：使用ServerSocket监听指定的端口，端口可以随意指定（由于1024以下的端口通常属于保留端口，在一些操作系统中不可以随意使用，所以建议使用大于1024的端口），等待客户连接请求，客户连接后，会话产生；在完成会话后，关闭连接。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　客户端：使用Socket对网络上某一个服务器的某一个端口发出连接请求，一旦连接成功，打开会话；会话完成后，关闭Socket。客户端不需要指定打开的端口，通常临时的、动态的分配一个1024以上的端口。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Socket接口是TCP/IP网络的API，Socket接口定义了许多函数或例程，程序员可以用它们来开发TCP/IP网络上的应用程序。要学Internet上的TCP/IP网络编程，必须理解Socket接口。Socket接口设计者最先是将接口放在Unix操作系统里面的。如果了解Unix系统的输入和输出的话，就很容易了解Socket了。网络的Socket数据传输是一种特殊的I/O，Socket也是一种文件描述符。Socket也具有一个类似于打开文件的函数调用Socket（），该函数返回一个整型的Socket描述符，随后的连接建立、数据传输等操作都是通过该Socket实现的。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">五、Loadrunner中socket相关函数浅析</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Loadrunner对于脚本函数有一份帮助文档。利用好此文档，其实对于<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>所需脚本就已足以。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　当我们打开Create/Edit Scripts，并打开脚本录制页面时，摁下F1便可打开《HP LoadRunner Online Function Reference》。在这帮助文档中找到&#8220;键入关键字进行查找&#8221;输入框。利用它查找我们所需的socket函数了。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　几乎所有关于socket的函数，都是以lrs开头的。<br /><div style="word-break: break-all; margin: 10px 0px;"><strong style="word-break: break-all; line-height: normal !important;">基本操作函数：</strong></div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">lrs_startup 初始化 WinSock DLL</div><div style="word-break: break-all; margin: 10px 0px;">lrs_create_socket 初始化套接字</div><div style="word-break: break-all; margin: 10px 0px;">lrs_send 在数据报上（UDP）或者向流套接字（TCP）发送数据</div><div style="word-break: break-all; margin: 10px 0px;">lrs_receive 接收来自数据报或流套接字的数据</div><div style="word-break: break-all; margin: 10px 0px;">lrs_disable_socket 禁用套接字操作</div><div style="word-break: break-all; margin: 10px 0px;">lrs_close_socket 关闭打开的套接字</div><div style="word-break: break-all; margin: 10px 0px;">lrs_cleanup 终止 WinSock DLL 的使用，回收相关资源。VuGen 在 Windows 上使用 Windows 套接字协议支持应用程序的录制和回放；而在UNIX 平台上仅支持回放</div><div style="word-break: break-all; margin: 10px 0px;">lrs_accept_connection 接受侦听套接字连接</div><div style="word-break: break-all; margin: 10px 0px;">lrs_close_socket 关闭打开的套接字</div><div style="word-break: break-all; margin: 10px 0px;">lrs_create_socket 初始化套接字</div><div style="word-break: break-all; margin: 10px 0px;">lrs_disable_socket 禁用套接字操作</div><div style="word-break: break-all; margin: 10px 0px;">lrs_exclude_socket 重播期间排除套接字</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_socket_attrib 获取套接字属性</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_socket_handler 获取指定套接字的套接字处理程序</div><div style="word-break: break-all; margin: 10px 0px;">lrs_length_receive 接收来自指定长度的缓冲区的数据</div><div style="word-break: break-all; margin: 10px 0px;">lrs_receive 接收来自套接字的数据</div><div style="word-break: break-all; margin: 10px 0px;">lrs_receive_ex 接收来自数据报或流套接字的数据（具有特定长度）</div><div style="word-break: break-all; margin: 10px 0px;">lrs_send 将数据发送到数据报上或流套接字中</div><div style="word-break: break-all; margin: 10px 0px;">lrs_set_receive_option 设置套接字接收选项</div><div style="word-break: break-all; margin: 10px 0px;">lrs_set_socket_handler 设置特定套接字的套接字处理程序</div><div style="word-break: break-all; margin: 10px 0px;">lrs_set_socket_options 设置套接字选项</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　缓冲区函数：</strong></div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">lrs_free_buffer 释放分配给缓冲区的内存</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_buffer_by_name 从数据文件中获取缓冲区及其大小</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_last_received_buffer 获取套接字上接收到的最后的缓冲区及其大小</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_last_received_buffer_size 获取套接字上接收到的最后一个缓冲区的大小</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_received_buffer 获取最后接收到的缓冲区或其一部分</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_static_buffer 获取静态缓冲区或其一部分</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_user_buffer 获取套接字的用户数据的内容</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_user_buffer_size 获取套接字的用户数据的大小</div><div style="word-break: break-all; margin: 10px 0px;">lrs_set_send_buffer 指定要在套接字上发送的缓冲区</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">环境函数：</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_cleanup 终止Windows套接字 DLL 的使用</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_startup 初始化 Windows 套接字 DLL</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">关联语句函数：</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_save_param 将静态或接收到的缓冲区（或缓冲区部分）保存到参数中</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_save_param_ex 将用户、静态或接收到的缓冲区（或缓冲区部分）保存到参数中</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_save_searched_string 在静态或接收到的缓冲区中搜索出现的字符串，将出现字符串的缓冲区部分保存到参数中</div><div style="word-break: break-all; margin: 10px 0px;"><strong style="word-break: break-all; line-height: normal !important;">　　转换函数</strong>：</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_ascii_to_ebcdic 将缓冲区数据从 ASCII 格式转换成 EBCDIC 格式</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_decimal_to_hex_string 将十进制整数转换为十六进制字符串</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_ebcdic_to_ascii 将缓冲区数据从 EBCDIC 格式转换成ASCII 格式</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_hex_string_to_int 将十六进制字符串转换为整数</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">超时函数：（这一堆函数，是可以对同一个socket生效的）</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_set_accept_timeout 为接受套接字设置超时</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_set_connect_timeout 为连接到套接字设置超时</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_set_recv_timeout 执行lrs_receive命令后，等待服务器返回消息的超时时间，即服务器的响应时间。</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_set_recv_timeout2 创建连接成功，接收到服务器返回的消息后，获取匹配消息的超时时间。lrs_receive接收到数据后，会和预期的数据长度进行比较，如果长度不匹配，它将重新从套接字上读取数据，直到超时为止。</div><div style="word-break: break-all; margin: 10px 0px;">　　lrs_set_send_timeout 为发送套接字数据设置超时</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">六、实战讲解</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　在此只做简单的知识普及，便于快速上手编写socket测试脚本。简述创建连接，收发协议，关闭连接的过程。</div><div style="word-break: break-all; margin: 10px 0px;">　　初始化</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">//存放通信返回报文</div><div style="word-break: break-all; margin: 10px 0px;">char * ActualBuffer="";</div><div style="word-break: break-all; margin: 10px 0px;">//存放返回报文长度，切记附初值</div><div style="word-break: break-all; margin: 10px 0px;">int numberOfResponse = -1;</div><div style="word-break: break-all; margin: 10px 0px;">//链接是否创建成功，判断值</div><div style="word-break: break-all; margin: 10px 0px;">int rc = 0;</div><div style="word-break: break-all; margin: 10px 0px;">//返回报文是否成功，判断值</div><div style="word-break: break-all; margin: 10px 0px;">int msgOk=-1;</div><div style="word-break: break-all; margin: 10px 0px;">//存放返回报文</div><div style="word-break: break-all; margin: 10px 0px;">char * position="";</div><div style="word-break: break-all; margin: 10px 0px;">//返回报文是否成功标识</div><div style="word-break: break-all; margin: 10px 0px;">char * passMsg="succee";</div></td></tr></tbody></table><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">服务器监听</strong></div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 975px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">//--------------创建连接-----------------</div><div style="word-break: break-all; margin: 10px 0px;">rc= lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=&lt;RemoteHost&gt;", LrsLastArg);</div><div style="word-break: break-all; margin: 10px 0px;">if (rc==0){</div><div style="word-break: break-all; margin: 10px 0px;">//判断连接是否创建成功</div><div style="word-break: break-all; margin: 10px 0px;">lr_output_message("Socket was successfully created ");</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">else{</div><div style="word-break: break-all; margin: 10px 0px;">lr_output_message("An error occurred while creating the socket, Error Code: %d", rc);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">//--------------创建连接-----------------</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">收发协议</strong></div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 975px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">lrs_send("socket0", "buf0", LrsLastArg);</div><div style="word-break: break-all; margin: 10px 0px;">//往&#8220;socket0&#8221;发送"buf0"</div><div style="word-break: break-all; margin: 10px 0px;">lrs_set_receive_option(EndMarker, BinaryStringTerminator, "&lt;/html&gt;");</div><div style="word-break: break-all; margin: 10px 0px;">//设置接收协议包选项，注"&lt;/html&gt;"以实际定义协议为准，如果不设置次项。执行到lrs_receive的时候，log里面打印Waiting for writable socket 10</div><div style="word-break: break-all; margin: 10px 0px;">//secs, 0 usecs，都需要等待10秒钟。是这样的，因为你在data.ws中定义了recv buffer的长度，例如你定义为100，但是socket上的返回buffer长度不</div><div style="word-break: break-all; margin: 10px 0px;">//是100，这时候，loadrunner会尝试再次去读取，直到读到长度为100的buffer才算成功。</div><div style="word-break: break-all; margin: 10px 0px;">lrs_receive("socket0", "buf1","Flags=MSG_PEEK ", LrsLastArg);</div><div style="word-break: break-all; margin: 10px 0px;">//将&#8220;socket0&#8221;中返回的数据存放到&#8220;buf1&#8221;中</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">参数配置</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　可能细心的同学已经发现了，buf0与buf1是从哪里来的。其实这俩兄弟是在data.ws中被定义的，如下所示：</div><div style="word-break: break-all; margin: 10px 0px;">　　;WSRData 2 1</div><div style="word-break: break-all; margin: 10px 0px;">　　send buf0 5120</div><div style="word-break: break-all; margin: 10px 0px;">　　"&lt;参数化&gt;"</div><div style="word-break: break-all; margin: 10px 0px;">　　recv buf1 1024</div><div style="word-break: break-all; margin: 10px 0px;">　　-1</div><div style="word-break: break-all; margin: 10px 0px;">　　5120：此数值为socket协议传输内容长度，切记严格输入正确长度值。</div><div style="word-break: break-all; margin: 10px 0px;">　　"&lt;参数化&gt;"：为buf0所传输内容。相对于loadrunner的http协议参数用{}来说，socket协议参数化采用&lt;&gt;作为定义符。</div><div style="word-break: break-all; margin: 10px 0px;">　　接收参数判断</div><div style="word-break: break-all; margin: 10px 0px;">　　在做了接收之后，我们需要提取&#8220;buf1&#8221;中的某些关键字符作为通信成功标识。</div><div style="word-break: break-all; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 975px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">//获取套接字上接收到的最后的缓冲区及其大小</div><div style="word-break: break-all; margin: 10px 0px;">lrs_get_last_received_buffer("socket0",&amp;ActualBuffer,&amp;numberOfResponse);</div><div style="word-break: break-all; margin: 10px 0px;">//查询返回报文是否成功</div><div style="word-break: break-all; margin: 10px 0px;">position = (char *)strstr(ActualBuffer, passMsg);</div><div style="word-break: break-all; margin: 10px 0px;">// strstr has returned the address. Now calculate * the offset from the beginning of str</div><div style="word-break: break-all; margin: 10px 0px;">msgOk = (int)(position - ActualBuffer + 1);</div><div style="word-break: break-all; margin: 10px 0px;">if(msgOk&gt;0){</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction("核心对私维护", LR_PASS);</div><div style="word-break: break-all; margin: 10px 0px;">lr_output_message("本次交易：%s",ActualBuffer);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">else{</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction("核心对私维护", LR_FAIL);</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("本次交易：%s",ActualBuffer);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">关闭连接</div><div style="word-break: break-all; margin: 10px 0px;">//--------------断开socket--------------</div><div style="word-break: break-all; margin: 10px 0px;">lrs_disable_socket("socket0", DISABLE_SEND_RECV);</div><div style="word-break: break-all; margin: 10px 0px;">//--------------关闭socket--------------</div><div style="word-break: break-all; margin: 10px 0px;">lrs_close_socket("socket0");</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">六、总结</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　简要描述了利用Loadrunner编写socket性能测试脚本的过程，如有错漏，请予以指正。</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/416568.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-08-05 09:53 <a href="http://www.blogjava.net/qileilove/archive/2014/08/05/416568.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Lr11、QTP11破解时需要注意的问题</title><link>http://www.blogjava.net/qileilove/archive/2014/07/30/416314.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 30 Jul 2014 01:54:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/30/416314.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/416314.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/30/416314.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/416314.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/416314.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　虽然很早之前就成功装过这两个软件了。但是前阵子重装了系统再装这两个软件时却发现我又把破解的方法给忘了。后来从历史文档中搜索了好久才得到解决。想想这些还是需要总结，事情多了，难免忘记。也分享给需要的童鞋们。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　LR11的破解方法</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1)退出程序，把下载文件中的lm70.dll和mlr5lprg.dll覆盖掉..\HP\LoadRunner\bin下的这两个文件</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2)注意，win7的话一定要以管理员身份运行启动程序，启动后，点击 configuration-&gt;loadrunner license，此时可能会有两个许可证信息存在，退出程序，点击deletelicense.exe文件，来删除刚才得许可证信息（即时原来没有lisense最好也运行一下）</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3）再次打开程序， configuration-&gt;loadrunner license-&gt;new license，在弹出的输入框中输入license序列号AEABEXFR-YTIEKEKJJMFKEKEKWBRAUNQJU-KBYGB，点击确定，验证通过后，则破解成功！</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">QTP11的破解方法</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1)安装成功后，手工创建：C:\Program Files\Common Files\Mercury Interactive下，</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　建立文件夹License Manager（这个很重要，必须要创建）</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2)拷贝破解文件mgn-mqt82.exe至第一步创建的目录下。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3)运行破解文件，提示在C:\Program Files\Common Files\Mercury Interactive下创建了lservrc文件</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　4)用记事本打开lservrc，拷贝第一个#号前的一大串字符串。运行<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">QTP</strong></u></a>，输入这串字符</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　5)安装QTP的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">功能测试</strong></u></a>许可服务器安装程序（打开qtp11的安装包里边的）</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　6)删掉SafeNet Sentinel目录（C:\ProgramData\SafeNet Sentinel）</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　7)运行\HP\QuickTest Professional\bin中的instdemo.exe</div><img src ="http://www.blogjava.net/qileilove/aggbug/416314.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-07-30 09:54 <a href="http://www.blogjava.net/qileilove/archive/2014/07/30/416314.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner压力测试时监控服务器Linux的资源情况</title><link>http://www.blogjava.net/qileilove/archive/2014/07/09/415628.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 09 Jul 2014 07:59:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/09/415628.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/415628.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/09/415628.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/415628.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/415628.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">在进行负载<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>（Load Test）是要监控服务器的CPU、内存、磁盘、网络的情况。如何监控Ubuntu的情况呢。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1、安装rstatd，sudo apt-get install rstatd，如果无法apt安装，可以下载安装。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2、启动rpc.rstatd</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　查看是否正常启动，用如下命令</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">rpcinfo -p</div><div style="word-break: break-all; margin: 10px 0px;">[root@localhost ~]# rpcinfo -p</div><div style="word-break: break-all; margin: 10px 0px;">program vers proto &nbsp; port</div><div style="word-break: break-all; margin: 10px 0px;">100000 &nbsp; &nbsp;2 &nbsp; tcp &nbsp; &nbsp;111 &nbsp;portmapper</div><div style="word-break: break-all; margin: 10px 0px;">100000 &nbsp; &nbsp;2 &nbsp; udp &nbsp; &nbsp;111 &nbsp;portmapper</div><div style="word-break: break-all; margin: 10px 0px;">100024 &nbsp; &nbsp;1 &nbsp; udp &nbsp; &nbsp;676 &nbsp;status</div><div style="word-break: break-all; margin: 10px 0px;">100024 &nbsp; &nbsp;1 &nbsp; tcp &nbsp; &nbsp;679 &nbsp;status</div><div style="word-break: break-all; margin: 10px 0px;">100001 &nbsp; &nbsp;3 &nbsp; udp &nbsp; &nbsp;691 &nbsp;rstatd</div><div style="word-break: break-all; margin: 10px 0px;">100001 &nbsp; &nbsp;2 &nbsp; udp &nbsp; &nbsp;691 &nbsp;rstatd</div><div style="word-break: break-all; margin: 10px 0px;">100001 &nbsp; &nbsp;1 &nbsp; udp &nbsp; &nbsp;691 &nbsp;rstatd</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　3、在<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>&nbsp;Controller的run界面中，添加System Resource Graphs下的Unix Resource，在Unix Resource图上右键Add Measurements，然后点击Add，填写ip如192.168.1.99，默认只有三个指标，在下面的Add中可以添加其他指标。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　4、下面说一下各种指标的情况</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　CPU指标</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Average load</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　上一分钟同时处于&#8220;就绪&#8221;状态的平均进程数，&lt; CPU个数 * 核心数 * 0.7</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　CPU utilization</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　CPU 的使用时间百分比，如果在75%以上，则可以考虑换CPU了</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Swap-in rate</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　正在交换的进程数</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Swap-out rate</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　正在交换的进程数</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Context switches rate</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　每秒钟在进程或线程之间的切换次数</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　System mode CPU utilization</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在系统模式下使用 CPU 的时间百分比</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　User mode CPU utilization</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在用户模式下使用 CPU 的时间百分比</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Interrupt rate</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　每秒内的设备中断数</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　内存</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Page-in rate</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　每秒钟读入到物理内存中的页数</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Page-out rate</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　每秒钟写入页面文件和从物理内存中删除的页数</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Paging rate</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　每秒钟读入物理内存或写入页面文件的页数，如果持续在几百，可能要加大内存了</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　LoadRunner采集的数据中，内存的使用情况是没有的，可以装sar，然后用sar来观察：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　可以使用该命令sar -n DEV -u -r 3 120 &gt; perform.log</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　这个命令3秒采样一次，共采样120次&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">360</strong></u></a>秒＝6分钟，可以根据自己的需要调整 3 和 120 这两个值。perform.log是保存的文件名<br /><br /><div style="word-break: break-all; margin: 10px 0px;">磁盘</div><div style="word-break: break-all; margin: 10px 0px;">　　Collision rate</div><div style="word-break: break-all; margin: 10px 0px;">　　每秒钟在以太网上检测到的冲突数</div><div style="word-break: break-all; margin: 10px 0px;">　　Disk rate</div><div style="word-break: break-all; margin: 10px 0px;">　　磁盘传输速率</div><div style="word-break: break-all; margin: 10px 0px;">　　网络</div><div style="word-break: break-all; margin: 10px 0px;">　　Incoming packets error rate</div><div style="word-break: break-all; margin: 10px 0px;">　　接收以太网数据包时每秒钟接收到的错误数</div><div style="word-break: break-all; margin: 10px 0px;">　　Incoming packets rate</div><div style="word-break: break-all; margin: 10px 0px;">　　每秒钟传入的以太网数据包数</div><div style="word-break: break-all; margin: 10px 0px;">　　Outgoing packets errors rate</div><div style="word-break: break-all; margin: 10px 0px;">　　发送以太网数据包时每秒钟发送的错误数</div><div style="word-break: break-all; margin: 10px 0px;">　　Outgoing packets rate</div><div style="word-break: break-all; margin: 10px 0px;">　　每秒钟传出的以太网数据包数</div><div style="word-break: break-all; margin: 10px 0px;">　　pps是</div><div style="word-break: break-all; margin: 10px 0px;">　　以太网传输最小包长是64字节。包转发线速的衡量标准是以单位时间内发送64byte的数据包（最小包）的个数作为计算基准的。</div><div style="word-break: break-all; margin: 10px 0px;">　　对于千兆以太网来说，计算方法如下：</div><div style="word-break: break-all; margin: 10px 0px;">　　1000Mbps/((64B+8B+12B)&#215;8bit)=1.488095pps</div><div style="word-break: break-all; margin: 10px 0px;">　　说明：当以太网帧为64Byte时，需考虑8Byte的前导符和12Byte的帧间隙的固定开销。</div><div style="word-break: break-all; margin: 10px 0px;">　　在以太网中，每个帧头都要加上了8个字节的前导符，前导符的作用在于告诉监听设备数据将要到来。然后，以太网中的每个帧之间都要有帧间隙，即每发完一个帧之后要等待一段时间再发另外一个帧，在以太网标准中规定最小是12个字节，然而帧间隙在实际应用中有可能会比12个字节要大，在这里我用了最小值。每个帧都要有20个字节的固定开销。（另外这20字节的信息是不能通过抓包软件抓下来的）</div><div style="word-break: break-all; margin: 10px 0px;">　　因此一个全双工线速的千兆以太网端口在转发64Byte包时的包转发率为1.488Mpps。</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">以下是常用以太网端口的包转发率：</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　1、万兆以太网：14.88Mpps</div><div style="word-break: break-all; margin: 10px 0px;">　　2、千兆以太网：1.488Mpps</div><div style="word-break: break-all; margin: 10px 0px;">　　3、百兆以太网：0.1488Mpps</div><div style="word-break: break-all; margin: 10px 0px;">　　4、十兆以太网：0.01488Mpps(14.88Kpps)</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/415628.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-07-09 15:59 <a href="http://www.blogjava.net/qileilove/archive/2014/07/09/415628.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner中文乱码问题解决方法</title><link>http://www.blogjava.net/qileilove/archive/2014/07/08/415590.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 08 Jul 2014 06:09:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/08/415590.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/415590.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/08/415590.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/415590.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/415590.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　前段时间在录制，增强，整合<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>脚本，期间两次遇到了中文乱码问题。在此记录一下中文乱码问题的解决办法。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　一、录制回放中文乱码</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　我录制登陆的脚本，用户名中出现中文，回放的时候总是提示登陆失败。如下图：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46770" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_201407041117581Ugnr.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　　</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-align: center; background-color: #ffffff;">图1 LR回放中文乱码</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　解决中文乱码可以在录制的时候在Virtual User Gen的 Tools-&gt;Recoding Options -&gt; Advanced -&gt; Support charset -&gt; UTF-8。重新录制后中文乱码问题得到解决。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">二、整合脚本中文乱码</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　录制增强（参数化，关联，检查点，事务）脚本后决定将几个脚本整合在一起。于是新建了一个空的脚本，将登陆退出公用操作分别放在vuser_init和vuser_end中，其他操作放在各自的Action中。整理完成回放后又出现中文乱码。为解决这个问题，最关键的是要把本地GBK编码的汉字转换成UTF-8编码格式的信息，为此我们引进loadrunner自带的编码函数lr_convert_string_encoding。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　int lr_convert_string_encoding ( const char *sourceString, const char *fromEncoding, const char *toEncoding, const char *paramName);</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">该函数有4个参数，含义如下：</strong></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　sourceString：被转换的源字符串。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　fromEncoding：转换前的字符编码。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　toEncoding：要转换成为的字符编码。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　paramName：转换后的目标字符串。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">实践一</strong>：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　lr_convert_string_encoding("登陆账号",LR_ENC_SYSTEM_LOCALE, LR_ENC_UTF8, "Account");</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　web_submit_data("login.quick",</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　&#8230;&#8230;</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　"Name=account", "Value={Account}", ENDITEM,</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　&#8230;&#8230;</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　LAST);</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　回放脚本的时候依然报错。查看lr_convert_string_encoding的解释，它会在其转换的字符串末尾加上\x00。在C语言中\X00是一个字符串的结束，而正是这个\x00的存在导致了脚本回放失败。</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">实践二</strong>：</div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">char tmp[100];</div><div style="word-break: break-all; margin: 10px 0px;">lr_convert_string_encoding("登陆账号",LR_ENC_SYSTEM_LOCALE, LR_ENC_UTF8, "Account");</div><div style="word-break: break-all; margin: 10px 0px;">strcpy(tmp,lr_eval_string("{Account}"));</div><div style="word-break: break-all; margin: 10px 0px;">lr_save_string(tmp,"Account");</div><div style="word-break: break-all; margin: 10px 0px;">web_submit_data("login.quick",</div><div style="word-break: break-all; margin: 10px 0px;">&#8230;&#8230;</div><div style="word-break: break-all; margin: 10px 0px;">"Name=account", "Value={Account}", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px;">&#8230;&#8230;</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.600000381469727px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　通过strcpy和lr_save_string的处理屏蔽\x00的影响，<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>结果正常</div><img src ="http://www.blogjava.net/qileilove/aggbug/415590.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-07-08 14:09 <a href="http://www.blogjava.net/qileilove/archive/2014/07/08/415590.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>lr检查点</title><link>http://www.blogjava.net/qileilove/archive/2014/07/07/415557.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 07 Jul 2014 13:31:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/07/415557.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/415557.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/07/415557.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/415557.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/415557.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">前言</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　很久很久没有更新博客了。久到我都不记得上一次更新博客是什么时候，久到我们博客主机都过期了，一度我还想停掉这个博客。好在有simon的坚持才决定博客继续整下去。2013年对我来说是一个比较折腾的一年。一年之类换了两份<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>。找工作的时候才发现理想与现实之间的差距是如此的巨大。期间经历了落差、失望、彷徨&#8230;&#8230;</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　最近一段时间给我们组成员培训<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>，我自己也有所收获，也就有了这篇<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">文章</strong></u></a></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　一、为什么要使用检查点</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　为什么要使用检查点，那就要说明一下LR如何判断脚本是否执行成功。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　LR判断脚本是否执行成功是根据服务器返回的状态来确定的，如果服务器返回的HTTP状态为 200 OK ，那么VuGen 就认为脚本正确地运行了，并且是运行通过的。在绝大多数系统出错时会返回错误页面码？ 不会一般系统都会返回一个消息提示框，来提升用户感受。例如，&#8220;网站繁忙，请稍后&#8221;。其实这个时候网站已经无法正确响应用户请求了，但是VuGen 脚本无法识别，会错误地认为网站还能正确访问，导致分析错误。所以这时需要一种检查点函数帮助验证请求发送出去后，服务器的返回是不是期望的内容，如果不是，那么就说明服务器返回无法提供正常的服务了。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　另外，需要特别说明的是，检查点一般跟事务结合起来使用。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">二、事务结束的四种状态</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　前面说到检查点一般跟事务结合使用。这样需要说明一下事务（transaction）。我认为事务是LR中非常非常重要的一个概念。因为完成一个事务所需要的时间是响应时间（Trans Response Time），一秒钟可以完成多少事务是TPS（Trans/Sec）。响应时间和TPS是<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>中非常重要的两个指标。可以通过这两个指标来分析系统是否出现瓶颈。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　LR中事务结束的时候需要带上一个状态码(Transaction Status)。LR中Transaction Status有四个， 分别为LR_PASS， LR_FAIL， LR_AUTO ， LR_STOP。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　LR_AUTO：事物的状态被自动设置，如果事务执行成功，状态设置为PASS，如果执行失败，状态设置为FAIL,如果由于异常中断，状态被设置成STOP.</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　LR_PASS：事务如果执行成功，代码的返回状态就是PASS。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　LR_FAIL：事务如果执行失败，代码的返回状态就是FAIL。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　一般情况下会选择LR_AUTO，让LR自动判断事务的状态。可是如上面所说LR判断脚本是否执行成功是根据服务器返回的状态来确定的，也就是只要服务器返回的HTTP状态为 200 OK ，事务执行后状态总是被置为LR_PASS。这样不科学的地方在于，LR提示成功的事务你不知道实际上它到底是成功的还是失败的。所以，这就需要检查点了。使用只有事务执行成功才会出现的文本或者图片（PS：虽然图片检查点我从来没用过）来作为事务是否执行成功的标准。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">三、如何添加检查点</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　使用文本检查点（下面简称检查点）需要使用web_reg_find函数。函数的使用详见LR帮助手册，如果不会用可以下面的实战部分。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　另外说明一下如果web_reg_find查找中文失败，完全可以查找英文，只要能实现检查点功能就可以了，如果执意要查找英文，请将Record-Options 中勾选support charset中的UTF-8后重新录制。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　四、如何选择检查点</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　选择什么作为检查点，这是困扰了很久了一个问题。就拿登陆来说，并不是所有的系统登陆完成后系统跳转到登陆成功的页面。这里这需要借助运行时查看器（run-time viewer）来帮助我们查找合适的检查点。运行时查看器在选择工具（tools）-常规选项(general Options)-显示(Display) ，选择 打开运行时查看器和自动排列窗口。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　运行时查看器的使用我还得感谢我们组成员文武同学。我还老吐槽他老开着这没用的玩意干嘛，我承认我错了。<br /><div style="word-break: break-all; margin: 10px 0px;"><strong style="word-break: break-all; line-height: normal !important;">　五、实战</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　以网站www.huhoo.com（一不小心透露了经纬度）登陆举例，录制登陆脚本后回放，回放的时候打开运行时查看器。可以看到登陆成功后发回这样的信息。</div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=46768" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_2014070411101311eli.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　　</div><div style="word-break: break-all; margin: 10px 0px;">图1 登陆成功后返回信息</div><div style="word-break: break-all; margin: 10px 0px;">　　然后修改脚本，故意将用户名的密码弄错，重新回放</div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=46769" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/07/14982672_201407041110132QzDZ.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a>　　</div><div style="word-break: break-all; margin: 10px 0px;">图2 登陆错误后返回信息</div><div style="word-break: break-all; margin: 10px 0px;"><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　结合两张图可以看出，用&#8221;code&#8221;:0作为检查点比较合适。因为这样的文本在登陆失败时没有出现。但是如果用&#8220;msg&#8221;来作为检查点就不合适，因为不管登陆成功和失败都出现了这也的文本，不能作为检查登陆成功的标准。</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　检查点示例代码如下：</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">web_reg_find("Text=\"code\":0","SaveCount=Code_Count", LAST );</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">lr_start_transaction("login");</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">web_submit_data("login.quick",</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">"Action=http://www.huhoo.com/p/login.quick/",</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">&#8230;&#8230;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">"Name=account", "Value=XXXXXX", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">"Name=password", "Value=XXXXX", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">LAST);</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">if (atoi(lr_eval_string("{Code_Count}")) &gt; 0){</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">//lr_output_message("Log on successful.");</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">lr_end_transaction("login", LR_PASS);</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">else{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">lr_error_message("Log on failed");</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">lr_end_transaction("login", LR_FAIL);</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return -1;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　完整脚本下载：传送门</div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　<strong style="word-break: break-all;">说明：</strong></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;">　　脚本中用户名，密码已经被我用XXX替换，如果想用此脚本做实验，请到虎虎官网www.huhoo.com注册用户，并将用户名写入脚本中。</div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/415557.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-07-07 21:31 <a href="http://www.blogjava.net/qileilove/archive/2014/07/07/415557.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner中的IP欺骗的设置以及误区</title><link>http://www.blogjava.net/qileilove/archive/2014/07/02/415373.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 02 Jul 2014 08:31:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/02/415373.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/415373.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/02/415373.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/415373.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/415373.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">最近在忙着部署<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a><a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>的环境后，对IP欺骗进行设置，特地做个笔记，给自己的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">学习</strong></u></a>历程留下点足迹。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">一. 什么是IP欺骗？</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　做什么事首先要问个为什么，如果知道为什么了，即使不知道如何做，简单，google it，答案总会找得到，google.cn不行，google.com总行，来自全球的搜索结果，总会有帮助。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　IP spoof即IP 电子欺骗，我们可以说是一台主机设备冒充另外一台主机的IP地址，与其它设备通信，从而达到某种目的技术。 IP是网络层的一个非面向连接的协议， IP数据包的主要内容由源IP地址，目地IP地址，所传数据构成，IP的任务就是根据每个数据报文的目的地址，路由完成报文从源地址到目的地址的传送。至于报文在传送过程中是否丢失或出现差错，IP不会考虑，那是TCP的事。对IP来讲，源设备与目的设备没有什么关系，它们是相互独立的。IP包只是根据数据报文中的目的地址发送，因此借助高层协议的应用程序来伪造IP地址是比较容易实现的。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">二. 为什么要设置IP欺骗？</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　对于某些服务器，是根据IP来分配资源，当某个IP地址访问频繁或者访问量过大时，服务器会拒绝访问，或者让你输入验证码，当然也有可能是来避免搜索引擎robot的任意爬取。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　网上还有些言论是说使用更多的IP来模拟较真实的用户使用环境，来测试负载均衡技术的处理能力，但是我始终想不明白这跟那个有什么关系，如果服务器可以接受同一IP大量访问，负载均衡不照样起作用，照样可以被测试到吗？（私人观点，意见可以保留）</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">三. 设置前的准备<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a></strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　1. 要有局域网的环境，因为只能设置局域网内的网段；</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　2. 本地的IP设置不能为&#8220;自动获取&#8221;，必须指定一个静态IP。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">四. 如何设置</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　第一步：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　运行Mercury LoadRunner- Tools-IP Wizard</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　第二步：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　选择create new setting，点击&#8220;下一步&#8221;</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　此时出现的页面是让输入服务器的IP地址，<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Loadrunner</strong></u></a>通过该地址更新路由表。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　客户端计算机上添加新的IP地址后，服务器需要将该地址添加到路由表，以便能够识别返回到客户端的路由。如果服务器和客户端具有相同的子网掩码、IP 类和网络，则不需要修改服务器的路由表。如果客户端和服务器计算机之间有一个路由器，则服务器需要识别经过该路由器的路径。确保将以下路由添加到服务器路由表：从 Web 服务器到路由器的路由，以及从路由器到负载生成器计算机上的所有 IP 地址的路由。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　第三步：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在输入web服务器地址的页面中输入地址后，直接点击&#8220;下一步&#8221;</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　进入IP添加页面，点击&#8220;add&#8221;进行添加</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　第四步：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在from ip 输入框中输入起始ip，在Number to输入框中输入ip地址的位数，输入正确的子网掩码，选中&#8220;verify that new ip addresses are not already used&#8221;，点击&#8220;ok&#8221;，此时IP Wizard会自动按照设置生成IP地址，并且将已经占用的IP列出。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　第五步：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　确认可用IP地址列表内容后，点击&#8220;ok&#8221;，此时IP Wizard提示需要重新启动计算机，点击&#8220;save as&#8221;保存IP列表，点击&#8220;ok&#8221;，重新启动计算机。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　注：当保存IP地址列表后，下次启用IP欺骗时直接选择load previous setting from.....<br /><div style="word-break: break-all; margin: 10px 0px;">第六步：</div><div style="word-break: break-all; margin: 10px 0px;">　　启用IP欺骗</div><div style="word-break: break-all; margin: 10px 0px;">　　选中Tools下的Expert mode，启动专家模式Expert mode，再点击Tools下的options，在Genearl选项卡中设置以线程方式或进程方式进行性能测试，这个选项一定要与当前场景的模式相匹配，也就是说使用本地虚拟IP测试时需要选中线程方式，使用负载生成器使用虚拟IP测试时需要选中进程方式。</div><div style="word-break: break-all; margin: 10px 0px;">　　在controller中，选择 Scenario-〉Enable IP Spoofer，此项设置允许使用IP欺骗。</div><div style="word-break: break-all; margin: 10px 0px;">　　第七步：</div><div style="word-break: break-all; margin: 10px 0px;">　　验证IP欺骗是否有效</div><div style="word-break: break-all; margin: 10px 0px;">　　方法一</div><div style="word-break: break-all; margin: 10px 0px;">　　计算机重新启动后，在运行行中输入：CMD，在DOS命令提示符窗口中输入：IPCONFIG，此时便可看到虚拟的IP地址均已经被启用；</div><div style="word-break: break-all; margin: 10px 0px;">　　方法二</div><div style="word-break: break-all; margin: 10px 0px;">　　在脚本的Action()部分增加如下代码：</div><div style="word-break: break-all; margin: 10px 0px;">　　char * ip=lr_get_vuser_ip();</div><div style="word-break: break-all; margin: 10px 0px;">　　if(ip)</div><div style="word-break: break-all; margin: 10px 0px;">　　lr_vuser_status_message("The ip address is %s",ip);</div><div style="word-break: break-all; margin: 10px 0px;">　　else</div><div style="word-break: break-all; margin: 10px 0px;">　　lr_vuser_status_message("IP spoofing disabled");</div><div style="word-break: break-all; margin: 10px 0px;">　　然后通过控制器设置并运行场景，日志中可以看到IP地址。</div><div style="word-break: break-all; margin: 10px 0px;">　　第八步：</div><div style="word-break: break-all; margin: 10px 0px;">　　这一部很重要，如果不做这一步，很多IP地址就被占用了，可能你们网管跟你闹上了呵呵。打开IP Wizard，选择restore original settings释放所有虚拟IP。</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　五.误区及答疑</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　到现在为止，IP spoofer设置就告终了，但是最后有些疑问或者叫误区需要分享一下。</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　Q/A：</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　1.自己本地的IP地址不在虚拟IP段内，有影响吗？</div><div style="word-break: break-all; margin: 10px 0px;">　　答：没有</div><div style="word-break: break-all; margin: 10px 0px;">　　2.是否需要配置多个load generator来对应不同的虚拟IP呢？</div><div style="word-break: break-all; margin: 10px 0px;">　　答：不用，这个过程是generator自己完成的。</div><div style="word-break: break-all; margin: 10px 0px;">　　3.不同的generator是否都需要设置IP spoof呢？</div><div style="word-break: break-all; margin: 10px 0px;">　　答：Definitely Yes，不然的话不设IP欺骗的那台只会使用一个本地的IP执行。</div><div style="word-break: break-all; margin: 10px 0px;">　　4.虚拟用户数和虚拟IP数量上有什么关系呢？</div><div style="word-break: break-all; margin: 10px 0px;">　　答：如果虚拟用户数大于IP数量时，每个用户会得到不同的IP，否则，会有IP重复的现象。</div><div style="word-break: break-all; margin: 10px 0px;">　　5. 还有别的办法添加虚拟IP吗？</div><div style="word-break: break-all; margin: 10px 0px;">　　条条大路通罗马，试试这个。</div><div style="word-break: break-all; margin: 10px 0px;">　　在一台机上虚拟的IP跨网段的处理,可通过在服务器端添加路由来实现。</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　例：</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　服务器IP：192.168.0.1</div><div style="word-break: break-all; margin: 10px 0px;">　　测试机IP：192.168.0.206</div><div style="word-break: break-all; margin: 10px 0px;">　　测试机上添加的虚拟IP： 192.168.10.1~128</div><div style="word-break: break-all; margin: 10px 0px;">　　那么在服务器端执行以下命令：</div><div style="word-break: break-all; margin: 10px 0px;">　　route add 192.168.10.0 mask 255.255.255.0 192.168.0.206</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/415373.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-07-02 16:31 <a href="http://www.blogjava.net/qileilove/archive/2014/07/02/415373.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我怎么做性能测试</title><link>http://www.blogjava.net/qileilove/archive/2014/06/30/415317.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 30 Jun 2014 10:45:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/06/30/415317.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/415317.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/06/30/415317.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/415317.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/415317.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">今天和同事交流关于<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>的东西，以前也做过性能测试，突然想写点自己关于如何做性能测试的认识。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　基于B/S架构的系统，利用loadrunner做性能测试，利用nmon监控系统资源（用linux自带的top，vmstat等命令也可以，写一些简单的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">shell</strong></u></a>脚本就行了）。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　那么到底该怎么去做性能测试呢？</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">1、首先要了解被测系统的结构和有关知识的储备。</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　了解了被测系统，在后期性能出现异常的时候，定位就相对容易一些；而且知道在测试的过程中需要监控什么。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　一个简单B\S系统结构图：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46476" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/06/14982672_2014061813154110k2r.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　该系统有一下及部分组成：</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　APP：一台nginx，兼做<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>和应用服务器</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Memcached：负责做数据缓存</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　lucene：负责做搜索</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　RabbitMQ：负责某些业务的队列处理</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　mysql：<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>服务器，一个主库，一个从库</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　从以上系统结构来看，要搭建和维护性能测试环境，需要的一些必要的知识。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　对于APP：需要了解nginx的相关知识，怎么修改配置，在哪里看日志</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　对于Memcached：怎么搭建Memcached，怎么查看命中率，Memcached的作用是什么</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　lucene:这个lucene是干什么用的，要怎么配置</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　RabbitMQ：MQ要如何配置，都那些业务用到了MQ。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　Mysql：如何配置主从，为什么要配置主从，主从如何同步等等</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　在搭建环境的过程中肯定会遇到这样或那样的问题，要自己找资料，或者相关的开发人员一起解决，并注意做笔记，防止以后同样的问题再出现。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">2、了解了系统结构，开始搭建测试环境，并准备数据。</strong></div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　测试环境尽量要和生产环境的结构保持一致，还有配置文件等也要保持一致，这样能保证性能测试的结果更加真实和接近生产环境。</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　数据准备一定要充足，而且数据量要大于等于生产环境，这样能更真实的模拟生产环境。比如对一个select语句而言，10W的数据，和1000W的数据，查询时间肯定有差别。如果数据量太小就不能反映真实情况下性能了。（可以把线上的数据导入到测试环境，但是要注意把用户比较隐私的数据都替换掉）</div><div style="word-break: break-all; line-height: 21.59375px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff;">　　如果有可能的话，测试环境的数据要比生产环境多出20%，做一些性能上边的冗余，防止发生突然的性能尖峰<br /><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">3、了解需求，找出测试点</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　和产品、技术沟通需要做性能测试的业务；并了解相应的业务的性能指标，如页面的响应时间，TPS（事物处理）或者系统期望能承受多少并发等。</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　4、设计性能能测试用例</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　根据业务编写相应的性能测试用例。</div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=46477" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/06/14982672_2014061813154126ftV.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; margin: 10px 0px;">　　功能</div><div style="word-break: break-all; margin: 10px 0px;">　　在线用户达到高峰时，用户可以正常发帖，保证200个以内用户可以同时发表帖子。</div><div style="word-break: break-all; margin: 10px 0px;">　　目的</div><div style="word-break: break-all; margin: 10px 0px;">　　测试系统200个以内的用户同时在线发帖。</div><div style="word-break: break-all; margin: 10px 0px;">　　方法</div><div style="word-break: break-all; margin: 10px 0px;">　　采用LoadRunner的录制工具录制一个邮件发送过程，然后对脚本进行优化，加上事物点，检查点等。过程中监视B端的响应，还有网络传输，web服务和数据库服务器的性能，并观察服务器相应服务的日志，检查MQ的状态，memcached服务器的状态和性能</div><div style="word-break: break-all; margin: 10px 0px;">　　预期结果</div><div style="word-break: break-all; margin: 10px 0px;">　　符合业务的预期，日志木有异常等（不详细列举）</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">5、编写并优化脚本</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　根据测试用例录制发帖的脚本，加入事物点、检查点、参数化，并回放，确保脚本没有问题，可以正常运行。</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">6、设计性能测试场景</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　设置一个渐进的场景10-30-60-100-150-200，这么做的目的防止一下子上去就是200个并发，出了问题，不知道系统最佳的并发是多少。</div><div style="word-break: break-all; margin: 10px 0px;">　　（上边的渐进场景不一定合理，只做示意）</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">7、启动监控，并开始跑性能测试场景</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　设置场景完毕后，开始在服务器端启动监控，然后开始启动场景。</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">8、监控场景执行，监控服务器的资源</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　loadrunner可以搜集一些性能测试数据，事物的pass数，fail数，error数，都要做统计。</div><div style="word-break: break-all; margin: 10px 0px;">　　监控服务器的资源，可以利用nmon，也可以是用linux自带的命令top，vmstat等。</div><div style="word-break: break-all; margin: 10px 0px;">　　也要监控服务器的日志输出，看是否有异常出现。例如：查看mysql的慢日志，nginx的日志等。</div><div style="word-break: break-all; margin: 10px 0px;">　<strong style="word-break: break-all; line-height: normal !important;">　9、搜集结果数据，分析探讨</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　最后对性能测试搜集的数据进行分析，找出性能测试的拐点。</div><div style="word-break: break-all; margin: 10px 0px;">　　<strong style="word-break: break-all; line-height: normal !important;">10、对系统进行优化，并重复7-9步，直至测试结束</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　PS:性能测试不是一个人的事情，中间设计了，开发，产品，运维，QA，DBA，要大家共同协作，才能做好性能测试。</div><div style="word-break: break-all; margin: 10px 0px;">　　限于水平有限，用疏漏之处，多多包涵。</div><div style="word-break: break-all; margin: 10px 0px;"></div><div style="word-break: break-all; margin: 10px 0px; height: 21px; position: relative; width: 627.1875px;"></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/415317.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-06-30 18:45 <a href="http://www.blogjava.net/qileilove/archive/2014/06/30/415317.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner如何开展性能测试</title><link>http://www.blogjava.net/qileilove/archive/2014/06/20/414961.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 20 Jun 2014 05:03:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/06/20/414961.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/414961.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/06/20/414961.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/414961.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/414961.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　最近一直想理清思路，特别是碰到一些业务复杂的项目，要求做<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>，结果一时就不知道怎么下手了。因为之前<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">面试</strong></u></a>的时候，也碰到很多面试官对性能测试知识方面的提问，面试多了，就有经验，现在写下来，脑子不会乱，按思路，照说照做吧！！</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">使用工具如何开展性能测试<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>呢？不多说，自己的思路如下步骤：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1、接到项目时，首先了解系统架构，是B/S，还是C/S，使用什么应用服务器（即中间件），什么<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>？</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2、熟悉系统的功能、业务流程，明确项目的性能需求是什么？有哪些性能指标？</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3、编写性能测试计划。（有些公司不要求写）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　4、设计性能测试用例。（按场景设计思路来写比较清晰）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　5、准备测试数据，如一些业务需要大数据量的，就要先造好数据。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　6、选择录制协议，录制两份业务需求功能一样的脚本。（好处是：一是可以做脚本备份，二是脚本优化查找需要关联的地方）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　7、优化脚本，包括设置参数化，检查点，关联，集合点，事务以及自行编写的函数，日志输出函数等。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　8、创建场景。（创建两份一样的场景，以20/80并发用户原则递增来设计，如并发要100个用户，第一份创建80个用户并发，第二份创建100个用户并发，这样在结果分析中容易发现）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　9、场景设计，添加集合点策略，负载均衡器，对&#8220;运行时设置&#8221;，如lr_think_time，迭代设置，日志输出控制等。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　10、场景运行，添加监控图表，服务器系统资源监控计数器，数据库系统资源监控等。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　11、性能结果分析，通过监控图表的数据（事务响应时间、点击率、吞吐量）、系统资源分析、<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>页面诊断分析等。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　12、收集测试结果，编写性能测试报告。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　以上是自己总结的一点经验，有不对的思路请大家多多指教。活到老，学到老！</div><img src ="http://www.blogjava.net/qileilove/aggbug/414961.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-06-20 13:03 <a href="http://www.blogjava.net/qileilove/archive/2014/06/20/414961.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner中Action的迭代次数的设置和运行场景中设置</title><link>http://www.blogjava.net/qileilove/archive/2014/06/16/414787.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 16 Jun 2014 02:18:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/06/16/414787.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/414787.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/06/16/414787.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/414787.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/414787.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>是怎么重复迭代和怎么增加并发运行的呢？</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　另外，在参数化时，对于一次压力<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>中均只能用一次的资源应该怎么参数化呢？就是说这些资源用了一次就不能在用了的。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　－－参数化时,在select &nbsp;next row选择unique,update value on选择 each occurence,</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">1. 迭代跟虚拟用户数没什么必然联系</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　迭代是这样的：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　迭代1次 &nbsp; 迭代2次 &nbsp;迭代3次</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　用户1 &nbsp; &nbsp; X1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; X2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; X3</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　用户2 &nbsp; &nbsp; Y1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; X2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Y3</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　其中的X1-3 Y1-3是参数，参数规则就是二楼说的</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这么两个用户是根据你的rump up 上来的，比如5秒上两个用户，那么用户1和2就在5秒之内加载进来的，不知道说清楚了没。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　第二个问题就简单了，只能用一次的参数，首先确保你的参数足够，另外规则选择的时候，注意选择唯一</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　迭代次数只是对你设置了迭代次数的action进行迭代，而用户数可以理解为对整个录制过程的迭代（只是各个用户不同）　而且增加并发量可以通过增加用户来达到　还可以设置集合点来增加某个操作的并发量</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　假如一个脚本，设置最大并发量为10，每5秒中增加2个并发用户，而Action设置的迭代为10次：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　当开始至2秒时，加载了2个用户，这2个用户分别开始运行，并都运行10次，不管这个2个用户运行10次是否结束，当下一个2两秒到来时，即开始至第4秒时又加载了2个用户，这2个又运行10次；就这样一直加载到10个并发用户，然后当每个用户都运行完10次时就结束。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这样中间最大并发是10个，但不一定能达到10个，因为在加载最后几个时，前面的有可能已经运行结束，所以如果要真正达到最大并发10就必须设置集合点来完成</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　不过也不一定非要设置集合点才能实现同时处在running的状态有10个用户。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　设置duration也是可以的。不过那就不只每个用户运行10次了。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　如果想实现用户迭代10次，并且想同时running为10个用户，就应该设置集合点。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　迭代（Iterate）设计，或者我们称之为增量（Incremental）设计的思想和XP提倡的Evolutionary Design有异曲同工之妙。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　注意：1、 参数类型：在创建参数的时候，我选择了参数类型为File。参数类型共有9 种，现在来简单介绍一下所有的参数类型以及意义。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.1、 &nbsp; DateTime：在需要输入日期/时间的地方，可以用 DateTime 类型来替代。其属性设置也很简单，选择一种格式即可。当然也可以定制格式。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.2、 &nbsp; Group Name：很少用到。在实际运行中，LoadRunner 使用该虚拟用户所在的Vuser Group 来代替。但是在 VuGen 中运行时，Group Name将会是None。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.3、 &nbsp; Load Generator Name ：在实际运行中， LoadRunner &nbsp; 使用该虚拟用户所 在LoadGenerator &nbsp; 的机器名来代替。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.4、 &nbsp; Iteration Number ：在实际运行中，LoadRunner 使用该测试脚本当前循环的次数来代替。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.5、 &nbsp; Random Number：随机数。很简单。在属性设置中可以设置产生随机数的范围。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1.6、 &nbsp; Unique Number：唯一的数。在属性设置中可以设置第一个数以及递增的数的大小。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　注意：使用该参数类型必须注意可以接受的最大数。例如：某个文本框能接受的最大数为99。当使用该参数类型时，设置第一个数为 1，递增的数为1，但100个虚拟用户同时运行时，第100 个虚拟用户输入的将是 100，这样脚本运行将会出错。这里说的递增意思是各个用户取第一个值的递增数，每个用户相邻的两次循环之间的差值为 1。举例说明：假如起始数为 1，递增为 5，那么第一个用户第一次循环取值 1，第二次循环取值 2；第二个用户第一次循环取值为 6，第二次为 7；依次类推。<br /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　1.7、 &nbsp; Vuser ID：设置比较简单。在实际运行中，LoadRunner 使用该虚拟用户的 ID &nbsp; 来代替，该 ID &nbsp; 是由 Controller 来控制的。但是在 VuGen 中运行时，Vuser ID &nbsp; 将会是 &#8211;1。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　1.8、 &nbsp; File：需要在属性设置中编辑文件，添加内容，也可以从现成的数据库中取数据</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　1.9、 &nbsp; User Defined Function：从用户开发的 dll 文件提取数据。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　用HTTP协议录制了一个包含登录、浏览、退出过程的脚本，录制时都放到Action部分，这时脚本设置了迭代后可以多次重复运行，但是出于处理逻辑，一旦将登录脚本放到Init部分后，就无法正常进行迭代运行了。今天专门找个时间做了尝试，发现可能出现这两种错误。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　1、这是我犯的一个低级错误。在我将登录脚本移到Init部分时，将登录脚本之后的浏览操作前面的web_reg_find脚本也一起移了过去，结果运行完Init部分脚本就出错了。错误提示：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Error -27259: Pending web_reg_save_param/reg_find/create_html_param[_ex] request(s) detected and reset at the end of the Init section</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这种错误的现象是没有进行迭代已经出错了，错误提示也很明确。这时只要把web_reg_find放回Action部分的正确的位置即可。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　2、单次运行正确，但是多次迭代运行时出错，错误提示：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Error -27985: There is no context for HTML-based functions. A previous function may not have used "Mode=HTML" or downloaded only non-HTML page(s), or the context has been reset (e.g., due to a GUI-based function)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这种错误可能比较常见，原因是在Runtime Settings的Browse Emulation中设置了Simulate a new user on each iteration引起的。由于这个设置导致每次迭代时都会模拟一个新的用户，此时这个新的用户并没有执行init操作而失败了，也即是错误提示中的There is no context。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这里涉及到一个知识点就是在Rumtime Settings的迭代设置中，迭代运行次数只对Action部分有效，而Init部分和End部分还是只运行一次的。这时如果设置了&#8220;Simulate a new user on each iteration&#8221;，将出现上面的第2种错误。</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/414787.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-06-16 10:18 <a href="http://www.blogjava.net/qileilove/archive/2014/06/16/414787.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Loadrunner监控服务器资源</title><link>http://www.blogjava.net/qileilove/archive/2014/06/11/414617.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 11 Jun 2014 03:11:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/06/11/414617.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/414617.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/06/11/414617.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/414617.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/414617.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;"><a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>&nbsp;加载监听服务器的步骤如下：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1、在 LoadRunner Controller 下，将<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>面板切换到 Run状态，Available Graphs 栏 ，System Resources Graphs目录下选择&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Windows</strong></u></a>&nbsp;Resources，双击，在右侧4个监视栏中，选择 Windows Resources-Last 60 sec双击，放大模块，右键--&gt; Add Measurements ,在新弹出的窗口中，添加 Monitored Server Machines 。（Add Machine 时，Name 一般填机器ip），然后 ok</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2、添加完毕后，会看到监视栏中出现10个性能服务器的数据条。这时需要观察Scenario Status 的状态，如果没有 Errors 出现，那么过一会后，会看到 Windows Resources 栏出现走动的数据，表示监听成功；否则，出现了 Errors ，则说明监听不成功。点击 红色的 Errors ，查看失败的原因。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　下面是我遇到的两种错误情况：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　情况1：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; font-size: 12px; background-color: #dddddd;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Monitor name :Windows Resources. Cannot connect to machine 10.0.64.152</div><div style="word-break: break-all; margin: 10px 0px;">Reason: 拒绝访问。</div><div style="word-break: break-all; margin: 10px 0px;">Hints:</div><div style="word-break: break-all; margin: 10px 0px;">Check that your login user name appears as administrator on this machine.</div><div style="word-break: break-all; margin: 10px 0px;">Check that you have entered the correct machine name.</div><div style="word-break: break-all; margin: 10px 0px;">Check that the machine exists and that it is online (use the ping utility for this operation).</div><div style="word-break: break-all; margin: 10px 0px;">Delete the machine and add it again (entry point: CFactory::Initialize). [MsgId: MMSG-47299]</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">情况2：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Monitor name :Windows Resources. Cannot connect to machine 10.0.64.152</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Reason: 找不到网络路径。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　解决方法：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　情况1的解决方法，是在网上找的一些方法，尝试了较多，不知是哪一个或哪几个生效起作用了。（后面，会总结一个统一的解决方法）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　情况2的解决方法：启动目标服务器的 Remote Procedure Call (RPC) Locator 服务，连接成功</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">小结</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　LoadRunner 添加 Windows监听器需要进行的相关设置（下面都是对被监视服务器的操作）：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1、共享C盘；(一般情况下，C 盘是共享状态，无需处理)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2、保证如下服务开启：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　a、Remote Procedure Call (RPC)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　b、Remote Procedure Call (RPC) Locator</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　c、Remote Registry</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　d、Workstation</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3、本地安全设置--&gt;安装设置--&gt;本地策略--&gt;安全选项，&#8220;网络访问:本地账户的共享和安全模式&#8221;项选择&#8220;经典 - 本地用户以自己的身份验证&#8221;；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　4、用户需要在本地客户端访问服务器，操作方式，开始&#8594;运行&#8594;输入服务器IP地址；</div><img src ="http://www.blogjava.net/qileilove/aggbug/414617.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-06-11 11:11 <a href="http://www.blogjava.net/qileilove/archive/2014/06/11/414617.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner访问 Mysql数据库</title><link>http://www.blogjava.net/qileilove/archive/2014/05/14/413642.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 14 May 2014 02:11:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/05/14/413642.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/413642.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/05/14/413642.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/413642.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/413642.html</trackback:ping><description><![CDATA[<h1><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　这是很久以前编写的一个<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>案例，那时是为了检查大量往<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Mysql</strong></u></a>数据库里插入数据，看一下<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>的性能如何？服务器是否会很快就被写满了。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　前期的准备<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">工作</strong></u></a>：Mysql 数据库搭建，<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>，libmysql.dll and 网上搜一份LoadRunner访问mysq的公共库。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　Step1：Mysql数据库搭建（这里就不详细讲述如何安装Mysq数据库和创建表了）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　IP：192.168.1.100</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　访问名：root</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　密码是：123456</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　数据库名是：t3db</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　访问端口是：3306</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　数据库的相关信息就是这样了！</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　Step2：LoadRunner如何连接mysql呢？</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　以下全都是在网上找到原代码</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">int rc;</div><div style="word-break: break-all; margin: 10px 0px;">int db_connection;</div><div style="word-break: break-all; margin: 10px 0px;">char *server = "192.168.1.100"; &nbsp; // 数据库的ip地址</div><div style="word-break: break-all; margin: 10px 0px;">char *user = "root"; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 数据库访问用户名</div><div style="word-break: break-all; margin: 10px 0px;">char *password = "123456"; &nbsp; &nbsp; &nbsp; &nbsp;// 密码</div><div style="word-break: break-all; margin: 10px 0px;">char *database = "t3db"; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 数据库名称</div><div style="word-break: break-all; margin: 10px 0px;">int port = 3306; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 访问端口</div><div style="word-break: break-all; margin: 10px 0px;">int unix_socket = NULL;</div><div style="word-break: break-all; margin: 10px 0px;">int flags = 0;</div><div style="word-break: break-all; margin: 10px 0px;">char** result_row;</div><div style="word-break: break-all; margin: 10px 0px;">int query_result;</div><div style="word-break: break-all; margin: 10px 0px;">char szSql[256];</div><div style="word-break: break-all; margin: 10px 0px;">int MySqlInit()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">rc = lr_load_dll("libmysql.dll");</div><div style="word-break: break-all; margin: 10px 0px;">db_connection = mysql_init(NULL);</div><div style="word-break: break-all; margin: 10px 0px;">if (db_connection == NULL)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("Insufficient memory");</div><div style="word-break: break-all; margin: 10px 0px;">lr_abort();</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">if(rc!=0)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("Load MySql.dll Error!");</div><div style="word-break: break-all; margin: 10px 0px;">lr_abort();</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">rc = mysql_real_connect(db_connection,server, user, password, database, port, unix_socket, flags);</div><div style="word-break: break-all; margin: 10px 0px;">if(rc == NULL)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("connect mysql error! %s",mysql_error(db_connection));</div><div style="word-break: break-all; margin: 10px 0px;">mysql_close(db_connection);</div><div style="word-break: break-all; margin: 10px 0px;">lr_abort();</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">return rc;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">int MySqlUnit()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">// 释放MySQL资源</div><div style="word-break: break-all; margin: 10px 0px;">mysql_close(db_connection);</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">int InsertValue(char* query)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">rc = mysql_query(db_connection,query);</div><div style="word-break: break-all; margin: 10px 0px;">if (rc != 0)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("%s", mysql_error(db_connection));</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">query = NULL;</div><div style="word-break: break-all; margin: 10px 0px;">return rc;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">int MySqlQuery(char* szSql)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">rc = mysql_query(db_connection,szSql);</div><div style="word-break: break-all; margin: 10px 0px;">if(rc != 0)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("%s",lr_eval_string("?"));</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("%s", mysql_error(db_connection));</div><div style="word-break: break-all; margin: 10px 0px;">szSql = NULL;</div><div style="word-break: break-all; margin: 10px 0px;">return -1;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">query_result = mysql_use_result(db_connection);</div><div style="word-break: break-all; margin: 10px 0px;">if (query_result == NULL)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("%s", mysql_error(db_connection));</div><div style="word-break: break-all; margin: 10px 0px;">mysql_free_result(query_result);</div><div style="word-break: break-all; margin: 10px 0px;">szSql = NULL;</div><div style="word-break: break-all; margin: 10px 0px;">return -2;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">result_row = (char **)mysql_fetch_row(query_result);</div><div style="word-break: break-all; margin: 10px 0px;">if (result_row == NULL)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_error_message("Did not expect the result set to be empty");</div><div style="word-break: break-all; margin: 10px 0px;">mysql_free_result(query_result);</div><div style="word-break: break-all; margin: 10px 0px;">szSql = NULL;</div><div style="word-break: break-all; margin: 10px 0px;">return -3;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">mysql_free_result(query_result);</div><div style="word-break: break-all; margin: 10px 0px;">szSql = NULL;</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　这里提供了几个公共函数，看名字大家都明白他们是干啥的。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Step3：Loadrunner里需要怎么编写写呢？</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　1、添加libmysql.dll到你的工程</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　2、把公共库添加到你的公共</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　3、vuser_init</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">vuser_init()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">index = 0;</div><div style="word-break: break-all; margin: 10px 0px;">MySqlInit(); &nbsp;// 初始化数据库</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　4、vuser_end</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">vuser_end()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">MySqlUnit(); &nbsp;// 反初始化</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　5、Action</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Action()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">int resultValue;</div><div style="word-break: break-all; margin: 10px 0px;">char cIndex[10];</div><div style="word-break: break-all; margin: 10px 0px;">char onceAccount[1024];</div><div style="word-break: break-all; margin: 10px 0px;">char insertQuery[22584];</div><div style="word-break: break-all; margin: 10px 0px;">index = index +1;</div><div style="word-break: break-all; margin: 10px 0px;">// 组合插入数据库的sql语句</div><div style="word-break: break-all; margin: 10px 0px;">strcpy(insertQuery, "INSERT INTO `t3db`.`role`(GroupID, RoleName, Account, BaseInfo, ExtInfo, LastModify) VALUES('1', '");</div><div style="word-break: break-all; margin: 10px 0px;">strcat(insertQuery, lr_eval_string("{Account}"));</div><div style="word-break: break-all; margin: 10px 0px;">strcat(insertQuery, itoa(index, cIndex, 10 ));</div><div style="word-break: break-all; margin: 10px 0px;">strcat(insertQuery, "', 'q1031', '111', '111','2013-02-28 20:42:33')");</div><div style="word-break: break-all; margin: 10px 0px;">strcat(insertQuery, ";\0");</div><div style="word-break: break-all; margin: 10px 0px;">lr_start_transaction("Insert");</div><div style="word-break: break-all; margin: 10px 0px;">resultValue = InsertValue(insertQuery); &nbsp;// 调用插入函数</div><div style="word-break: break-all; margin: 10px 0px;">if(resultValue != 0)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction("Insert",LR_FAIL);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">else</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction("Insert",LR_PASS);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">sleep(100);</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div></div></h1><img src ="http://www.blogjava.net/qileilove/aggbug/413642.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-05-14 10:11 <a href="http://www.blogjava.net/qileilove/archive/2014/05/14/413642.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner监控tomcat的代码</title><link>http://www.blogjava.net/qileilove/archive/2014/05/13/413603.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 13 May 2014 08:24:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/05/13/413603.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/413603.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/05/13/413603.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/413603.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/413603.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　最近想对tomcat的性能指标做监控，于是 想到loadrunner关联函数的用法，于是做了本次尝试，没想到效果还不错，所以拿出来供大家分享，通过本次<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>发现，关联的作用太强大了~</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Action()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">double atof(const char *string);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("JVM_FreeMemory",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Free memory: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= MB",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("JVM_TotalMemory",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Total memory: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= MB",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("JVM_MaxMemory",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Max memory: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= MB",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_MaxThreads",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Max threads: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= ",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_CurrentThreadCount",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Current thread count: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= ",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_CurrentThreadBusy",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Current thread busy: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= ",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_MaxProcessingTime",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Max processing time: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= ms",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_ProcessingTime",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Processing time: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= s",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_RequestCount",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Request count: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= ",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_ErrorCount",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Error count: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= ",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_BytesReceived",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Bytes received: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= MB",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("http_BytesSent",</div><div style="word-break: break-all; margin: 10px 0px;">"LB=Bytes sent: ",</div><div style="word-break: break-all; margin: 10px 0px;">"RB= MB",</div><div style="word-break: break-all; margin: 10px 0px;">"Ord=1",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">web_set_user("tomcat", "123","10.40.15.8:8080");</div><div style="word-break: break-all; margin: 10px 0px;">lr_think_time(20);</div><div style="word-break: break-all; margin: 10px 0px;">web_url("status",</div><div style="word-break: break-all; margin: 10px 0px;">"URL=http://10.40.15.8:8080/manager/status",</div><div style="word-break: break-all; margin: 10px 0px;">"Resource=0",</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=text/html",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=",</div><div style="word-break: break-all; margin: 10px 0px;">"Snapshot=t1.inf",</div><div style="word-break: break-all; margin: 10px 0px;">"Mode=HTML",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat JVM FreeMemory", atof(lr_eval_string("{JVM_FreeMemory}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat JVM TotalMemory", atof(lr_eval_string("{JVM_TotalMemory}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat JVM MaxMemory", atof(lr_eval_string("{JVM_MaxMemory}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http MaxThreads", atof(lr_eval_string("{http_MaxThreads}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http CurrentThreadCount", atof(lr_eval_string("{http_CurrentThreadCount}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http CurrentThreadBusy", atof(lr_eval_string("{http_CurrentThreadBusy}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http MaxProcessingTime", atof(lr_eval_string("{http_MaxProcessingTime}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http ProcessingTime", atof(lr_eval_string("{http_ProcessingTime}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http RequestCount", atof(lr_eval_string("{http_RequestCount}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http ErrorCount", atof(lr_eval_string("{http_ErrorCount}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http BytesReceived", atof(lr_eval_string("{http_BytesReceived}")));</div><div style="word-break: break-all; margin: 10px 0px;">lr_user_data_point("Tomcat http BytesSent", atof(lr_eval_string("{http_BytesSent}")));</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div><img src ="http://www.blogjava.net/qileilove/aggbug/413603.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-05-13 16:24 <a href="http://www.blogjava.net/qileilove/archive/2014/05/13/413603.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>实现LoadRunner多个场景的顺序执行</title><link>http://www.blogjava.net/qileilove/archive/2014/04/28/412997.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 28 Apr 2014 02:31:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/28/412997.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412997.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/28/412997.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412997.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412997.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　应用场景 假设有3个不同的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>场景，分别为并发登录、核心业务、可靠性测试，3个场景有先后执行顺序。由于白天测试机器另有用处，只能在晚上进行<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">性能测试</strong></u></a>，这时我们的期望是能否把测试场景都设定好之后晚上自动运行，第二天我们回来看测试结果呢？ 答案是肯定的，可以有两种方式实现。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">第一种，相对简单</strong>充分利用LR Controller里面Group的功能。 新建一个场景把3个脚本都添加进来，在Edit Schedule中选择&#8220;Schedule by Group&#8221;的方式，在StartTime中设置3个脚本的运行顺序为&#8220;Start when Group xxx finished&#8221;，并在&#8220;Scenario Start Time&#8221;中设定场景在晚上的运行启动时间。设定完定时执行场景后，点击StartScenario按钮，会出现一个倒计时窗口，这样在固定的某个时间上，测试场景中的3个脚本将乖乖的按照设定的先后顺序进行测试。注意，如果没有点击StartScenario按钮激活测试，是不会真正进行测试的。（感谢Athenst朋友的提醒，^_^）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">第二种，比较灵活</strong>我们把应用场景稍微扩展一下，假设其中1、3场景只有一个测试脚本，而核心业务场景由数据录入、数据查询、数据上报3个脚本组成，同样的，3个场景仍需按顺序进行测试。这时如果采用第一种方式，由于第2个场景有3个脚本，所以第三个脚本的启动时间就是一个问题了。由于Controller中每个脚本都对应一个Group，而且GroupName不能重复，这时第三个场景的StartTime中&#8220;Start when group finished&#8221;则只能是选择第二个场景中的某个Group，而并非是第二个场景的3个脚本都完成之后再进行，无法达到我们的初衷。 这时，可以通过命令行的方式来进行。 首先创建并设置好3个测试场景，再创建一个一个批处理程序按先后顺序调用这3个场景进行测试，最后通过<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Windows</strong></u></a>的定时任务设定批处理的执行时间。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　批处理示例如下：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><span style="word-break: break-all; background-color: #ffffff;">　　cls SET M_ROOT="D:\Program Files\MI\Mercury LoadRunner\bin\" %M_ROOT%\wlrun.exe -TestPath "D:\Program Files\MI\Mercury LoadRunner\scenario\Test\TestScen_1.lrs" -Run %M_ROOT%\wlrun.exe -TestPath "D:\Program Files\MI\Mercury LoadRunner\scenario\Test\TestScen_2.lrs" -Run %M_ROOT%\wlrun.exe -TestPath "D:\Program Files\MI\Mercury LoadRunner\scenario\Test\TestScen_3.lrs" -Run</span></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　这种方式比较灵活，但需要注意在Result　Settings中设置&#8220;Automatically create a results directory for each scenario execution&#8221;，以免后面的测试结果覆盖了前面的。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　另外补充一下，如果想对某个脚本进行50、100、150...等用户数递增的测试，也可以用以上方法实现，但需要注意的是将事务名称区分开以便进行分析。</div><img src ="http://www.blogjava.net/qileilove/aggbug/412997.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-28 10:31 <a href="http://www.blogjava.net/qileilove/archive/2014/04/28/412997.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner参数化使用mysql数据源</title><link>http://www.blogjava.net/qileilove/archive/2014/04/24/412864.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 24 Apr 2014 02:26:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/24/412864.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412864.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/24/412864.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412864.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412864.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">使用<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">LoadRunner</strong></u></a>中的参数化，数据源来自mysql数据表。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　使用mysql数据源之前，要先安装mysql驱动。http://dev.mysql.com/downloads/connector/odbc/，这里以Connector/ODBC 5.2.6为例。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　安装过程中如果遇到类似于ANSI问题，要将Windows&gt;&gt;system32&gt;&gt;msvcr100_clr0400.dll复制，改名为msvcr100.dll</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　安装即可成功。可以在控制面板中，Administrative Tools &gt;&gt;Data Sources (ODBC)找到刚才安装的驱动。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=45468" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_201404192215021tYCe.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　然后在User DSN中点Add，选择刚添加的mysql驱动。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=45469" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_201404192215022cz6w.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　Data Source Name 和 Description中，随意填写。<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">server</strong></u></a>中填写服务器的ip，我用的本机的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">数据库</strong></u></a>，所以填写为127.0.0.1</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　User name 和Password就不用说了吧。Database是选择要使用的数据库，点<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">test</strong></u></a>来<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>一下。好了， 连接成功。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　回到LoadRunner中，在参数化窗口中点Data Wizard...按钮。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=45470" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_201404192215023b7OE.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=45471" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_201404192215024QUv0.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　　选中Specify SQL statement manually.</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=45472" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_201404192215025Qkzf.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　　在machine Data Source中选中数据源</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=45473" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/04/14982672_20140419221502681Qa.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　　点Create...按钮，在SQL语句中输入适当的语句。数据导入成功。</div></a></div><img src ="http://www.blogjava.net/qileilove/aggbug/412864.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-24 10:26 <a href="http://www.blogjava.net/qileilove/archive/2014/04/24/412864.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Loadrunner上传文件解决办法（大文件）</title><link>http://www.blogjava.net/qileilove/archive/2014/04/24/412863.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 24 Apr 2014 02:25:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/24/412863.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412863.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/24/412863.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412863.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412863.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">最近再做一个跟海量存储相关的项目<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>，需要通过LR模拟用户大量上传和下载文件，请求是Rest或Soap，同时还要模拟多种大小尺寸不一的文件</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　通常情况下，都是使用简单的post协议即可：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　方法一：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">web_submit_data("importStudent.do",</div><div style="word-break: break-all; margin: 10px 0px;">"Action=https://testserver/console/importStudent.do",</div><div style="word-break: break-all; margin: 10px 0px;">"Method=POST",</div><div style="word-break: break-all; margin: 10px 0px;">"EncType=multipart/form-data",</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=text/html",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=https://testserver/console/displayStudentList.do",</div><div style="word-break: break-all; margin: 10px 0px;">"Snapshot=t12.inf",</div><div style="word-break: break-all; margin: 10px 0px;">"Mode=HTTP",</div><div style="word-break: break-all; margin: 10px 0px;">ITEMDATA,</div><div style="word-break: break-all; margin: 10px 0px;">"Name=uploadFile", "Value=D://Excel//data161955.zip", "File=yes", ENDITEM,</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　后续对上传的文件进行MD5值比较，发现不一致，仔细查看后，发现上传的文件内容被loadrunner添加了几行额外的值，content-type等，无奈下，重写读文件的方式，我通过如下程序实现了1到10M文本文件的上传，如果上传二进制文件，body的写法有变化：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">方法二：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">vuser_init()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">char fileName[] = "D:/Script/CreateObj_10M/tools.zip";</div><div style="word-break: break-all; margin: 10px 0px;">int len = 0;</div><div style="word-break: break-all; margin: 10px 0px;">int readLen=0;</div><div style="word-break: break-all; margin: 10px 0px;">int tmpLen=1;</div><div style="word-break: break-all; margin: 10px 0px;">int &nbsp;runLen =104857;</div><div style="word-break: break-all; margin: 10px 0px;">int &nbsp;cLen = 0;</div><div style="word-break: break-all; margin: 10px 0px;">if ( (file_stream = fopen(fileName, "rb")) == NULL)</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_message("open file failed!\n");</div><div style="word-break: break-all; margin: 10px 0px;">return -1;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">fseek(file_stream, 0, 2);</div><div style="word-break: break-all; margin: 10px 0px;">len = ftell(file_stream);</div><div style="word-break: break-all; margin: 10px 0px;">lr_message("file length is: %d bytes", &nbsp;len);</div><div style="word-break: break-all; margin: 10px 0px;">readbuf = (char *) malloc(len+1);</div><div style="word-break: break-all; margin: 10px 0px;">memset(readbuf, 0, len+1);</div><div style="word-break: break-all; margin: 10px 0px;">if ( runLen &gt; len) {</div><div style="word-break: break-all; margin: 10px 0px;">runLen = len;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">fseek(file_stream, 0, 0);</div><div style="word-break: break-all; margin: 10px 0px;">while(feof(file_stream)== 0){</div><div style="word-break: break-all; margin: 10px 0px;">tmpLen = fread(readbuf + readLen, 1,runLen , file_stream);</div><div style="word-break: break-all; margin: 10px 0px;">readLen += tmpLen;</div><div style="word-break: break-all; margin: 10px 0px;">cLen = readLen + runLen;</div><div style="word-break: break-all; margin: 10px 0px;">if (cLen &gt; len) {</div><div style="word-break: break-all; margin: 10px 0px;">runLen = cLen - len;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">if (tmpLen==0) {</div><div style="word-break: break-all; margin: 10px 0px;">break;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table><br /><br /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">//关闭文件句柄</div><div style="word-break: break-all; margin: 10px 0px;">fclose(file_stream);</div><div style="word-break: break-all; margin: 10px 0px;">//保存参数</div><div style="word-break: break-all; margin: 10px 0px;">lr_save_string(readbuf,"bodys");</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">Action()</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_start_transaction("CreateObj_1M");</div><div style="word-break: break-all; margin: 10px 0px;">web_add_header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8..");</div><div style="word-break: break-all; margin: 10px 0px;">web_add_header("Content-Type", "text/plain; charset=UTF-8");</div><div style="word-break: break-all; margin: 10px 0px;">web_add_header("Authorization", "YWS {userkey}:XXXXXXX");</div><div style="word-break: break-all; margin: 10px 0px;">web_custom_request("CreateObj",</div><div style="word-break: break-all; margin: 10px 0px;">"URL=http://smartstorage{id}.yoyoyws.com:38080/test00bucket00/{IterationNum}-10M",</div><div style="word-break: break-all; margin: 10px 0px;">"Method=PUT",</div><div style="word-break: break-all; margin: 10px 0px;">"TargetFrame=",</div><div style="word-break: break-all; margin: 10px 0px;">"Resource=0",</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=application/xml",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=",</div><div style="word-break: break-all; margin: 10px 0px;">"Mode=HTML",</div><div style="word-break: break-all; margin: 10px 0px;">"Body={bodys}", &nbsp; &nbsp; &nbsp; //如果是二进制文件，可以改成BodyBinary</div><div style="word-break: break-all; margin: 10px 0px;">LAST );</div><div style="word-break: break-all; margin: 10px 0px;">returnCode = web_get_int_property(HTTP_INFO_RETURN_CODE);</div><div style="word-break: break-all; margin: 10px 0px;">if ( returnCode!=201 ) {</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction("CreateObj_1M",LR_FAIL);</div><div style="word-break: break-all; margin: 10px 0px;">}else{</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction("CreateObj_1M",LR_PASS);</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　但是这个程序依然有问题，当打开是二进制文件，或者文件内容过大的时候，依然会出现文件内容不一致的问题，我后续试验后，会持续更新。</div></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff; height: 21px; position: relative; width: 627.1875px;"></div><img src ="http://www.blogjava.net/qileilove/aggbug/412863.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-24 10:25 <a href="http://www.blogjava.net/qileilove/archive/2014/04/24/412863.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner中log的使用总结</title><link>http://www.blogjava.net/qileilove/archive/2014/04/22/412807.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 22 Apr 2014 10:31:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/22/412807.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412807.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/22/412807.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412807.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412807.html</trackback:ping><description><![CDATA[<h1><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;"><strong style="word-break: break-all; line-height: normal !important;">　1、log的设置方式。</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　在 runtime setting中可以设置log的生成方式：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　默认的log方式：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　Enable logging选中，log option是Send messages only when an error occurs.</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　可以修改日志的方式：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　Always send messages（这种方式会一直打印输出日志，不仅在错误时）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　standard log&#8212;&#8212;记录所有的请求反馈的日志，包括successful和fail的日志。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　Extended log&#8212;&#8212;可提供扩展的日志信息，包括</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　Parameter subsititution&#8212;&#8212;日志中打印所有中使用的参数值。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　Data returned by&nbsp;<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">server</strong></u></a>&#8212;&#8212;日志中打印每个客户端请求服务器返回的数据值</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　Advanced trace&#8212;&#8212;日志中打印所有的消息信息和函数执行信息</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">2、log的存储方式</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　log的存储路径在res文件夹下。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　如果是从脚本中直接关联create scenario则在脚本的目录下的res下。如果是直接create scenario然后再选择脚本的话，则存储在c盘，如&#8220;C:\Documents and Settings\USERNAME\Local Settings\Temp\res\log&#8221;</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　具体该场景的日志结果存哪，可以查看controll的result界面的result setting定义的目录。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　根据不同的log记录级别，在log文件中记录日志。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">3、log信息的分析</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　1）从log中得到虚拟用户失败的原因。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　通常如果场景在运行时出现用户失败，则先要查看错误原因，可直接查看日志，从日志中查看ERROR的信息；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　从outputdb中可以查看到错误代码ERROR CODE</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　2）从日志中确认每次分配给虚拟用户的参数值</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　想判断是否在场景中每个用户使用不同的或预定义规则的参数，可以通过在log生成规则处设定为parameter subsititution，然后查看每个日志文件中的对应行参数值是否为预计的参数值。可从此判断出是否同用户的实际使用类似，是否达到对服务器的压力策略。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　3）从日志中确认服务器端返回的值是什么。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　在脚本中通常设定了检查点，检查点策略是否生效，如果对此产生怀疑则可以考虑从日志中查看一下。查看服务器返回的值来验证是不是所期待得到的值。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　思考问题</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; font-weight: normal; background-color: #ffffff;">　　log的输出 会不会影响到客户端，会不会使客户端成为瓶颈？（认为是会的，任何程序都是要消耗资源的，loadrunner也一样，所以选取日志输出的模式是要谨慎考虑尽量以适用为前提）</div></h1><img src ="http://www.blogjava.net/qileilove/aggbug/412807.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-22 18:31 <a href="http://www.blogjava.net/qileilove/archive/2014/04/22/412807.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner下载文件脚本</title><link>http://www.blogjava.net/qileilove/archive/2014/04/17/412569.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 17 Apr 2014 02:38:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/17/412569.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412569.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/17/412569.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412569.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412569.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　在看普泽关于pezybase的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>报告的时候，发现里面有用到jmeter（http协议）并发测试下载文件，考虑到后面可能需要在公司pezybase的并发下载，把之前使用过的loadrunner下载文件脚本重新运行和整理一下。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　<strong style="word-break: break-all; line-height: normal !important;">　一、http协议</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　loadrunner使用http协议是无法录制到下载过程的，只会往服务器发送一个下载请求，其实服务器已经把数据返回给客户端了，但是loadrunner是录制不到保存文件到本地这个过程，所以就是需要我们手动把收到的内容保存打本地即可。（http协议上传文件的完整过程是可以直接录制的，在UC中已经使用过）。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">注意：</strong>下面脚本中用到的LR函数如下，还使用了一些C语言基本的文件操作方法。在脚本中还可以加入一些判断来进行事务是否成功以及文件大小是否正确等的判断；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　web_reg_save_param：关联函数，放在http请求前面，保存请求返回的内容；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　web_url：http请求函数，向指定的url发送请求，下载文件也就是直接往下载链接发送请求；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　web_get_int_property：获取下载请求返回的文件长度；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　web_set_max_html_param_len：设置web_set_max_html_param_len方法中参数的最大长度，要求大于需要下载文件的大小；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px;">Action() {</div><div style="word-break: break-all; margin: 10px 0px;">int flen;//定义一个整型变量保存获得文件的大小</div><div style="word-break: break-all; margin: 10px 0px;">long fileContent;//保存文件句柄,也就是文件的内容</div><div style="word-break: break-all; margin: 10px 0px;">char fileName[]="";//保存文件路径及文件名</div><div style="word-break: break-all; margin: 10px 0px;">char * strNumber;</div><div style="word-break: break-all; margin: 10px 0px;">strNumber=lr_eval_string("test{NewParam}");//获取一个随机数并转化成字符串 ，NewParam设置参数为随机类型，这里根据自己需要进行参数化设置</div><div style="word-break: break-all; margin: 10px 0px;">strcat(fileName,"C:/test/");//将路径保存到file变量中</div><div style="word-break: break-all; margin: 10px 0px;">strcat(fileName,strNumber); //拼接文件名</div><div style="word-break: break-all; margin: 10px 0px;">strcat(fileName,".pdf");//拼接后缀名，根据需要设置，最后就完成了完整的路径和文件名</div><div style="word-break: break-all; margin: 10px 0px;">web_set_max_html_param_len("20000");//设置参数的最大长度，注意该值必须大于文件的大小</div><div style="word-break: break-all; margin: 10px 0px;">//使用关联函数获取下载文件的内容，在这里不定义左右边界，获得服务器响应的所有内容</div><div style="word-break: break-all; margin: 10px 0px;">web_reg_save_param("fcontent", //返回的内容全部存储在fcontent这个参数中</div><div style="word-break: break-all; margin: 10px 0px;">"LB=",</div><div style="word-break: break-all; margin: 10px 0px;">"RB=",</div><div style="word-break: break-all; margin: 10px 0px;">"SEARCH=BODY",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">lr_start_transaction("下载文件"); &nbsp; #设置的事务开始点</div><div style="word-break: break-all; margin: 10px 0px;">#web_url方法你可以直接编写，也可以在启动录制的时候，输入下载链接URL进行简单录制，主要注意URL和Resource这两个参数即可；</div><div style="word-break: break-all; margin: 10px 0px;">web_url("file.php", &nbsp; &nbsp; &nbsp;#函数名，没有实际作用</div><div style="word-break: break-all; margin: 10px 0px;">"URL=http://forum.ubuntu.org.cn/download/file.php?id=129973&amp;sid=78fc8d76767ef49b606595824ceb963d", &nbsp; &nbsp;#下载链接，也就是该链接输入到浏览器会提示下载，获取方法很多；</div><div style="word-break: break-all; margin: 10px 0px;">"Resource=1", &nbsp; &nbsp;#1表示是下载资源，0表示是页面资源</div><div style="word-break: break-all; margin: 10px 0px;">"RecContentType=application/octetstream",</div><div style="word-break: break-all; margin: 10px 0px;">"Referer=",</div><div style="word-break: break-all; margin: 10px 0px;">"Snapshot=t1.inf",</div><div style="word-break: break-all; margin: 10px 0px;">LAST);</div><div style="word-break: break-all; margin: 10px 0px;">flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);//获取响应中的文件长度</div><div style="word-break: break-all; margin: 10px 0px;">if(flen &gt; 0)</div><div style="word-break: break-all; margin: 10px 0px;">{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //以写方式打开文件</div><div style="word-break: break-all; margin: 10px 0px;">fileContent = fopen(fileName, "wb")；</div><div style="word-break: break-all; margin: 10px 0px;">if(fileContent == NULL) &nbsp;#看是否正确打开了需要保存下载内容的文件，fileName是上面准备组织的文件路径；</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">lr_output_message("打开文件失败!");</div><div style="word-break: break-all; margin: 10px 0px;">return -1;</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">fwrite(lr_eval_string("{fcontent}"), flen, 1, fileContent);//写入文件内容</div><div style="word-break: break-all; margin: 10px 0px;">fclose(fileContent);//关闭文件</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">lr_end_transaction("下载文件",LR_AUTO);#事务结束点</div><div style="word-break: break-all; margin: 10px 0px;">return 0;</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px; line-height: normal !important;">　<strong style="word-break: break-all;">二、java user协议</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px; line-height: normal !important;">　　使用java user协议更简单，就是直接使用java编写一段从指定链接下载文件的脚本即可；</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px; line-height: normal !important;"><table align="center" style="word-break: break-all; border-style: solid; border-color: #999999; width: 612.7272338867188px; background-color: #dddddd; font-size: 12px;"><tbody style="word-break: break-all;"><tr style="word-break: break-all;"><td style="word-break: break-all;"><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">import java.io.BufferedInputStream;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">import java.io.FileOutputStream;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">import java.io.IOException;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">import java.net.MalformedURLException;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">import java.net.URL;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">import java.net.URLConnection;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">import lrapi.lr;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">public class Actions {</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">public int init() throws Throwable</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return 0;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}//end of init</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">public int action() throws Throwable</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">int DownLoadSize = 0;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">String path = "c:\\temp\\"; &nbsp;//设置下载文件保存路径</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">String vuid = String.valueOf(lr.get_vuser_id()); //获取当前虚拟用户ID并转换成字符串</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">DownLoadSize = UrlTools.getHttpFileByUrl("http://forum.ubuntu.org.cn/download/file.php?id=129973&amp;sid=78fc8d76767ef49b606595824ceb963d",vuid,path); //调用UrlTools.getHttpFileByUrl()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return 0;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}//end of action</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">public int end() throws Throwable</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return 0;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}//end of end }</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">class UrlTools</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">public static int getHttpFileByUrl(String address,String userid,String path)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">//定义下面需要用到的变量</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">URL url;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">URLConnection conn = null;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">int BUFF_SIZE = 1024;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">byte[] buf = new byte[BUFF_SIZE];</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">int DownLoadSize = 0;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">BufferedInputStream bis;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">FileOutputStream fos = null;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">int size = 0;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">try</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">url = new URL(address); //address为传递进来需要下载的链接</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">conn = &nbsp;url.openConnection();//使用url实例化需要下载的链接</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">bis = new BufferedInputStream(conn.getInputStream()); //把需要下载的文件内容保存在bis这个输入流中</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">fos = new FileOutputStream(path+"\"+userid+"test000001"+&#8220;.pdf&#8221;));//组成完整路径，并实例化到输出流，这里可以进行参数化，如参数化文件名， // 路径需要事先手动创建好，当然你也可以在脚本中创建实现不同的路径</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">System.out.println("需要下载的文件大小为:" + conn.getContentLength()/1024 + "k");</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">while((size = bis.read(buf)) != -1) &nbsp; #按照设置的buf大小写文件并记录下载的大小</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">fos.write(buf,0,size);</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">DownLoadSize = DownLoadSize+size;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">bis.close();</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">fos.close();</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">System.out.println("用户" + userid + "下载" + url +"完成!");</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}catch(MalformedURLException e)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">System.out.println("下载发生异常:");</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">e.printStackTrace();</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}catch(IOException e)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">{</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">System.out.println("下载发生异常:");</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">e.printStackTrace(); &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return DownLoadSize/1024;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">}</div></td></tr></tbody></table></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/412569.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-17 10:38 <a href="http://www.blogjava.net/qileilove/archive/2014/04/17/412569.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner 11简单使用</title><link>http://www.blogjava.net/qileilove/archive/2014/04/16/412505.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 16 Apr 2014 03:21:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/16/412505.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412505.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/16/412505.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412505.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412505.html</trackback:ping><description><![CDATA[<div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">开始菜单--》HP LoadRunner--&gt;applications---&gt;virtual user Generator</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1&gt;新建--》类别 (选择协议)：常用的<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">web</strong></u></a>项目用Web(HTTP/HTML),后台运行的服务，选择<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">java</strong></u></a>下的java vuser,编写java代码；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2&gt;对于web,需要设置访问的URL地址,录制到的操作：init &nbsp;action &nbsp;end,默认是action，</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.1确定后会弹出浏览器并打开刚设置的URL，而且弹出了录制工具条，此时已经进入了录制过程；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.2录制完一个操作（比如录制输入用户名、密码后的登录操作），可以在那个录制的工具条上新建一个新的；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.3如果要停止录制，先关闭浏览器，然后点击录制工具条上的停止按钮，此时脚本文件就有了代码；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.4修改脚本，比如录制的登录过程，可能需要登录多个用户，那就找到脚本里设置登录用户名（可以查刚才录制时登录的用户名）的地方，</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　选中该用户名，右键--》替换为参数--》设置参数名称--》点击属性按钮--&gt;创建表--》添加行--》输入被<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">测试</strong></u></a>系统已有的测试用户名；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　对话框下面的&#8220;更新值的时间&#8221;，有三个选择，请根据具体测试情景选择，然后&#8220;关闭&#8221;--》&#8220;确定&#8221;；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.5此时刚才的用户名会变成参数形式，如果有多个地方需要用这个参数替换，则找到这些地方选中，右键---》&#8220;使用现有参数&#8221;，找到要替换的参数；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.6点击工具栏的&#8220;运行&#8221;按钮，会弹出一个结果概要的窗口，显示脚本运行是否通过或者报错；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.7给脚本设置具体的场景：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　VUGen &nbsp;工具---》创建controller场景---》设置load Generator(<a target="_self" style="word-break: break-all; color: #202859; line-height: normal !important;"><u style="word-break: break-all;"><strong style="word-break: break-all;">loadrunner</strong></u></a>所在IP)弹出controller界面：最下方分出 &#8220;设计&#8221;和&#8220;运行&#8221;两种选项卡；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">运行前的配置操作在&#8220;设计&#8221;选项卡操作，常用的如下：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1》场景组里可以设置多个组，组里的Load Generator可以是当前loadrunner或另外一个loadrunner 客户端(可以只安装load Generator),相当于是负载，安装了controller的lr可以作为中心，配置它的客户端方式为：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　controller--&gt;场景--&gt;Load Generator--&gt;添加（别的loadrunner 客户端）--》连接；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2》场景计划面板，如果计划方式选择的是场景，那么下面的&#8220;全局计划&#8221;的设置是对所有组的，如果计划方式是组，那么下面是针对各组的设置计划；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3》&#8220;全局计划&#8221;面板，可以选中某一个，如&#8220;启动Vuser&#8221;双击,设置并发user数，是同时运行还是隔多长时间运行一次；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.8设置完后，点最下方的&#8220;运行&#8221;选项卡，点右上方的&#8220;开始场景&#8221;运行，运行结束后该按钮由置灰变可点；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.9右边的&#8220;场景状态&#8221;会显示运行情况，具体的分析报告可点菜单&#8220;工具&#8221;--》&#8220;analysis&#8221;弹出具体的分析面板，右边的概要报告会显示大概的指标；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3.0如果左边的会话浏览器里显示的图不够，可以点右键--》添加新项---&gt;添加新图；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3、如果新建后选择的类别是 java vuser</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3.1配置运行java脚本需要的java环境：Vuser-&gt;运行时设置--&gt;java环境设置--&gt;java VM 勾选&#8220;使用指定JDK&#8221;,并把jdk（lr11建议用32位的jdk）的bin上一层路径复制到JDK后，点确定；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3.2导入java环境的jar包：Vuser-&gt;运行时设置--&gt;java环境设置--&gt;Classpath,点添加jar的按钮，选择指定的jdk下的lib下的dt.jar和tools.jar导入；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3.3导入编写的java脚本需要依赖的jar:Vuser-&gt;运行时设置--&gt;java环境设置--&gt;Classpath,点添加jar的按钮，将编写脚本依赖的工程里的Jar包导入，点确定；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3.4此时可以编写java脚本，记住import类，和eclipse的写法一致就能找到类；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3.5运行脚本，看能否运行通过；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　<strong style="word-break: break-all; line-height: normal !important;">某些配置的具体操作方式:</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　1、VUGen &nbsp;工具--》录制选项--》HTTP属性 --》高级 &nbsp; &nbsp; （设置字符集）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2、脚本设置：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　2.1、VUGen &nbsp;工具--》录制选项--》常规--》录制 &nbsp; &nbsp;（默认web使用html）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　3、运行时的设置：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　VUGen &nbsp;VUSER--&gt;运行时设置--》运行逻辑 &nbsp;（设置运行的迭代次数）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　VUGen &nbsp;VUSER--&gt;运行时设置--》常规--》思考时间--》忽略思考时间 &nbsp;（将录制操作过程中的停顿忽略）</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　4、如果需要操作到达某个点时需要等待其他用户都到达这个点再同时向下执行，在整理代码时，可以在这个点上执行&#8220;插入--》集合&#8221;；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　5、当需要请求的用户来自不同IP时，需要设置Controller的&#8220;场景&#8221;--》&#8220;启用IP欺骗器&#8221;;</div><img src ="http://www.blogjava.net/qileilove/aggbug/412505.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/qileilove/" target="_blank">顺其自然EVO</a> 2014-04-16 11:21 <a href="http://www.blogjava.net/qileilove/archive/2014/04/16/412505.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>