﻿<?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-随笔分类-web 前端性能测试</title><link>http://www.blogjava.net/qileilove/category/51872.html</link><description>不想做屌丝的码农，不是好项目经理！屌丝生涯从此开始！</description><language>zh-cn</language><lastBuildDate>Mon, 08 Dec 2014 14:52:08 GMT</lastBuildDate><pubDate>Mon, 08 Dec 2014 14:52:08 GMT</pubDate><ttl>60</ttl><item><title>Extjs分页使用Java实现数据库数据查询</title><link>http://www.blogjava.net/qileilove/archive/2014/12/08/421194.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 08 Dec 2014 13:55:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/12/08/421194.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/421194.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/12/08/421194.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/421194.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/421194.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;">关于Ext分 页功能的实现。项目用的是js、Ext、servlet。下面贴下代码：</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;"><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;">var obj = this;</div><div style="word-break: break-all; margin: 10px 0px;">var pageSize = 20; &nbsp; //统计结果分页每一页显示数据条数</div><div style="word-break: break-all; margin: 10px 0px;">//在这里使用Store来创建一个类似于数据表的结构，因为需要远程获取数据，所以应该使用</div><div style="word-break: break-all; margin: 10px 0px;">//HttpProxy类，我是从后台读取的是json数据格式的数据，所以使用JsonReader来解析；</div><div style="word-break: break-all; margin: 10px 0px;">var proxy = new Ext.data.HttpProxy({</div><div style="word-break: break-all; margin: 10px 0px;">url:"com.test.check.servlets.QueryDetailServlet"</div><div style="word-break: break-all; margin: 10px 0px;">});</div><div style="word-break: break-all; margin: 10px 0px;">var statTime = Ext.data.Record.create([</div><div style="word-break: break-all; margin: 10px 0px;">{name:"rowNo",type:"string",mapping:"rowNo"},</div><div style="word-break: break-all; margin: 10px 0px;">{name:"gpsid",type:"string",mapping:"gpsid"},</div><div style="word-break: break-all; margin: 10px 0px;">{name:"policeName",type:"string",mapping:"policeName"}</div><div style="word-break: break-all; margin: 10px 0px;">]);</div><div style="word-break: break-all; margin: 10px 0px;">var reader = new Ext.data.JsonReader({</div><div style="word-break: break-all; margin: 10px 0px;">totalProperty:"count", //此处与后台json数据中相对应，为数据的总条数</div><div style="word-break: break-all; margin: 10px 0px;">root:"data" &nbsp; &nbsp; &nbsp;//这里是后台json数据相对应</div><div style="word-break: break-all; margin: 10px 0px;">},statTime);</div><div style="word-break: break-all; margin: 10px 0px;">var store = new Ext.data.Store({</div><div style="word-break: break-all; margin: 10px 0px;">proxy:proxy,</div><div style="word-break: break-all; margin: 10px 0px;">reader:reader</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;">var bbarObj = new Ext.PagingToolbar({</div><div style="word-break: break-all; margin: 10px 0px;">pageSize: pageSize,</div><div style="word-break: break-all; margin: 10px 0px;">store: store,</div><div style="word-break: break-all; margin: 10px 0px;">width: 300,</div><div style="word-break: break-all; margin: 10px 0px;">displayInfo: true, &nbsp; &nbsp; &nbsp;//该属性为需要显示分页信息是设置</div><div style="word-break: break-all; margin: 10px 0px;">//这里的数字会被分页时候的显示数据条数所自动替换显示</div><div style="word-break: break-all; margin: 10px 0px;">displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',</div><div style="word-break: break-all; margin: 10px 0px;">emptyMsg: "没有记录",</div><div style="word-break: break-all; margin: 10px 0px;">prependButtons: true</div><div style="word-break: break-all; margin: 10px 0px;">});</div><div style="word-break: break-all; margin: 10px 0px;">在我的项目中使用的是GridPanel来进行显示数据表，所以定义如下：</div><div style="word-break: break-all; margin: 10px 0px;">var grid = new Ext.grid.GridPanel({</div><div style="word-break: break-all; margin: 10px 0px;">store: store,</div><div style="word-break: break-all; margin: 10px 0px;">columns: [</div><div style="word-break: break-all; margin: 10px 0px;">{header:'序号',width: 33, sortable: true,dataIndex:'rowNo',align:'center'},</div><div style="word-break: break-all; margin: 10px 0px;">{id:'gpsid',header:'GPS编号',width: 85, sortable: true,dataIndex:'gpsid',align:'center'},</div><div style="word-break: break-all; margin: 10px 0px;">{header:'警员名称',width: 90, sortable: true,dataIndex:'policeName',align:'center'}</div><div style="word-break: break-all; margin: 10px 0px;">],</div><div style="word-break: break-all; margin: 10px 0px;">region:'center',</div><div style="word-break: break-all; margin: 10px 0px;">stripeRows: true,</div><div style="word-break: break-all; margin: 10px 0px;">title:'统计表',</div><div style="word-break: break-all; margin: 10px 0px;">autoHeight:true,</div><div style="word-break: break-all; margin: 10px 0px;">width:302,</div><div style="word-break: break-all; margin: 10px 0px;">autoScroll:true,</div><div style="word-break: break-all; margin: 10px 0px;">loadMask:true,</div><div style="word-break: break-all; margin: 10px 0px;">stateful: true,</div><div style="word-break: break-all; margin: 10px 0px;">stateId: 'grid',</div><div style="word-break: break-all; margin: 10px 0px;">columnLines:true,</div><div style="word-break: break-all; margin: 10px 0px;">bbar:bbarObj &nbsp; //将分页工具栏添加到GridPanel上</div><div style="word-break: break-all; margin: 10px 0px;">});</div><div style="word-break: break-all; margin: 10px 0px;">//在以下方法中向后台传送需要的参数，在后台servlet中可以使用</div><div style="word-break: break-all; margin: 10px 0px;">//request.getParameter("");方法来获取参数值；</div><div style="word-break: break-all; margin: 10px 0px;">store.on('beforeload',function(){</div><div style="word-break: break-all; margin: 10px 0px;">store.baseParams={</div><div style="word-break: break-all; margin: 10px 0px;">code: code,</div><div style="word-break: break-all; margin: 10px 0px;">timeType: timeType,</div><div style="word-break: break-all; margin: 10px 0px;">timeValue: timeValue</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;">//将数据载入，这里参数为分页参数，会根据分页时候自动传送后台</div><div style="word-break: break-all; margin: 10px 0px;">//也是使用request.getParameter("")获取</div><div style="word-break: break-all; margin: 10px 0px;">store.reload({</div><div style="word-break: break-all; margin: 10px 0px;">params:{</div><div style="word-break: break-all; margin: 10px 0px;">start:0,</div><div style="word-break: break-all; margin: 10px 0px;">limit:pageSize</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;">duty.leftPanel.add(grid); //将GridPanel添加到我项目中使用的左侧显示栏</div><div style="word-break: break-all; margin: 10px 0px;">duty.leftPanel.doLayout();</div><div style="word-break: break-all; margin: 10px 0px;">duty.leftPanel.expand(); &nbsp;//左侧显示栏滑出</div></td></tr></tbody></table><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　后台servlet获取前台传输的参数：</div><div style="word-break: break-all; line-height: 21.6000003814697px; 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;">response.setContentType("text/xml;charset=GBK");</div><div style="word-break: break-all; margin: 10px 0px;">String orgId = request.getParameter("code");</div><div style="word-break: break-all; margin: 10px 0px;">String rangeType = request.getParameter("timeType");</div><div style="word-break: break-all; margin: 10px 0px;">String rangeValue = request.getParameter("timeValue");</div><div style="word-break: break-all; margin: 10px 0px;">String start &nbsp;= request.getParameter("start");</div><div style="word-break: break-all; margin: 10px 0px;">String limit = request.getParameter("limit");</div><div style="word-break: break-all; margin: 10px 0px;">StatService ss = new StatService();</div><div style="word-break: break-all; margin: 10px 0px;">String json = ss.getStatByOrganization(orgId, rangeType, rangeValue, start, limit);</div><div style="word-break: break-all; margin: 10px 0px;">PrintWriter out = response.getWriter();</div><div style="word-break: break-all; margin: 10px 0px;">out.write(json);</div><div style="word-break: break-all; margin: 10px 0px;">out.flush();</div><div style="word-break: break-all; margin: 10px 0px;">out.close();</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　下面讲以下后台将从数据库查询的数据组织成前台需要的格式的json数据串</div><div style="word-break: break-all; line-height: 21.6000003814697px; 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;">StringBuffer json = new StringBuffer();</div><div style="word-break: break-all; margin: 10px 0px;">String jsonData = "";</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;">int startNum = new Integer(start).intValue();</div><div style="word-break: break-all; margin: 10px 0px;">int limitNum = new Integer(limit).intValue();</div><div style="word-break: break-all; margin: 10px 0px;">startNum = startNum + 1;</div><div style="word-break: break-all; margin: 10px 0px;">limitNum = startNum + limitNum;</div><div style="word-break: break-all; margin: 10px 0px;">......</div><div style="word-break: break-all; margin: 10px 0px;">rs = ps.executeQuery();</div><div style="word-break: break-all; margin: 10px 0px;">//这里的count即是前台创建的数据格式中的数据总数名称，与之对应，data同样</div><div style="word-break: break-all; margin: 10px 0px;">json.append("{count:" + count + ",data:[{");</div><div style="word-break: break-all; margin: 10px 0px;">int i = startNum - 1; &nbsp;//该变量用来设置数据显示序号</div><div style="word-break: break-all; margin: 10px 0px;">while(rs.next()){</div><div style="word-break: break-all; margin: 10px 0px;">i = i + 1;</div><div style="word-break: break-all; margin: 10px 0px;">//这里的rowNo与前台配置的数据字段名称想对应，下面同样</div><div style="word-break: break-all; margin: 10px 0px;">json.append("rowNo:'" + i + "',");</div><div style="word-break: break-all; margin: 10px 0px;">String gpsId = rs.getString("GPSID");</div><div style="word-break: break-all; margin: 10px 0px;">json.append("gpsid:'" + gpsId + "',");</div><div style="word-break: break-all; margin: 10px 0px;">String policeName = rs.getString("CALLNO");</div><div style="word-break: break-all; margin: 10px 0px;">json.append("policeName:'" + policeName + "',");</div><div style="word-break: break-all; margin: 10px 0px;">json.append("},{");</div><div style="word-break: break-all; margin: 10px 0px;">}</div><div style="word-break: break-all; margin: 10px 0px;">jsonData = json.substring(0, json.length()-2);</div><div style="word-break: break-all; margin: 10px 0px;">jsonData = jsonData + "]}";</div><div style="word-break: break-all; margin: 10px 0px;">//组成的json数据格式应该是：</div><div style="word-break: break-all; margin: 10px 0px;">//{count:count,data:[{rowNo:rowNo,gpsId:gpsId,policeName:policeName},....]}</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　就这样完成了前台的数据查询交互；</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px;">　　希望我的例子对各位有用。</div></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; background-color: #ffffff;"></div><div id="weixin_s" style="word-break: break-all; line-height: 21.6000003814697px; 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> <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/421194.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-08 21:55 <a href="http://www.blogjava.net/qileilove/archive/2014/12/08/421194.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Windows环境搭建Web自动化测试框架Watir</title><link>http://www.blogjava.net/qileilove/archive/2014/12/03/420986.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 03 Dec 2014 05:47:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/12/03/420986.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/420986.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/12/03/420986.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/420986.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/420986.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;">　　<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>一直是一个比较迫切的问题，对于现在web开发的<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>，故开此主题，一边研究，一边将Web自动化测试应用于<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>中，进而形成能够独立成章的博文，希望能够为国内web自动化测试的发展做一点绵薄的贡献吧，笑~</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;">　二、Watir搭建流程</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=49772" 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_2014120212510919dDh.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;">　　图1-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;">　　因为安装<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;">Ruby</strong></u></a>还需要用到其他的一些开发工具集，所以建议从网站下载，而且使用该安装包的话，它会帮你把环境变量也设置完毕，我使用的版本是：railsinstaller-2.2.4.exe，建议下载最新版本。</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=49773" 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_201412021251092jjvk.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;">　　图1-2 RailsInstaller工具包安装界面</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;">　　开始安装RailsInstaller工具包，安装到默认位置即可。</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=49774" 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_2014120212510935opw.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;">　　图1-3 安装完毕界面</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;">　　这个对勾建议打上，它会帮你配置git和ssh，安装过程中ruby等一系列环境变量也配置OK了，挺好~</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=49775" 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_201412021251094h0Y7.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;">　　图1-4 测试Ruby安装情况</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;">　　安装好railsinstaller-2.2.4.exe后，打开cmd命令行，输入命令：ruby &#8211;v，如果，出现图1-4所示ruby的版本情况，则说明ruby已经安装完毕，我们也可以输入命令测试一下gem的版本：gem &#8211;v，如图1-4所示，gem也是安装成功。</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=49776" 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_2014120212513013998.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;">　　图1-5 gem安装情况</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;">　　使用命令：gem list，查看一下，如图1-5，你会发现，railsinstaller安装完毕后，默认是不包含Watir自动化测试工具的，所以我们现在要开始安装watir。</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=49777" 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_201412021251302BwV9.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;">　　图1-6 gem命令</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;">　　先简单看一眼gem怎么用，如上图1-6所示，</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=49778" 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_201412021251303S7Iv.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;">　　图1-7 安装watir命令</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;">　　使用命令：gem install watir，进行安装watir，如果顺利的话，下面会出现很多的successfully等文字；不过在国内，你一般是看不到successfully等文字的，因为https://rubygems.org/已经被墙了，现在我们要对gem的源进行修改一下，来达到安装watir的目的。</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=49779" 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_2014120212513041PLe.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;">　　图1-8 RubyGems镜像网址<br /><div style="word-break: break-all; margin: 10px 0px;">首先使用命令：gem sources -l，查看一下gem的当前源，一般都是：https://rubygems.org/</div><div style="word-break: break-all; margin: 10px 0px;">　　然后我们使用命令：gem sources --remove https://rubygems.org/</div><div style="word-break: break-all; margin: 10px 0px;">　　接着输入命令：gem sources -a https://ruby.taobao.org/</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=49780" 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_2014120212513057SMg.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-9 查看gem的源</div><div style="word-break: break-all; margin: 10px 0px;">　　现在再看一下gem的源这是是否正确：gem sources -l，如果只有：https://ruby.taobao.org/，一个源，则说明配置正确。然后再使用命令安装Watir：gem install watir，这次应该就能够安装成功了。</div><div style="word-break: break-all; margin: 10px 0px;">　　<a href="http://www.51testing.com/batch.download.php?aid=49781" 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_2014120212520518zes.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-10 commonwatir和watir版本</div><div style="word-break: break-all; margin: 10px 0px;">　　我们可以再次使用命令：gem list，可以看到，list里面有好多与watir相关的内容，这里主要关心两个工具，如上图所示，commonwatir和watir，这里需要给commonwatir和watir降版本到3.0.0，如果不进行降级，会出现NameError错误，命令如下：</div><div style="word-break: break-all; margin: 10px 0px;">　<a href="http://www.51testing.com/batch.download.php?aid=49782" 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_201412021252052fdH8.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-11 watir降级到3.0.0</div><div style="word-break: break-all; margin: 10px 0px;">　　输入命令：gem uninstall watir -v 5.0.0</div><div style="word-break: break-all; margin: 10px 0px;">　　输入命令：gem install watir -v 3.0.0</div><div style="word-break: break-all; margin: 10px 0px;">　　<a href="http://www.51testing.com/batch.download.php?aid=49783" 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_201412021252053Bev7.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-12 commonwatir降级到3.0.0</div><div style="word-break: break-all; margin: 10px 0px;">　　输入命令：gem uninstall commonwatir -v 4.0.0</div><div style="word-break: break-all; margin: 10px 0px;">　　输入命令：gem install commonwatir -v 3.0.0</div><div style="word-break: break-all; margin: 10px 0px;">　　<a href="http://www.51testing.com/batch.download.php?aid=49784" 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_201412021252054gEXF.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-13 ruby测试代码</div><div style="word-break: break-all; margin: 10px 0px;">　　require "watir"</div><div style="word-break: break-all; margin: 10px 0px;">　　puts "Open IE..."</div><div style="word-break: break-all; margin: 10px 0px;">　　ie=Watir::IE.new</div><div style="word-break: break-all; margin: 10px 0px;">　　ie.goto(http://www.baidu.com/)</div><div style="word-break: break-all; margin: 10px 0px;">　　puts "IE is opened - enjoy it :)"</div><div style="word-break: break-all; margin: 10px 0px;">　　在文本编辑器中新建一个test.rb文件，输入以上代码，强烈建议手动输入，空格不慎也会导致运行失败。</div><div style="word-break: break-all; margin: 10px 0px;">　　<a href="http://www.51testing.com/batch.download.php?aid=49785" 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_201412021252055n3Nu.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-14 ruby文件编码</div><div style="word-break: break-all; margin: 10px 0px;">　　编码也要注意，使用UTF-8编码。</div><div style="word-break: break-all; margin: 10px 0px;">　　<a href="http://www.51testing.com/batch.download.php?aid=49786" 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_2014120212520568UBL.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-15 测试效果</div><div style="word-break: break-all; margin: 10px 0px;">　　将test.rb保存完毕后，在cmd命令行输入命令：ruby test.rb如果ruby代码没有报错，程序就会自动打开IE浏览器，自动输入http://www.baidu.com/，打开百度页面。至此，《Windows环境搭建Web自动化测试框架Watir（基于Ruby）第1章》编写完毕。</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;">　　我们通过一系列的配置，将ruby和watir部署到windows平台上，下一步，我们就可以编写各种各样的测试脚本，针对不同的web应用，进行不同的测试。</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/420986.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:47 <a href="http://www.blogjava.net/qileilove/archive/2014/12/03/420986.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>几个前端Bug的解决方案</title><link>http://www.blogjava.net/qileilove/archive/2014/11/28/420805.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 28 Nov 2014 02:23:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/11/28/420805.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/420805.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/11/28/420805.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/420805.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/420805.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;">jQueryUI下被拖动的元素上飘</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.10.x的draggable，在滚动栏下移（即非处于页面顶部）的时候拖动draggable的元素，它会向上跳一段距离。解决办法是将jQueryUI1.10.x的_convertPositionTo()和_generatePosition()换为1.9.2的或者设置父元素的position为absolute以外的值。（应该是父元素为absolute时计算offset又逗比了&#8230;&#8230;）</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;">　　参考：JqueryUI1.10.xDialogdragissueonlargebodyheight</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;">　　追记：闲着自己实现了一个可拖拽效果，放在了Gist里，jQueryUI的这个bug应该是在计算拖拽时位置的时候用了clientX和clientY而不是pageX和pageY，导致计算出来的offset过小引起的</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;">IE里文本框点击后光标向上飘</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;">　　如果想要居中，兼容IE的话一般是height和line-height设为同一个值。此时需要保证：</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;">　　input使用content-box</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;">　　height和line-height都要设，不能只设line-height</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;">　　应该是IE在border-box下计算linebox大小的时候有延迟所以出现了向上飘&#8230;&#8230;其他浏览器没有这个现象。</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;">　　引起这个bug是因为项目的css拿了bootstrap3做base，而bootstrap3给所有元素都设了box-sizing:border-box。</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;">　　参考：WhydidBootstrap3switchtobox-sizing:border-box?</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;">　　追记：IE9里使用搜狗输入法时按空格文字会下沉&#8230;&#8230;找来找去发现是浏览器+输入法交互产生的问题也是醉了，前端根本不可控囧解决方法只有：提醒用户要么换掉IE9，要么换输入法hhhh</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;">无法用checked选中radiobutton</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;">　　检查有没有套上form。在某些浏览器下似乎没有套上from的input添加checked是没有样式的=。=</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;">chrome下p里套div造成解析错误</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;">　　后端的人传来的HTML我一看也是醉了&#8230;&#8230;参考MDN的文档，&lt;p&gt;的合法内容为phrasingcontent，其中不包括div</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;">　　&lt;p&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;">　　&lt;div&gt;&lt;/div&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;">　　&lt;/p&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;">　　在chrome里解析完之后就成了</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;">　　&lt;p&gt;&lt;/p&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;">　　&lt;div&gt;&lt;/div&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;">　　&lt;p&gt;&lt;/p&gt;</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/420805.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:23 <a href="http://www.blogjava.net/qileilove/archive/2014/11/28/420805.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>LoadRunner监控数据库服务器</title><link>http://www.blogjava.net/qileilove/archive/2014/10/14/418694.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 14 Oct 2014 01:30:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/10/14/418694.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418694.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/10/14/418694.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418694.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418694.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;">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>服务器资源监控器，可以在场景或会话步骤运行期间监控DB2、<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;">Oracle</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;">SQL</strong></u></a>&nbsp;Server或Sybase数据库的资源使用率。在场景或会话步骤运行期间，使用这些监控器可以隔离数据库服务器性能瓶颈。对于每个数据库服务器，在运行场景或会话步骤之前需要配置要监控的度量。要运行DB2,Oracle和Sybase监控器，还必须在要监控的数据库服务器上安装客户端。</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;.SQL Server数据库服务器的监控</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;">　　类似windows资源监控</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;.Oracle数据库服务器的监控</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.确保Oracle客户端已安装在Controller或优化控制台计算机上。</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.验证路径环境变量中是否包括%OracleHome%\bin.如果不包括，请将其添加到路径环境中。</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.在Controller或优化控制台计算机上配置tnsnames.ora文件。</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.向数据库管理员索要该服务器的用户名和密码，并确保Controller或优化控制台对Oracle表具有数据库管理员权限</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.通过在Controller或者优化控制台计算机上执行tns ping,验证与Oracle服务器的连接</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;">　　f.要确保注册表已经依照正在使用的Oracle版本进行了更新并且具有以下注册表项 /HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE</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;">　　g.验证要监控的Oracle服务器是否已经启动并正在运行</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;">　　监控项包括：缓存命中、索引、单条SQL性能、数据库线程数、数据池连接数</div><img src ="http://www.blogjava.net/qileilove/aggbug/418694.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-10-14 09:30 <a href="http://www.blogjava.net/qileilove/archive/2014/10/14/418694.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何测试一个网页登陆界面</title><link>http://www.blogjava.net/qileilove/archive/2014/09/30/418411.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 30 Sep 2014 01:49:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/30/418411.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418411.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/30/418411.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418411.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418411.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;">　具体需求： 有一个登陆页面， （假如上面有2个textbox, 一个提交按钮。 请针对这个页面设计30个以上的<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>&nbsp;case.）</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;<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;">Web测试</strong></u></a>经验， 是否了解Web开发，以及设计Test case的能力</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;">　　首先，你要了解用户的需求，比如这个登录界面应该是弹出窗口式的，还是直接在网页里面。对用户名的长度，和密码的强度（就是是不是必须多少位，大小写，特殊字符混搭）等。还有比如用户对界面的美观是不是有特殊的要求？（即是否要进行UI测试）。剩下的就是设计用例了 ，等价类，边界值等等。</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;"><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>(Function test)</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;">　　0. 什么都不输入，点击提交按钮，看提示信息。</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.输入正确的用户名和密码，点击提交按钮，验证是否能正确登录。</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.用户名和密码，如果太短或者太长，应该怎么处理</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 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.记住用户名的功能</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.登陆失败后，不能记录密码的功能</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;">　　8.用户名和密码前后有空格的处理</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;">　　9.密码是否加密显示（星号圆点等）</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;">　　10.牵扯到验证码的，还要考虑文字是否扭曲过度导致辨认难度大，考虑颜色（色盲使用者），刷新或换一个按钮是否好用</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.登录页面中的注册、忘记密码，登出用另一帐号登陆等链接是否正确</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;">　　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;">　　<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>(UI Test)</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.布局是否合理，2个testbox 和一个按钮是否对齐</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.testbox和按钮的长度，高度是否复合要求</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. 界面的设计风格是否与UI的设计风格统一</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;">　　<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>(performance test)</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.打开登录页面，需要几秒</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.输入正确的用户名和密码后，登录成功跳转到新页面，不超过5秒</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;">　安全性测试(Security test)</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.登录成功后生成的Cookie，是否是httponly (否则容易被脚本盗取)</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.用户名和密码是否通过加密的方式，发送给Web服务器</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.用户名和密码的验证，应该是用服务器端验证， 而不能单单是在客户端用javascript验证</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;">SQL</strong></u></a>&nbsp;注入攻击</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.用户名和密码的的输入框，应该禁止输入脚本 （防止XSS攻击）</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.错误登陆的次数限制（防止暴力破解）</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. 考虑是否支持多用户在同一机器上登录；</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;">　　8. 考虑一用户在多台机器上登录</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;">可用性测试(Usability Test)</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. 是否可以全用键盘操作，是否有快捷键</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. 输入框能否可以以Tab键切换</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;">兼容性测试（Compatibility Test）</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.主流的浏览器下能否显示正常已经功能正常（IE,6,7,8,9, Firefox, Chrome, Safari,等）</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.不同的平台是否能正常<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;">Windows</strong></u></a>, Mac</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.移动设备上是否正常工作，比如Iphone, Andriod</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;"><strong style="word-break: break-all; line-height: normal !important;">　　本地化测试 （Localization test）</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. 不同语言环境下，页面的显示是否正确。</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;">　　软件辅助性测试 （Accessibility test）</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;">　　1. 高对比度下能否显示正常 （视力不好的人使用）</div><img src ="http://www.blogjava.net/qileilove/aggbug/418411.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-30 09:49 <a href="http://www.blogjava.net/qileilove/archive/2014/09/30/418411.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>nginx缓存区内存配置大小对性能测试的影响</title><link>http://www.blogjava.net/qileilove/archive/2014/09/30/418410.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 30 Sep 2014 01:48:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/30/418410.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418410.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/30/418410.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418410.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418410.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;">现象：</strong>Nginx与应用都在同一台服务器（4g内存、4核cpu）上，nginx缓存区内存配置1g，开启nginx的accesslog，跑图片终端页性能脚本，观察到accesslog里面有90%以上的MISS状态的，nginx缓存没有起到作用，加大nginx缓存内存为2g，清了缓存再次跑性能脚本，accesslog中的MISS状态仍占大部分，且应用服务器的内存空间基本被用完。</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>将nginx与应用分开，nginx放在一台服务器上，应用包搬到另一服务器（6g内存、8核cpu）上，跑图片终端页脚本，nginx缓存区内存配置2g，观察到响应提上去了，accesslog里HIT状态的占90%或更多。说明nginx缓存区有起到作用。</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>nginx的缓存区设置1G时不够用，没起到作用。当调整到2G时，由于服务器上还存放应用也占了内存，另外系统也需要资源，导致nginx所配置的2G内存没起作用。当把nginx和应用分开时，资源都充足了，这时nginx的缓存区也能起到作用。</div><img src ="http://www.blogjava.net/qileilove/aggbug/418410.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-30 09:48 <a href="http://www.blogjava.net/qileilove/archive/2014/09/30/418410.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用Qunit对js代码进行单元测试</title><link>http://www.blogjava.net/qileilove/archive/2014/09/28/418342.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Sun, 28 Sep 2014 01:19:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/28/418342.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418342.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/28/418342.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418342.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418342.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;">　1、创建qunit.html 文件添加由官方提供的cdn 加载<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;"><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;">&lt;!DOCTYPE html&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;html&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;meta charset="utf-8"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;title&gt;QUnit Example&lt;/title&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.15.0.css"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/head&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;div id="qunit"&gt;&lt;/div&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;div id="qunit-fixture"&gt;&lt;/div&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;script src="//code.jquery.com/qunit/qunit-1.15.0.js"&gt;&lt;/script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;script src="project.js"&gt;&lt;/script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;script src="tests.js"&gt;&lt;/script&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/body&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/html&gt;</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;">　　最后面引入的 project.js 就是待测试的文件</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;">　　最后面引入的 tests.js 就是<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;">　　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;">　　先写一个待测试例子，这是一个判断是否是偶数的方法</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;">//project.js</div><div style="word-break: break-all; margin: 10px 0px;">function isEven(val) {</div><div style="word-break: break-all; margin: 10px 0px;">return val % 2 === 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;">　　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;"><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;">//tests.js&lt;br&gt;test('isEven()', function() {</div><div style="word-break: break-all; margin: 10px 0px;">ok(isEven(0), 'Zero is an even number');</div><div style="word-break: break-all; margin: 10px 0px;">ok(isEven(2), 'So is two');</div><div style="word-break: break-all; margin: 10px 0px;">ok(isEven(-4), 'So is negative four');</div><div style="word-break: break-all; margin: 10px 0px;">ok(!isEven(1), 'One is not an even number');</div><div style="word-break: break-all; margin: 10px 0px;">ok(!isEven(-7), 'Neither is negative seven');</div><div style="word-break: break-all; margin: 10px 0px;">})</div></td></tr></tbody></table></div><img src ="http://www.blogjava.net/qileilove/aggbug/418342.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-28 09:19 <a href="http://www.blogjava.net/qileilove/archive/2014/09/28/418342.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试URL自动转码</title><link>http://www.blogjava.net/qileilove/archive/2014/09/18/418039.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 18 Sep 2014 01:23:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/09/18/418039.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/418039.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/09/18/418039.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/418039.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/418039.html</trackback:ping><description><![CDATA[<div><div id="SL_button" style="background-image: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/imtranslator-s.png); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></div><table cellspacing="1" border="0" id="SL_tables"><tbody><tr><td align="left" width="20%"><div id="SL_lng_from">English&nbsp;&#187;</div></td><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 width="13%" align="center">&nbsp;</td><td width="8%" align="center"><div id="SL_TTS_voice" title="Listen to the translation" style="background-image: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/tts-voice.png); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></div></td><td width="8%" align="center"><div id="SL_copy" title="Select text" style="background-image: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/copy_hand.png); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></div></td><td width="8%" align="center"><div id="SL_bbl_font" title="Font size" style="background-image: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/font-off.png); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></div></td><td width="8%" align="center"><div id="SL_TH" title="Translation history" style="background-image: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/history.png); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></div></td><td width="5%"></td><td width="8%" align="right"><div id="SL_pin" title="Pin pup-up bubble" style="background-image: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/pin-off.png); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></div></td></tr></tbody></table></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-image: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/donate2.png); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></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" title="Show options">Options</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/history.html" title="Translation history" target="_blank">History</a>&nbsp;:&nbsp;<a href="http://about.imtranslator.net/add-ons/chrome-extension/" target="_blank" title="ImTranslator Help">Help</a>&nbsp;:&nbsp;<a href="chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/feedback.html" title="Feedback" target="_blank">Feedback</a></div><div id="SL_player"></div><div id="SL_alert100" style="background-image: url(chrome-extension://noaijdpnepcgjemiklgfkcfbkokogabh/img/util/bg2.png); background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"></div><div style="word-break: break-all; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal !important; background-color: #ffffff;">最近做<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>，写了个python程序自动将URL里面的&#8216;%2B&#8217;，&#8216;20%&#8217;，&#8216;3B'等转换成正常字符，方便查看。</div><div style="word-break: break-all; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal !important; 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; background-color: #ffffff;">import os,sys;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">path = sys.path[0]</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">os.chdir(path)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">encode_list = 'encode_list.txt'</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">result = path + '\\results'</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">def get_encode():</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">encode_file = open(path + '\\'+ encode_list)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">encode = dict()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">for line in encode_file:</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">if line!='\n' and len(line) &gt;1:</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">if line.find('read me') &lt;0:</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">encode[line[1:].strip()] = line[0]</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return encode</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">def get_files():</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">files = os.listdir(path)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">file_list = list()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">for file in files:</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">if file.endswith('.txt') and file!= encode_list:</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">file_list.append(file)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return file_list</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">def relace_url_encode(strPri,dicEncode):</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">items = dicEncode.items()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">for (key,value) in items:</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">if strPri.find(key):</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">strPri = strPri.replace(key,value)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">return strPri</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">def create_result():</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">if not os.path.isdir(result):</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">os.makedirs(result)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">def write_result(filePri,strText):</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">fp = open(result+'\\'+filePri,'w+')</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">fp.write(strText)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">fp.close()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">create_result()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">encode = get_encode()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">file_list = get_files()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">for ff in file_list:</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;">f = open(ff)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">text = f.read()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">finally:</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">f.close()</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">temp = relace_url_encode(text,encode)</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">temp = temp.replace('&amp;','\n')</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">write_result(ff,temp)</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal !important; background-color: #ffffff;">　　下面是文件夹结构：</div><div style="word-break: break-all; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: normal !important; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=48411" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none;"><img src="http://www.51testing.com/attachments/2014/09/14982672_201409171102271w2HJ.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;">encode.py的代码贴在上面</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　encode_list.txt里面装的是转换对照表，其中文件名是hard code在python程序里面的，最好不要改</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　前面的是正常字符，后面的是需要转换的字符</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=48412" 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_201409171102272WwgY.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;">　　需要转码的URL形如下面的形式：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">selectForm=selectForm&amp;publishId=iphone6SapptR&amp;color=%7B%22colorDisplayText%22%3A%22Grey%22%2C%22colorId%22%3A%22Grey%22%2C%22publishId%22%3A%22iphone6SapptM%22%2C%22modelCode%22%3A%22iphone6SmodelM%22%2C%22available%22%3Atrue%7D&amp;rom=%7B%22capacityDisplayText%22%3A%2216GB%22%2C%22capacityId%22%3A%2216GB%22%2C%22imageFileName%22%3A%22iPhoneX-gold.png%22%2C%22publishId%22%3A%22iphone6SapptM%22%2C%22modelCode%22%3A%22iphone6SmodelM%22%2C%22available%22%3Atrue%7D&amp;locationId=%7B%22locationId%22%3A%22Marina_Bay_Sands_Exhibition_Hall_A%22%2C%22locationDisplayText%22%3A%22Marina%20Bay%20Sands%20Exhibition%20Hall%20A%22%2C%22publishId%22%3A%22iphone6SapptM%22%2C%22available%22%3Atrue%7D&amp;dateId=&amp;timeId=&amp;javax.faces.ViewState=H4sIAAAAAAAAAE1QO0sDQRAeL7n4RGIEK9PZWLhgJ1hoQIOH8YGgCBa6uVuTC3e76z5ydxaBNFrYWGhhIVpY5k%2BIhZ2gpZXYW9u6F0LiBzvMst9jZjs%2FYHMpYKqBmxhp5QdoA8v6Fub28Ofzy8zJewasMowFDHtl7ComHBhVdUFknQVezFdWIcVENGJq3hxLwazLQiQ1RafYJRKtJRSHvltylc%2BoNFnTg6ySEDip%2BFLF7Y%2Fi3Su%2Bz8CQA1npn5OYp8ZRNq2xArtx7HuL2qiPKl19gGkN7VQ</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">bxFXL12%2BHD3k5H1iGmsosfQYtyJnO5gb9W6YlYCFVx73ZzKScUUIV2ncOfBLtMabmdgXjRKhkkyQSeigYZwGTg%2BR1qsP%2Fj1xBLsBSOV7%2FN7s8hypSI6Lw%2Ffj0275cstL97CYONDF%2B%2BQFvW4dVIi46t8Xxm6%2Br%2FiKcx3%2FTRn8XowEAAA%3D%3D&amp;javax.faces.source=color%3A1&amp;javax.faces.partial.event=change&amp;javax.faces.partial.execute=color%20color%3A1&amp;javax.faces.partial.render=productImage%20rom%20timeId%20dateId%20locationId&amp;javax.faces.behavior.event=change&amp;javax.faces.partial.ajax=true</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　我把转码过的结果全部放在result文件夹里面，双击运行，所有的txt文件都会被转码。并且该文件夹随便放在哪里，代码均可以执行。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　转码过后：</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">selectForm=selectForm</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">publishId=iphone6SapptR</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">color={"colorDisplayText":"Grey","colorId":"Grey","publishId":"iphone6SapptM","modelCode":"iphone6SmodelM","available":true}</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">rom={"capacityDisplayText":"16GB","capacityId":"16GB","imageFileName":"iPhoneX-gold.png","publishId":"iphone6SapptM","modelCode":"iphone6SmodelM","available":true}</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">locationId={"locationId":"Marina_Bay_Sands_Exhibition_Hall_A","locationDisplayText":"Marina_Bay_Sands_Exhibition_Hall_A","publishId":"iphone6SapptM","available":true}</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">dateId=</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">timeId=</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">javax.faces.ViewState=H4sIAAAAAAAAAE1QO0sDQRAeL7n4RGIEK9PZWLhgJ1hoQIOH8YGgCBa6uVuTC3e76z5ydxaBNFrYWGhhIVpY5k+IhZ2gpZXYW9u6F0LiBzvMst9jZjs/YHMpYKqBmxhp5QdoA8v6Fub28Ofzy8zJewasMowFDHtl7ComHBhVdUFknQVezFdWIcVENGJq3hxLwazLQiQ1RafYJRKtJRSHvltylc+oNFnTg6ySEDip+FLF7Y/i3Su+z8CQA1npn5OYp8ZRNq2xArtx7HuL2qiPKl19gGkN7VQ</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">bxFXL12+HD3k5H1iGmsosfQYtyJnO5gb9W6YlYCFVx73ZzKScUUIV2ncOfBLtMabmdgXjRKhkkyQSeigYZwGTg+R1qsP/j1xBLsBSOV7/N7s8hypSI6Lw/fj0275cstL97CYONDF++QFvW4dVIi46t8Xxm6+r/iKcx3/TRn8XowEAAA==</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">javax.faces.source=color:1</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">javax.faces.partial.event=change</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">javax.faces.partial.execute=color_color:1</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">javax.faces.partial.render=productImage_rom_timeId_dateId_locationId</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">javax.faces.behavior.event=change</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">javax.faces.partial.ajax=true</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　转换后就可以更方便的查找对比，方便测试进行。</div><div style="word-break: break-all; line-height: 21.6000003814697px; margin: 10px 0px; color: #333333;">　　应该还有需要改进的地方，如果测试需要，再做改进。</div></a></div><img src ="http://www.blogjava.net/qileilove/aggbug/418039.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:23 <a href="http://www.blogjava.net/qileilove/archive/2014/09/18/418039.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>原生AJAX基础讲解及兼容处理</title><link>http://www.blogjava.net/qileilove/archive/2014/08/26/417326.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 26 Aug 2014 01:35:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/26/417326.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417326.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/26/417326.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417326.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417326.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;">　AJAX = Asynchronous JavaScript and XML (异步的JavaScript和XML)。</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;">　　AJAX不是新技术 ，但却是热门的技术。它可以在不重载（刷新）整个页面的情况下与服务器进行数据交互并更新网页模块。</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;">　　AJAX的优点有很多：可以局部刷新、按需加载，这样就减轻了服务器的数据流量。并且在页面更新的同时，用户可以浏览器网页的其它内容而不受影响，也减轻了结构负担。AJAX也不是万能的，在有以上优点的同时SEO也受到了影响。</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;">　　在学习AJAX之前，必须先有HTML/XHTML、CSS、JavaScript/DOM的基础。</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;">　　AJAX与服务器进行数据交互，必然涉及到服务器端，与此同时也就涉及到了服务器请求对象的创建(new XMLHttpRequest())、确认请求方式(open())、发送请求(send())以及响应请求(responseText)。</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;">　　IE9+及其它浏览器支持使用new XMLHttpRequest()的创建对象方式，而IE8及以下则使用new ActiveXObject()的方式进行创建。</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;">1 try {</div><div style="word-break: break-all; margin: 10px 0px;">2 &nbsp; &nbsp; xml = new ActiveXObject("Msxml2.XMLHTTP");</div><div style="word-break: break-all; margin: 10px 0px;">3 } catch(e) {</div><div style="word-break: break-all; margin: 10px 0px;">4 &nbsp; &nbsp; try {</div><div style="word-break: break-all; margin: 10px 0px;">5 &nbsp; &nbsp; &nbsp; &nbsp; xml = new ActiveXObject("Microsoft.XMLHTTP");</div><div style="word-break: break-all; margin: 10px 0px;">6 &nbsp; &nbsp; } catch(e1) {</div><div style="word-break: break-all; margin: 10px 0px;">7 &nbsp; &nbsp; &nbsp; &nbsp; xml = new XMLHttpRequest();</div><div style="word-break: break-all; margin: 10px 0px;">8 &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">9 }</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;">　　笔者用IE11调试功能测试IE10及以下不写new ActiveXObject("Msxml2.XMLHTTP")也是没问题的，于是在创建对象时可以使用代码：</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;">　　var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();</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;">　　xml.open('get', 'url', true/false);</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;">　　第一个参数表示：string. 访问方式，有两具值：get/post，大部分的时候使用get</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;">　　第二个参数表示：string. 要连接的服务器网址</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;">　　第三个参数表示：boolean. 表示是否需要异步请求（true为发起异步加载）</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;">　　xml.send();</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;">　　如果需要发送数据则采用xml.send(str);</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;">　　xml.onreadystatechange = function() {</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;">　　if (xml.readyState == 4 &amp;&amp; xml.status == 200) {</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;">　　alert(xml.responseText);</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;">　　status返回链接的状态，一般返回200与404，200表示成功返回，404表示未找到页面。</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;">　　readyState有5个值，分别为：0、1、2、3、4。而每当值改变时都会触发一次onreadystatechange。</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;">　　readyState的5个值含义分别为：</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;">　　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;">　　1: 服务器连接已建立</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; background-color: #ffffff;">　　3: 请求处理中</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;">　　也就是当请求完成，并且找到页面时，然后才获取服务器上的数据。</div><img src ="http://www.blogjava.net/qileilove/aggbug/417326.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-26 09:35 <a href="http://www.blogjava.net/qileilove/archive/2014/08/26/417326.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web服务请求异步化测试</title><link>http://www.blogjava.net/qileilove/archive/2014/08/18/417056.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 18 Aug 2014 01:39:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/18/417056.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/417056.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/18/417056.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/417056.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/417056.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;">　<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Web</strong></u></a>服务异步化：</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;">　　包括两部分，数据传输层异步化（大家已经熟知的NIO），Http业务请求异步化（continuations，servlet3.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;">　　Web服务异步化<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;">　　TOP应用特殊性：</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.自身服务能力由后端的服务能力决定。（对同步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;">　　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; background-color: #ffffff;">　　第一点导致TOP无法预估自身服务能力（不同后端服务处理速度下的TOP有不一样的支持能力），同时也无法应对在后端服务异常的情况下，整体的服务质量。</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;">　　第二点导致TOP只有在物理上分隔不同服务提供者所对应的TOP集群（资源浪费，同时无法动态调整资源来满足服务变化情况）。</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;">　　因此需要对TOP实施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;">　　1. 处理耗时大多消耗在于对后端或者外部服务资源的请求上。</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; background-color: #ffffff;">　　拿TOP来解释一下：TOP自身处理主要包括路由，安全，流控等，但是最耗时的是在请求后端各个淘宝团队的服务。其次当前后端服务能力尚未达到真实的处理高峰，因此很多请求被堵在TOP平台，特别是当某些服务异常的时候，另一些服务就会被拖累无法得到充分利用。（当然我们有流控，发现后端服务能力已经成为瓶颈的时候可以对单独服务作限制）。</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;">　　<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;">Linux</strong></u></a>&nbsp;2.6.9-55.ELsmp</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 Core</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 G Memory</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;">　　JDK 1.6.0_07</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 9.5</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. &nbsp; &nbsp; &nbsp; Apache + modjk + Jboss(后面缩写为Jboss)：</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;">　　此模式Apache配置如下：</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;">&lt;IfModule mpm_worker_module&gt;</div><div style="word-break: break-all; margin: 10px 0px;">ServerLimit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;80</div><div style="word-break: break-all; margin: 10px 0px;">ThreadLimit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;128</div><div style="word-break: break-all; margin: 10px 0px;">StartServers &nbsp; &nbsp; &nbsp; &nbsp; 10</div><div style="word-break: break-all; margin: 10px 0px;">MaxClients &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10240</div><div style="word-break: break-all; margin: 10px 0px;">MinSpareThreads &nbsp; &nbsp; &nbsp;64</div><div style="word-break: break-all; margin: 10px 0px;">MaxSpareThreads &nbsp; &nbsp; &nbsp;800</div><div style="word-break: break-all; margin: 10px 0px;">ThreadsPerChild &nbsp; &nbsp; &nbsp;128</div><div style="word-break: break-all; margin: 10px 0px;">MaxRequestsPerChild 10000</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/IfModule&gt;</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;">　　Jboss的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;">　　&lt;Connector port="8009" address="${jboss.bind.address}" connectionTimeout="8000" protocol="AJP/1.3" maxThreads="500" minSpareThreads="40" maxSpareThreads="75" maxPostSize="512000" acceptCount="300" bufferSize="16384" emptySessionPath="false" enableLookups="false" redirectPort="8443" URIEncoding="utf-8"/&gt;</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;">　　Jboss的web部分以APR模式启动。</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. &nbsp; &nbsp; &nbsp; Tomcat6（APR）</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;">　　&lt;Executor name="topThreadPool" namePrefix="top-exec-"</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;">　　maxThreads="500" minSpareThreads="40"/&gt;</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;">　　&lt;Connector port="7777" protocol="HTTP/1.1"</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;">　　executor="topThreadPool" connectionTimeout="20000" acceptCount="1000"</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;">　　redirectPort="8444" /&gt;</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. &nbsp; &nbsp; &nbsp; Tomcat7 RC 4（APR）</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;">　　&lt;Executor name="topThreadPool" namePrefix="top-exec-"</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;">　　maxThreads="500" minSpareThreads="4"/&gt;</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;">　　&lt;Connector executor="topThreadPool" port="3333" protocol="HTTP/1.1"</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;">　　connectionTimeout="20000" acceptCount="1000"</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;">　　redirectPort="6443" /&gt;</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. &nbsp; &nbsp; &nbsp; Jetty7</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;">&lt;Set name="ThreadPool"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;!-- Default queued blocking threadpool --&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;New class="org.eclipse.jetty.util.thread.QueuedThreadPool"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="minThreads"&gt;10&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="maxThreads"&gt;500&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Call name="addConnector"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Arg&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;New class="org.eclipse.jetty.server.nio.SelectChannelConnector"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="host"&gt;&lt;SystemProperty name="jetty.host" /&gt;&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="port"&gt;&lt;SystemProperty name="jetty.port" default="6060"/&gt;&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="maxIdleTime"&gt;300000&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="Acceptors"&gt;2&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="statsOn"&gt;false&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="confidentialPort"&gt;8443&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="lowResourcesConnections"&gt;20000&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Set name="lowResourcesMaxIdleTime"&gt;5000&lt;/Set&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/New&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Arg&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Call&gt;</div></td></tr></tbody></table><div style="word-break: break-all; margin: 10px 0px;">附注：</div><div style="word-break: break-all; margin: 10px 0px;">　　Asyn表示异步模式，syn表示同步。Asyn中还分成resume和complete两种方式，后续在介绍技术背景的时候详细描述。</div><div style="word-break: break-all; margin: 10px 0px;">　　对于服务端的load不是每一个测试都做了记录，选取了最全面的1500并发用户做了测试。</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;">　测试结果如下：</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　场景1：500 并发用户场景下，后端服务一次请求消耗3秒钟</div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=47640" 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_201408151122571gM7Y.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;">　　这个场景测试的目的是比较在线程池资源足够的时候，异步和同步的差别。（也就是TOP服务器所有的资源处于正常服务，前台请求没有因为前段连接被消耗完，导致服务质量降低）</div><div style="word-break: break-all; margin: 10px 0px;">　　可以看到，在TPS和Response Time上两者基本上没有太大差别，TPS就等于500/3=167左右（3秒一个请求，因此用这种简单算式可以算出），响应时间也较为正常。当时我发现在每秒吞吐量上有些差别，后来单个测试case跑了一下，发现是返回的http header比较大，应该是在做异步化时重入等作的一些标识（后面其他容器的异步化也是一样）。</div><div style="word-break: break-all; margin: 10px 0px;">　　最大处理请求数都在服务端后台看到是500，等同于最大的并发用户数。</div><div style="word-break: break-all; margin: 10px 0px;">　　场景2：1000 并发用户场景下，后端服务一次请求消耗3秒钟</div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=47641" 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_20140815112257227Ah.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;">　　这个场景的结果可以看到TPS在异步模式下与并发用户数呈现同步增长，就好比配置了1000个线程作为线程池一样，同样在后端打出的最大请求数上也证明了这一点，因此前段线程池的服务能力在异步的情况下充分复用（当然这里使用的异步服务处理使用的是NIO而不是BIO的Connector）。同样在吞吐量上依然是增加的，由于异步附加的内容。</div><div style="word-break: break-all; margin: 10px 0px;">　　场景3：1500 并发用户场景下，后端服务一次请求消耗3秒钟</div><div style="word-break: break-all; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=47642" 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_2014081511225731Sde.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;">　　场景三比对了现有TOP的部署模式（Apache + modjk + Jboss）和Jetty7的同步模式，两种异步模式，Tomcat同步模式，Tomcat的servlet3.0异步模式的处理情况。根据测试可以得到的信息如下：</div><div style="word-break: break-all; margin: 10px 0px;">　　1. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;现有部署方式在后端服务处理耗时较大的情况下，处理能力不如Jetty7和Tomcat6，同时出错率很高。</div><div style="word-break: break-all; margin: 10px 0px;">　　2. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Jetty7的同步处理测试结果和Tomcat6的同步处理测试结果很类似，但是load方面jetty7更好。</div><div style="word-break: break-all; margin: 10px 0px;">　　3. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;异步处理方面Jetty7的两种方式基本上差别不大（后续还需要深入源码看看对于数据缓存资源复用的状况），Tomcat7的异步处理成功率有些问题（错误多半是在获取response回写的时候，response已经被提前释放，看来Tomcat7还是需要一些时间来考验），load上来说tomcat结果比较好。</div><div style="word-break: break-all; margin: 10px 0px;">　　4. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;异步请求在提高处理能力的情况下，对于资源消耗也较大（线程切换较为频繁），不过还是在承受范围。</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;"><a href="http://www.51testing.com/batch.download.php?aid=47643" 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_2014081511225749PC9.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;">　<strong style="word-break: break-all; line-height: normal !important;">　最后将三个场景合并起来做一个简单的比较，得到信息如下：</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　1. &nbsp; &nbsp; &nbsp; 随着并发用户的增加，本身异步处理也会有衰减，同时对于性能消耗（线程切换）也会不断增长。</div><div style="word-break: break-all; margin: 10px 0px;">　　2. &nbsp; &nbsp; &nbsp; 异步化在消息头上会增加一些数据，会增加回写的带宽消耗（不过量不大），一个请求增加了100byte左右的消息数据。</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. &nbsp; &nbsp; &nbsp; Web请求异步化在TOP很合适。</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;">　　a. &nbsp; &nbsp; &nbsp; 处理耗时大多消耗在于对后端或者外部服务资源的请求上。</div><div style="word-break: break-all; margin: 10px 0px;">　　b. &nbsp; &nbsp; &nbsp; 后端或者外部资源在更多的流量下不会成为瓶颈。</div><div style="word-break: break-all; margin: 10px 0px;">　　2. &nbsp; &nbsp; &nbsp; Web请求异步化在Jetty6到7上已经经历了2年多的成长（Google App Engine , Yahoo Hadoop），稳定性和效率较好。（同时很多优化可以通过扩展自行定制，jetty的可扩展性很好）Tomcat7在servlet3上处于刚发布阶段，还有待继续完善。（Servlet3的另一种模式尚未执行成功，直接导致jvm退出）</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. &nbsp; &nbsp; &nbsp; 对于大数据量请求的容器间性能对比。（图片上传或者大数据量的Post请求）</div><div style="word-break: break-all; margin: 10px 0px;">　　2. &nbsp; &nbsp; &nbsp; 容器安全性。（是否容易被攻击）</div><div style="word-break: break-all; margin: 10px 0px;">　　3. &nbsp; &nbsp; &nbsp; 代码迁移成本。</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/417056.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-18 09:39 <a href="http://www.blogjava.net/qileilove/archive/2014/08/18/417056.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Apache安装配置管理</title><link>http://www.blogjava.net/qileilove/archive/2014/08/12/416836.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 12 Aug 2014 01:31:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/08/12/416836.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/416836.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/08/12/416836.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/416836.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/416836.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;">　一、安装<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Apache</strong></u></a></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;">　　下载地址：http://httpd.apache.org/</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. 安装Apache</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;">　　# tar &nbsp;zxvf &nbsp;httpd-2.2.11.tar.gz</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;">　　# cd &nbsp;httpd-2.2.11</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;">　　# ./configure &nbsp;--prefix=/usr/local/apache &nbsp;--enable-so</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;">　　//编译时加上加载模块参数--enable-so</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;">　　# make</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;">　　# make &nbsp;install</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. 配置系统启动时自动启动Apache服务。</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;">　　# vi &nbsp;/etc/rc.d/rc.local</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;">　　//在rc.local上加入一行/usr/local/apache/bin/apachectl &#8211;k &nbsp;start。</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;">二、配置Apache</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;">　<strong style="word-break: break-all; line-height: normal !important;">　1. 修改httpd.conf文件</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;">　　# vi &nbsp;/usr/local/apache/conf/httpd.conf</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） 设置根目录的路径</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;">　　根目录是指Apache存放配置文件和日志文件的目录，配置参数为ServerRoot，默认位于&#8220;/usr/local/apache&#8221;。命令如下：</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） 设置监听IP地址及端口号</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;">　　默认侦听本机所有IP地址的TCP80端口，命令如下：</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;">　　Listen 80</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;">　　用户也可以按自己的需求，使用多个Listen语句在多个地址和端口上侦听客户端请求。比如：</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;">　　Listen 192.168.99.9:80</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;">　　Listen 172.16.0.20:8080</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） 设置系统管理员E-mail</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;">　　使用ServerAdmin参数设置管理员E-mail，比如管理员的Email地址为root@guoxuemin.cn</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;">　　参数ServerName用来设置服务器的主机名称，如果没有域名则填入服务器的IP地址，比如服务器的IP地址为192.168.99.9：</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） 设置主目录的路径</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;">　　用户可以使用参数DocumentRoot配置服务器主目录默认路径，比如，主目录路径为：/usr/local/apache2/htdocs</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） 设置默认文件</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;">　　Apache的默认文件名为index.html，可以使用Directory Index参数来配置，比如，将index.php设置为默认文件名：index.php index.html</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）<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;">　　打开浏览器，输入地址：http://192.168.99.9，可以打开站点了：</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;">　2. 配置目录权限</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;">　　使用&lt;Directory 目录路径&gt;和&lt;/Directory&gt;设置目录的权限。比如：</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;">　　&lt;Directory &nbsp;&#8220;/var/www/icons&#8221;&gt;</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;">　　Options &nbsp;Indexes &nbsp;MultiViews</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;">　　AllowOverride &nbsp;None</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;">　　Order &nbsp;allow,deny</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;">　　Allow &nbsp;from &nbsp;all</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;">　　&lt;/Directory&gt;<br /><div style="word-break: break-all; margin: 10px 0px;">说明：</div><div style="word-break: break-all; margin: 10px 0px;">　　1）定义目录特性选项Options</div><div style="word-break: break-all; margin: 10px 0px;">　　可选参数：</div><div style="word-break: break-all; margin: 10px 0px;">　　Indexes：该特性表明目录允许&#8220;目录浏览&#8221;；</div><div style="word-break: break-all; margin: 10px 0px;">　　MultiViews：该特性表明目录允许内容协商的多重试图；</div><div style="word-break: break-all; margin: 10px 0px;">　　All：包含了除MultiViews外的所有特性；</div><div style="word-break: break-all; margin: 10px 0px;">　　ExecCGI：该特性表明允许在该目录下执行CGI脚本；</div><div style="word-break: break-all; margin: 10px 0px;">　　FollowSymLinks：该特性表明允许在该目录下使用符号连接。</div><div style="word-break: break-all; margin: 10px 0px;">　　2）.htaccess文件</div><div style="word-break: break-all; margin: 10px 0px;">　　可以通过.htaccess文件（访问控制文件）设置目录的权限。</div><div style="word-break: break-all; margin: 10px 0px;">　　AccessFileName &nbsp;.htaccess</div><div style="word-break: break-all; margin: 10px 0px;">　　配置参数AllowOverride指定目录的.htaccess文件中指令的类型，包括All、None与Options、FileInfo、AuthConfig、Limit的任意组合。一般将AllowOverride设置为&#8220;None&#8221;，禁止使用.htaccess文件，当AllowOverride参数为All时，.htaccess文件可以覆盖任何以前的配置。</div><div style="word-break: break-all; margin: 10px 0px;">　　3）设置访问控制</div><div style="word-break: break-all; margin: 10px 0px;">　　使用Order选项来定义访问权限。</div><div style="word-break: break-all; margin: 10px 0px;">　　比如以下语句表明允许所有客户机的访问：</div><div style="word-break: break-all; margin: 10px 0px;">　　Order &nbsp;allow,deny</div><div style="word-break: break-all; margin: 10px 0px;">　　Allow &nbsp;from &nbsp;all</div><div style="word-break: break-all; margin: 10px 0px;">　　以下语句表明只允许网段192.168.99.0/24的客户机访问，但IP地址为192.168.99.254这个客户机除外：</div><div style="word-break: break-all; margin: 10px 0px;">　　Order &nbsp;allow,deny</div><div style="word-break: break-all; margin: 10px 0px;">　　Allow from &nbsp;192.168.99.0/24</div><div style="word-break: break-all; margin: 10px 0px;">　　Deny from &nbsp;192.168.99.254</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;">3. 创建虚拟目录</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　使用Alias选项创建虚拟目录，比如，建立&#8220;/icons/&#8221;这个虚拟目录，其对应的物理路径为&#8220;/var/www/icons/&#8221;：</div><div style="word-break: break-all; margin: 10px 0px;">　　Alias &nbsp;/icons/ &nbsp;&#8220;/var/www/icons/&#8221;</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;">　　比如，有一个名为myweb的虚拟目录，其对应的物理路径是&#8220;/usr/local/myweb&#8221;，现对其启用用户认证功能，只允许用户Tonyguo和Wayne访问。</div><div style="word-break: break-all; margin: 10px 0px;">　　1）建立虚拟目录并设置用户认证：</div><div style="word-break: break-all; margin: 10px 0px;">　　Alias /myweb/ &#8220;/usr/local/myweb/&#8221;</div><div style="word-break: break-all; margin: 10px 0px;">　　&lt;Directory &nbsp;&#8220;/usr/local/myweb/&#8221;&gt;</div><div style="word-break: break-all; margin: 10px 0px;">　　Options &nbsp;none</div><div style="word-break: break-all; margin: 10px 0px;">　　AllowOverride &nbsp;None</div><div style="word-break: break-all; margin: 10px 0px;">　　Order &nbsp;allow,deny</div><div style="word-break: break-all; margin: 10px 0px;">　　Allow &nbsp;from &nbsp;all</div><div style="word-break: break-all; margin: 10px 0px;">　　AuthType Basic</div><div style="word-break: break-all; margin: 10px 0px;">　　AuthName &#8220;Please Login: &#8221;</div><div style="word-break: break-all; margin: 10px 0px;">　　AuthUserFile/usr/local/apache/bin/mywebpwd</div><div style="word-break: break-all; margin: 10px 0px;">　　Require User Tongguo wayne</div><div style="word-break: break-all; margin: 10px 0px;">　　&lt;/Directory&gt;</div><div style="word-break: break-all; margin: 10px 0px;">　　2) 建立口令文件并为用户设置口令</div><div style="word-break: break-all; margin: 10px 0px;">　　/usr/local/apache/bin/htpasswd &#8211;c /usr/local/apache/bin/mywebpwd Tonyguo</div><div style="word-break: break-all; margin: 10px 0px;">　　-c选项表示无论口令文件是否已经存在，都会重新写入文件并删除原内容。所以第二个用户wayne不需要使用-c选项</div><div style="word-break: break-all; margin: 10px 0px;">　　3）测试</div><div style="word-break: break-all; margin: 10px 0px;">　　在浏览器中输入：http://192.168.99.9/myweb，可以看到如下对话框：</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;">　三、配置虚拟主机</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　1. 配置基于IP的虚拟主机</div><div style="word-break: break-all; margin: 10px 0px;">　　1）IP地址相同，但端口号不同的虚拟主机配置</div><div style="word-break: break-all; margin: 10px 0px;">　　比如使用192.168.99.9的两个不同端口80和8080发布两个不同站点, 虚拟主机分别对应的目录为/usr/local/apache/htdocs/web1和/usr/local/apache/htdocs/web2：</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; background-color: #ffffff;">Listen 80</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">Listen 8080</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">&lt;VirtualHost &nbsp;192.168.99.9:80&gt;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">ServerSignature &nbsp;email</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">DocumentRoot &nbsp;/usr/local/apache/htdocs/web1</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">DirectoryIndex &nbsp;index.html &nbsp;index.htm</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">LogLevel &nbsp;warm</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">HostNameLookups &nbsp;off</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">&lt;VirtualHost &nbsp;192.168.99.9:8080&gt;</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">ServerSignature &nbsp;email</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">DocumentRoot &nbsp;/usr/local/apache/htdocs/web2</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">DirectoryIndex &nbsp;index.html &nbsp;index.htm</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">LogLevel &nbsp;warm</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">HostNameLookups &nbsp;off</div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;">&lt;/VirtualHost&gt;</div></td></tr></tbody></table><div style="word-break: break-all; margin: 10px 0px;">　2）端口相同，ip不同的虚拟主机配置</div><div style="word-break: break-all; margin: 10px 0px;">　　比如服务器有两个IP地址192.168.99.9和192.168.99.10，使用这两个IP创建两台虚拟主机，虚拟主机分别对应的目录为/usr/local/apache/htdocs/web1和/usr/local/apache/htdocs/web2。设置方法如下：</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;">&lt;VirtualHost &nbsp;192.168.99.9&gt;</div><div style="word-break: break-all; margin: 10px 0px;">ServerName &nbsp;192.168.99.9:80</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot &nbsp;/usr/local/apache/htdocs/web1</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex &nbsp;index.html &nbsp;index.htm</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost &nbsp;192.168.99.10&gt;</div><div style="word-break: break-all; margin: 10px 0px;">ServerName &nbsp;192.168.99.10:80</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot &nbsp;/usr/local/apache/htdocs/web2</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex &nbsp;index.html &nbsp;index.htm</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; margin: 10px 0px;">　　2. 配置基于域名的虚拟主机</div><div style="word-break: break-all; margin: 10px 0px;">　　比如有两个域名guoxuemin.cn和tonyguo.com需要使用同一台服务器192.168.99.9，那么可以这样配置：</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;">NameVirtualHost &nbsp;192.168.99.9</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost &nbsp;www.guoxuemin.cn&gt;</div><div style="word-break: break-all; margin: 10px 0px;">ServerName &nbsp;www.guoxuemin.cn:80</div><div style="word-break: break-all; margin: 10px 0px;">ServerAdmin &nbsp;admin@guoxuemin.cn</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot &nbsp;/usr/local/apache/htdocs/web1</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex &nbsp;index.html &nbsp;index.htm</div><div style="word-break: break-all; margin: 10px 0px;">ErrorLog &nbsp;logs/web1/error_log</div><div style="word-break: break-all; margin: 10px 0px;">Customlog &nbsp;logs/web1/access_log &nbsp;combined</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost &nbsp;www.tonyguo.com&gt;</div><div style="word-break: break-all; margin: 10px 0px;">ServerName &nbsp; www.tonyguo.com:80</div><div style="word-break: break-all; margin: 10px 0px;">ServerAdmin &nbsp;admin@tonyguo.com</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot &nbsp;/usr/local/apache/htdocs/web2</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex &nbsp;index.html &nbsp;index.htm</div><div style="word-break: break-all; margin: 10px 0px;">ErrorLog &nbsp;logs/web1/error_log</div><div style="word-break: break-all; margin: 10px 0px;">Customlog &nbsp;logs/web1/access_log &nbsp;combined</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost *:8088&gt;</div><div style="word-break: break-all; margin: 10px 0px;">serverAdmin new@student.com</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot "/web/web1"</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Directory /web/web1&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Options FollowSymlinks</div><div style="word-break: break-all; margin: 10px 0px;">AllowOverride None</div><div style="word-break: break-all; margin: 10px 0px;">Order Allow,Deny</div><div style="word-break: break-all; margin: 10px 0px;">Allow from all</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Directory&gt;</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex index.html index.php index.htm</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost *:8089&gt;</div><div style="word-break: break-all; margin: 10px 0px;">serverAdmin new@student.com</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot "/web/web2"</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Directory /web/web2&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Options FollowSymlinks</div><div style="word-break: break-all; margin: 10px 0px;">AllowOverride None</div><div style="word-break: break-all; margin: 10px 0px;">Order Allow,Deny</div><div style="word-break: break-all; margin: 10px 0px;">Allow from all</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Directory&gt;</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex index.html index.php index.htm</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost 192.168.88.144:80&gt;</div><div style="word-break: break-all; margin: 10px 0px;">serverAdmin new@student.com</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot "/web/web3"</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Directory /web/web3&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Options FollowSymlinks</div><div style="word-break: break-all; margin: 10px 0px;">AllowOverride None</div><div style="word-break: break-all; margin: 10px 0px;">Order Allow,Deny</div><div style="word-break: break-all; margin: 10px 0px;">Allow from all</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Directory&gt;</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex index.html index.php index.htm</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost 192.168.88.145:80&gt;</div><div style="word-break: break-all; margin: 10px 0px;">serverAdmin new@student.com</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot "/web/web4"</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Directory /web/web4&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Options FollowSymlinks</div><div style="word-break: break-all; margin: 10px 0px;">AllowOverride None</div><div style="word-break: break-all; margin: 10px 0px;">Order Allow,Deny</div><div style="word-break: break-all; margin: 10px 0px;">Allow from all</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Directory&gt;</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex index.html index.php index.htm</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost ftp.com&gt;</div><div style="word-break: break-all; margin: 10px 0px;">ServerName ftp.com:80</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot /web/ftp</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Directory /web/ftp&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Options FollowSymlinks</div><div style="word-break: break-all; margin: 10px 0px;">AllowOverride None</div><div style="word-break: break-all; margin: 10px 0px;">Order Allow,Deny</div><div style="word-break: break-all; margin: 10px 0px;">Allow from all</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Directory&gt;</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex index.html index.php index.htm</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;VirtualHost mail.com&gt;</div><div style="word-break: break-all; margin: 10px 0px;">ServerName mail.com:80</div><div style="word-break: break-all; margin: 10px 0px;">DocumentRoot /web/mail</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Directory /web/mail&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Options FollowSymlinks</div><div style="word-break: break-all; margin: 10px 0px;">AllowOverride None</div><div style="word-break: break-all; margin: 10px 0px;">Order Allow,Deny</div><div style="word-break: break-all; margin: 10px 0px;">Allow from all</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Directory&gt;</div><div style="word-break: break-all; margin: 10px 0px;">DirectoryIndex index.html index.php index.htm</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/VirtualHost&gt;</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;">　　#访问test目录时负载均衡</div><div style="word-break: break-all; margin: 10px 0px;">　　在modules目录下：导入mod</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;">/usr/local/apache2/bin/apxs -c -i mod_proxy.c proxy_util.c</div><div style="word-break: break-all; margin: 10px 0px;">/usr/local/apache2/bin/apxs -c -i mod_proxy_balancer.c</div><div style="word-break: break-all; margin: 10px 0px;">/usr/local/apache2/bin/apxs -c -i &nbsp;mod_proxy_http.c</div><div style="word-break: break-all; margin: 10px 0px;">vi http.conf</div><div style="word-break: break-all; margin: 10px 0px;">LoadModule proxy_module &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;modules/mod_proxy.so</div><div style="word-break: break-all; margin: 10px 0px;">LoadModule proxy_balancer_module &nbsp; modules/mod_proxy_balancer.so</div><div style="word-break: break-all; margin: 10px 0px;">LoadModule proxy_http_module &nbsp; &nbsp; &nbsp; modules/mod_proxy_http.so</div><div style="word-break: break-all; margin: 10px 0px;">ProxyRequests Off</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Proxy balancer://clusterphpinfo&gt;</div><div style="word-break: break-all; margin: 10px 0px;">BalancerMember http://192.168.88.134:8089 &nbsp;loadfactor=5</div><div style="word-break: break-all; margin: 10px 0px;">BalancerMember http://192.168.88.134:8088 &nbsp;loadfactor=1</div><div style="word-break: break-all; margin: 10px 0px;">#weight</div><div style="word-break: break-all; margin: 10px 0px;">ProxySet lbmethod=bytraffic</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Proxy&gt;</div><div style="word-break: break-all; margin: 10px 0px;">ProxyPass /test balancer://clusterphpinfo stickysession=STICK_PORT_TOKEN nofailover=On</div><div style="word-break: break-all; margin: 10px 0px;">ProxyPassReverse /test balancer://clusterphpinfo</div><div style="word-break: break-all; margin: 10px 0px;">&lt;Location /balancer-manager&gt;</div><div style="word-break: break-all; margin: 10px 0px;">SetHandler balancer-manager</div><div style="word-break: break-all; margin: 10px 0px;">Order Deny,Allow</div><div style="word-break: break-all; margin: 10px 0px;">Allow from all</div><div style="word-break: break-all; margin: 10px 0px;">#Allow from 192.168.88.*</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/Location&gt;</div></td></tr></tbody></table></div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/416836.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-12 09:31 <a href="http://www.blogjava.net/qileilove/archive/2014/08/12/416836.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web前沿—HTML5 Form Data 对象的使用</title><link>http://www.blogjava.net/qileilove/archive/2014/07/29/416269.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 29 Jul 2014 01:21:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/29/416269.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/416269.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/29/416269.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/416269.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/416269.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;">　　XMLHttpRequest Level 2 添加了一个新的接口&#8212;&#8212;FormData。利用 FormData 对象，我们可以通过 JavaScript 用一些键值对来模拟一系列表单控件，我们还可以使用 XMLHttpRequest 的 send() 方法来异步的提交表单。与普通的 Ajax 相比，使用 FormData 的最大优点就是我们可以异步上传二进制文件。</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;">创建一个FormData对象</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;">　　你可以先创建一个空的 FormData 对象,然后使用 append() 方法向该对象里添加字段，如下：</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;">var oMyForm = new FormData();</div><div style="word-break: break-all; margin: 10px 0px;">oMyForm.append("username", "Groucho");</div><div style="word-break: break-all; margin: 10px 0px;">oMyForm.append("accountnum", 123456); // 数字123456被立即转换成字符串"123456"</div><div style="word-break: break-all; margin: 10px 0px;">// fileInputElement中已经包含了用户所选择的文件</div><div style="word-break: break-all; margin: 10px 0px;">oMyForm.append("userfile", fileInputElement.files[0]);</div><div style="word-break: break-all; margin: 10px 0px;">var oFileBody = "&lt;a id="a"&gt;&lt;b id="b"&gt;hey!&lt;/b&gt;&lt;/a&gt;"; // Blob对象包含的文件内容</div><div style="word-break: break-all; margin: 10px 0px;">var oBlob = new Blob([oFileBody], { type: "text/xml"});</div><div style="word-break: break-all; margin: 10px 0px;">oMyForm.append("webmasterfile", oBlob);</div><div style="word-break: break-all; margin: 10px 0px;">var oReq = new XMLHttpRequest();</div><div style="word-break: break-all; margin: 10px 0px;">oReq.open("POST", "http://foo.com/submitform.php");</div><div style="word-break: break-all; margin: 10px 0px;">oReq.send(oMyForm);</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;">　　注：字段 "userfile" 和 "webmasterfile" 的值都包含了一个文件。通过 FormData.append() 方法赋给字段 "accountnum" 的数字被自动转换为字符（字段的值可以是一个 Blob 对象，File对象或者字符串，剩下其他类型的值都会被自动转换成字符串）。</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;">　　在该例子中，我们创建了一个名为 oMyForm 的 FormData 对象，该对象中包含了名为"username"，"accountnum"，"userfile" 以及 "webmasterfile" 的字段名，然后使用XMLHttpRequest的 send() 方法把这些数据发送了出去。"webmasterfile" 字段的值不是一个字符串,还是一个 Blob 对象。</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;">　　使用HTML表单来初始化一个FormData对象</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;">　　可以用一个已有的 form 元素来初始化 FormData 对象，只需要把这个 form 元素作为参数传入 FormData 构造函数即可：</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;">　　var newFormData = new FormData(someFormElement);</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;">　　var formElement = document.getElementById("myFormElement");</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;">　　var oReq = new XMLHttpRequest();</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;">　　oReq.open("POST", "submitform.php");</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;">　　oReq.send(new FormData(formElement));</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;">　　var formElement = document.getElementById("myFormElement");</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;">　　formData = new FormData(formElement);</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;">　　formData.append("serialnumber", serialNumber++);</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;">　　oReq.send(formData);</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;">　　你可以通过这种方式添加一些不想让用户编辑的固定字段,然后再发送.<span style="font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px;">　</span><strong style="font-family: verdana, 'courier new'; font-size: 14px; word-break: break-all; line-height: normal !important;">使用FormData对象发送文件</strong></div><div style="word-break: break-all; margin: 10px 0px;">　　你还可以使用 FormData 来发送二进制文件.首先在 HTML 中要有一个包含了文件输入框的 form 元素：</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;">&lt;form enctype="multipart/form-data" method="post" name="fileinfo"&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;label&gt;Your email address:&lt;/label&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;input type="email" autocomplete="on" autofocus name="userid" placeholder="email" required size="32" maxlength="64" /&gt;&lt;br /&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;label&gt;Custom file label:&lt;/label&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;input type="text" name="filelabel" size="12" maxlength="32" /&gt;&lt;br /&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;label&gt;File to stash:&lt;/label&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;input type="file" name="file" required /&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;/form&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;div id="output"&gt;&lt;/div&gt;</div><div style="word-break: break-all; margin: 10px 0px;">&lt;a href="javascript:sendForm()"&gt;Stash the file!&lt;/a&gt;</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;">function sendForm() {</div><div style="word-break: break-all; margin: 10px 0px;">var oOutput = document.getElementById("output");</div><div style="word-break: break-all; margin: 10px 0px;">var oData = new FormData(document.forms.namedItem("fileinfo"));</div><div style="word-break: break-all; margin: 10px 0px;">oData.append("CustomField", "This is some extra data");</div><div style="word-break: break-all; margin: 10px 0px;">var oReq = new XMLHttpRequest();</div><div style="word-break: break-all; margin: 10px 0px;">oReq.open("POST", "stash.php", true);</div><div style="word-break: break-all; margin: 10px 0px;">oReq.onload = function(oEvent) {</div><div style="word-break: break-all; margin: 10px 0px;">if (oReq.status == 200) {</div><div style="word-break: break-all; margin: 10px 0px;">oOutput.innerHTML = "Uploaded!";</div><div style="word-break: break-all; margin: 10px 0px;">} else {</div><div style="word-break: break-all; margin: 10px 0px;">oOutput.innerHTML = "Error " + oReq.status + " occurred uploading your file.&lt;br \/&gt;";</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;">oReq.send(oData);</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;">　　你还可以不借助 HTML 表单，直接向 FormData 对象中添加一个 File 对象或者一个 Blob 对象：</div><div style="word-break: break-all; margin: 10px 0px;">　　data.append("myfile", myBlob);</div><div style="word-break: break-all; margin: 10px 0px;">　　如果 FormData 对象中的某个字段值是一个 Blob 对象，则在发送 HTTP 请求时，代表该 Blob 对象所包含文件的文件名的 "Content-Disposition" 请求头的值在不同的浏览器下有所不同，Firefox使用了固定的字符串"blob"，而 Chrome 使用了一个随机字符串。</div><div style="word-break: break-all; margin: 10px 0px;">　　你还可以使用 jQuery 来发送 FormData，但必须要正确的设置相关选项：</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;">var fd = new FormData(document.getElementById("fileinfo"));</div><div style="word-break: break-all; margin: 10px 0px;">fd.append("CustomField", "This is some extra data");</div><div style="word-break: break-all; margin: 10px 0px;">$.ajax({</div><div style="word-break: break-all; margin: 10px 0px;">url: "stash.php",</div><div style="word-break: break-all; margin: 10px 0px;">type: "POST",</div><div style="word-break: break-all; margin: 10px 0px;">data: fd,</div><div style="word-break: break-all; margin: 10px 0px;">processData: false, &nbsp;// 告诉jQuery不要去处理发送的数据</div><div style="word-break: break-all; margin: 10px 0px;">contentType: false &nbsp; // 告诉jQuery不要去设置Content-Type请求头</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;"><a href="http://www.51testing.com/batch.download.php?aid=47145" 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_201407281142201d71g.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;"></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; height: 21px; position: relative; width: 627.1875px; background-color: #ffffff;"></div><img src ="http://www.blogjava.net/qileilove/aggbug/416269.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-29 09:21 <a href="http://www.blogjava.net/qileilove/archive/2014/07/29/416269.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>H5页面测试总结</title><link>http://www.blogjava.net/qileilove/archive/2014/07/24/416154.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 24 Jul 2014 01:41:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/07/24/416154.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/416154.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/07/24/416154.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/416154.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/416154.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;">其实经过几次H5页面<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>之后，发现存在很多共同的问题，所以在此对H5页面的测试点（以及容易出问题的点），做一个总结，给开发同学自测，以及准备入手H5测试的同学一个参考。</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;">1、业务逻辑相关</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;">功能测试</strong></u></a>之外，H5页面的测试，需要关注以下几点：</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.1 登陆</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;">　　目前H5与native各个客户端都做了互通，所以大家在测试的时候要注意两点：</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、若客户端已登录，那么进入H5后仍然是登录状态。</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;">　　B、若客户端未登录，进入H5，点击对应按钮OR链接，如果需要登录，须拉起native登录。若取消登录，是否可再次拉起登录，或者停留在的页面是否有对应的登录提示。</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;">　　ps：本次测试过程中就发现，第一次点击链接，可以拉起登录，第二次却不能。</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.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; background-color: #ffffff;">　　遇到翻页加载的页面，需要注意内容为1页或者多页的情况。</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、数据分页加载时，注意后续页面请求数据的正确。</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;">　　ps：这个需要注意在快速操作场景中，请求页数是不是依次递增，快速操作（如第一页尚未loading出来的时候仍然继续上拉操作）时是否发出去对应的请求了。</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.3 刷新与返回</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、下拉刷新是否仍然处于当前页面。</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;">　　B、用户主动点击刷新按钮是否仍然处于当前页面。</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;">　　C、点击返回与back键，回退页面是否是期望页面</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;">　　ps：本次测试过程中就发现，mtop接口请求成功，但是data内无数据时，返回到的就是个空白页面，无法正常发送请求。</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.4 mtop接口返回处理</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;">　　A、请求成功，且返回有数据，测试mtop接口返回数据的各种场景。</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;">　　B、请求成功，但data内容为空。</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;">　　C、请求接口异常，出现ERR_SID_INVALID::SESSION过期，拉起登录。</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;">　　D、请求接口发生除C中提到的异常之外的异常，通常可归结为一类进行处理。</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;">2、H5适配相关</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;">　　H5的适配其实比客户端的相对来说，要少一些，<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>品牌之间的差异不大，所以不用太多关注，最容易出现问题的是android2.3系统，这个要特别关注下：</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、大屏（如720*1280，重点关注页面背景是否完全撑开页面，刷新是否有抖动）、小屏手机（如320*480，重点关注下弹框样式和文案折行）</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;">　　B、android2.3、android4.X随机找一个即可。</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;">　　C、ios5、ios6、ios7。</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;">　3、安全相关</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;">　　3.1 明确投放渠道都有哪些</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;">　　如独客、主客、wap，是否对未投放渠道做了限制，直接通过url请求是否拦截等</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.2 评估是否需要接入集团安全，如mtee黑白名单等。</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.3 是否需要接入支付宝实名认证</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;">　　3.4 是否接入windvane，所有请求通过native发出。<br /><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;">　　4.1 资源相关</div><div style="word-break: break-all; margin: 10px 0px;">　　A、页面中有图片的话，淘宝那边建议图片一般不大于50kb，本着一个原则，尽量缩小图片。</div><div style="word-break: break-all; margin: 10px 0px;">　　B、资源是否压缩、是否通过CDN加载。</div><div style="word-break: break-all; margin: 10px 0px;">　　C、如何保证二次发布后有效更新。</div><div style="word-break: break-all; margin: 10px 0px;">　　4.2 流量</div><div style="word-break: break-all; margin: 10px 0px;">　　A、对于一些不会变化的图片，如游戏动画效果相关图片，不需要每次都请求的东西，做本地缓存。</div><div style="word-break: break-all; margin: 10px 0px;">　　B、数据较多时是否做了分页加载。</div><div style="word-break: break-all; margin: 10px 0px;">　　4.3 页面展现时间</div><div style="word-break: break-all; margin: 10px 0px;">　　A、关注页面首屏加载时间。</div><div style="word-break: break-all; margin: 10px 0px;">　　4.4 页面提示</div><div style="word-break: break-all; margin: 10px 0px;">　　A、弱网络下，数据加载较慢，是否有对应的loading提示。</div><div style="word-break: break-all; margin: 10px 0px;">　　B、接口获取异常时，提示是否友好。</div><div style="word-break: break-all; margin: 10px 0px;">　　C、刷新页面或者加载新内容时页面是否有抖动。</div><div style="word-break: break-all; margin: 10px 0px;">　　4.5 手机操作相关</div><div style="word-break: break-all; margin: 10px 0px;">　　A、锁屏之后展示页面。</div><div style="word-break: break-all; margin: 10px 0px;">　　B、回退到后台之后，重新呼出在前台展示。</div><div style="word-break: break-all; margin: 10px 0px;">　　4.6 弱网络体验</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;">　　与BI、前端同学一起确认埋点情况。</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/416154.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-24 09:41 <a href="http://www.blogjava.net/qileilove/archive/2014/07/24/416154.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java中JSON的简单使用与前端解析</title><link>http://www.blogjava.net/qileilove/archive/2014/06/13/414694.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 13 Jun 2014 02:09:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/06/13/414694.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/414694.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/06/13/414694.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/414694.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/414694.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;">一、JSON</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;">　　JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式。 JSON采用完全独立于语言的文本格式。这些特性使JSON成为理想的数据交换语言。易于人阅读和编写，同时也易于机器解析和生成。</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;">　　JSON与XML的对比（引用自：sanpintian的CSDN博客）：</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、可读性：JSON和XML的可读性可谓不相上下，一边是建议的语法，一边是规范的标签形式，很难分出胜负。</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、可扩展性：XML天生有很好的扩展性，JSON当然也有，没有什么是XML能扩展，JSON不能的。</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、编码难度：XML有丰富的编码工具，比如Dom4j、JDom等，JSON也有json.org提供的工具，但是JSON的编码明显比XML容易许多，即使不借助工具也能写出JSON的代码，可是要写好XML就不太容易了。</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、解码难度：XML的解析得考虑子节点父节点，让人头昏眼花，而JSON的解析难度几乎为0。这一点XML输的真是没话说。</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、流行度：XML已经被业界广泛的使用，而JSON才刚刚开始，但是在Ajax这个特定的领域，未来的发展一定是XML让位于JSON。到时Ajax应该变成Ajaj(Asynchronous Javascript and JSON)了。</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;">　　使用JSON需要导入以下包：</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;">　　commons-beanutils.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;">　　commons-logging.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;">　　commons-lang.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;">　　commons-collection.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;">　　ezmorph.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;">　　json-lib.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; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46339" 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_201406120918171alT4.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;">　<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;">　　Book类的实现：</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;">1 &nbsp;public class Book {</div><div style="word-break: break-all; margin: 10px 0px;">2 &nbsp; &nbsp; private String name;</div><div style="word-break: break-all; margin: 10px 0px;">3 &nbsp; &nbsp; private double price;</div><div style="word-break: break-all; margin: 10px 0px;">4</div><div style="word-break: break-all; margin: 10px 0px;">5 &nbsp; &nbsp; public String getName() {</div><div style="word-break: break-all; margin: 10px 0px;">6 &nbsp; &nbsp; &nbsp; &nbsp; return name;</div><div style="word-break: break-all; margin: 10px 0px;">7 &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">8</div><div style="word-break: break-all; margin: 10px 0px;">9 &nbsp; &nbsp; public void setName(String name) {</div><div style="word-break: break-all; margin: 10px 0px;">10 &nbsp; &nbsp; &nbsp; &nbsp; this.name = name;</div><div style="word-break: break-all; margin: 10px 0px;">11 &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">12</div><div style="word-break: break-all; margin: 10px 0px;">13 &nbsp; &nbsp; public double getPrice() {</div><div style="word-break: break-all; margin: 10px 0px;">14 &nbsp; &nbsp; &nbsp; &nbsp; return price;</div><div style="word-break: break-all; margin: 10px 0px;">15 &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">16</div><div style="word-break: break-all; margin: 10px 0px;">17 &nbsp; &nbsp; public void setPrice(double price) {</div><div style="word-break: break-all; margin: 10px 0px;">18 &nbsp; &nbsp; &nbsp; &nbsp; this.price = price;</div><div style="word-break: break-all; margin: 10px 0px;">19 &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">20</div><div style="word-break: break-all; margin: 10px 0px;">21 &nbsp; &nbsp; @Override</div><div style="word-break: break-all; margin: 10px 0px;">22 &nbsp; &nbsp; public String toString() {</div><div style="word-break: break-all; margin: 10px 0px;">23 &nbsp; &nbsp; &nbsp; &nbsp; return name+" "+price;</div><div style="word-break: break-all; margin: 10px 0px;">24 &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">25 }</div></td></tr></tbody></table><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; 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;">1 /**</div><div style="word-break: break-all; margin: 10px 0px;">2 &nbsp;* @author ZWQ</div><div style="word-break: break-all; margin: 10px 0px;">3 &nbsp;* **/</div><div style="word-break: break-all; margin: 10px 0px;">4 public class JsonTest {</div><div style="word-break: break-all; margin: 10px 0px;">5 &nbsp; &nbsp; public static void main(String[] args) {</div><div style="word-break: break-all; margin: 10px 0px;">6 &nbsp; &nbsp; &nbsp; &nbsp; //***********************************************************************</div><div style="word-break: break-all; margin: 10px 0px;">7 &nbsp; &nbsp; &nbsp; &nbsp; // json基本测试</div><div style="word-break: break-all; margin: 10px 0px;">8 &nbsp; &nbsp; &nbsp; &nbsp; {</div><div style="word-break: break-all; margin: 10px 0px;">9 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //新建一个JSON数组</div><div style="word-break: break-all; margin: 10px 0px;">10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JSONArray jsonArray = new JSONArray();</div><div style="word-break: break-all; margin: 10px 0px;">11 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //新建一个JSON对象</div><div style="word-break: break-all; margin: 10px 0px;">12 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JSONObject json1 = new JSONObject();</div><div style="word-break: break-all; margin: 10px 0px;">13 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json1.put("id", "1");</div><div style="word-break: break-all; margin: 10px 0px;">14 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json1.put("name", "张三");</div><div style="word-break: break-all; margin: 10px 0px;">15 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json1.put("password", "123456");</div><div style="word-break: break-all; margin: 10px 0px;">16 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //将JSON对象添加到JSON数组中去</div><div style="word-break: break-all; margin: 10px 0px;">17 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jsonArray.add(json1);</div><div style="word-break: break-all; margin: 10px 0px;">18</div><div style="word-break: break-all; margin: 10px 0px;">19 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JSONObject json2 = new JSONObject();</div><div style="word-break: break-all; margin: 10px 0px;">20 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json2.put("id", "2");</div><div style="word-break: break-all; margin: 10px 0px;">21 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json2.put("name", "李四");</div><div style="word-break: break-all; margin: 10px 0px;">22 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json2.put("password", "654321");</div><div style="word-break: break-all; margin: 10px 0px;">23 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jsonArray.add(json2);</div><div style="word-break: break-all; margin: 10px 0px;">24 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("json数组基本测试:" + jsonArray);</div><div style="word-break: break-all; margin: 10px 0px;">25</div><div style="word-break: break-all; margin: 10px 0px;">26 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //结果：</div><div style="word-break: break-all; margin: 10px 0px;">27 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //[{"id":"1","name":"张三","password":"123456"},{"id":"2","name":"李四","password":"654321"}]</div><div style="word-break: break-all; margin: 10px 0px;">28 &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">29</div><div style="word-break: break-all; margin: 10px 0px;">30 &nbsp; &nbsp; &nbsp; &nbsp; //***********************************************************************</div><div style="word-break: break-all; margin: 10px 0px;">31 &nbsp; &nbsp; &nbsp; &nbsp; //将对象转成JSON字符串</div><div style="word-break: break-all; margin: 10px 0px;">32 &nbsp; &nbsp; &nbsp; &nbsp; {</div><div style="word-break: break-all; margin: 10px 0px;">33 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Book book = new Book();</div><div style="word-break: break-all; margin: 10px 0px;">34 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; book.setName("Java入门教程");</div><div style="word-break: break-all; margin: 10px 0px;">35 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; book.setPrice(52.3);</div><div style="word-break: break-all; margin: 10px 0px;">36 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //将Java对象转成JSON对象</div><div style="word-break: break-all; margin: 10px 0px;">37 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JSONObject jsonObject = JSONObject.fromObject(book);</div><div style="word-break: break-all; margin: 10px 0px;">38 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("从Object到JSONObject:" + jsonObject.toString());</div><div style="word-break: break-all; margin: 10px 0px;">39</div><div style="word-break: break-all; margin: 10px 0px;">40 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //结果：</div><div style="word-break: break-all; margin: 10px 0px;">41 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //从Object到JSONObject:{"name":"Java入门教程","price":52.3}</div><div style="word-break: break-all; margin: 10px 0px;">42 &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">43</div><div style="word-break: break-all; margin: 10px 0px;">44 &nbsp; &nbsp; &nbsp; &nbsp; //***********************************************************************</div><div style="word-break: break-all; margin: 10px 0px;">45 &nbsp; &nbsp; &nbsp; &nbsp; //将对象集合转成JSON字符串</div><div style="word-break: break-all; margin: 10px 0px;">46 &nbsp; &nbsp; &nbsp; &nbsp; {</div><div style="word-break: break-all; margin: 10px 0px;">47 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&lt;Book&gt; list = new ArrayList&lt;Book&gt;();</div><div style="word-break: break-all; margin: 10px 0px;">48 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Book book1 = new Book();</div><div style="word-break: break-all; margin: 10px 0px;">49 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; book1.setName("高等数学I");</div><div style="word-break: break-all; margin: 10px 0px;">50 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; book1.setPrice(34.1);</div><div style="word-break: break-all; margin: 10px 0px;">51 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Book book2 = new Book();</div><div style="word-break: break-all; margin: 10px 0px;">52 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; book2.setName("线性代数");</div><div style="word-break: break-all; margin: 10px 0px;">53 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; book2.setPrice(12.7);</div><div style="word-break: break-all; margin: 10px 0px;">54 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list.add(book1);</div><div style="word-break: break-all; margin: 10px 0px;">55 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list.add(book2);</div><div style="word-break: break-all; margin: 10px 0px;">56 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //将List集合转为JSON数组</div><div style="word-break: break-all; margin: 10px 0px;">57 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JSONArray jsonArray= JSONArray.fromObject(list);</div><div style="word-break: break-all; margin: 10px 0px;">58 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("从Object集合到JSONArray:" + jsonArray.toString());</div><div style="word-break: break-all; margin: 10px 0px;">59</div><div style="word-break: break-all; margin: 10px 0px;">60 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //结果：</div><div style="word-break: break-all; margin: 10px 0px;">61 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //从Object集合到JSONArray:[{"name":"高等数学I","price":34.1},{"name":"线性代数","price":12.7}]</div><div style="word-break: break-all; margin: 10px 0px;">62 &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">63</div><div style="word-break: break-all; margin: 10px 0px;">64 &nbsp; &nbsp; &nbsp; &nbsp; //***********************************************************************</div><div style="word-break: break-all; margin: 10px 0px;">65 &nbsp; &nbsp; &nbsp; &nbsp; // 将JSON字符串转为Java对象</div><div style="word-break: break-all; margin: 10px 0px;">66 &nbsp; &nbsp; &nbsp; &nbsp; {</div><div style="word-break: break-all; margin: 10px 0px;">67 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String jsonString = "{name:'数据结构',price:52.3}";</div><div style="word-break: break-all; margin: 10px 0px;">68 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JSONObject jsonObject = JSONObject.fromObject(jsonString);</div><div style="word-break: break-all; margin: 10px 0px;">69 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //将JSON对象转为Java对象</div><div style="word-break: break-all; margin: 10px 0px;">70 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Book book = (Book) JSONObject.toBean(jsonObject, Book.class);</div><div style="word-break: break-all; margin: 10px 0px;">71 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(book.toString());</div><div style="word-break: break-all; margin: 10px 0px;">72</div><div style="word-break: break-all; margin: 10px 0px;">73 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //结果：</div><div style="word-break: break-all; margin: 10px 0px;">74 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //数据结构 52.3</div><div style="word-break: break-all; margin: 10px 0px;">75 &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">76</div><div style="word-break: break-all; margin: 10px 0px;">77 &nbsp; &nbsp; &nbsp; &nbsp; //***********************************************************************</div><div style="word-break: break-all; margin: 10px 0px;">78 &nbsp; &nbsp; &nbsp; &nbsp; //将JSON字符串转为Java对象数组</div><div style="word-break: break-all; margin: 10px 0px;">79 &nbsp; &nbsp; &nbsp; &nbsp; {</div><div style="word-break: break-all; margin: 10px 0px;">80 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // (2).Bean的数组</div><div style="word-break: break-all; margin: 10px 0px;">81 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String jsonsString = "[{name:'数据库基础',price:52.3},{name:'Oracle 11g精华',price:42.3}]";</div><div style="word-break: break-all; margin: 10px 0px;">82 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JSONArray jsonArray = JSONArray.fromObject(jsonsString);</div><div style="word-break: break-all; margin: 10px 0px;">83 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //将JSON数组转为Java对象数组</div><div style="word-break: break-all; margin: 10px 0px;">84 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Book[] books = (Book[]) JSONArray.toArray(jsonArray, Book.class);</div><div style="word-break: break-all; margin: 10px 0px;">85 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (Book b : books) {</div><div style="word-break: break-all; margin: 10px 0px;">86 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(b.toString());</div><div style="word-break: break-all; margin: 10px 0px;">87 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">88</div><div style="word-break: break-all; margin: 10px 0px;">89 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //结果：</div><div style="word-break: break-all; margin: 10px 0px;">90 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //数据库基础 52.3</div><div style="word-break: break-all; margin: 10px 0px;">91 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Oracle 11g精华 42.3</div><div style="word-break: break-all; margin: 10px 0px;">92 &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">93 &nbsp; &nbsp; }</div><div style="word-break: break-all; margin: 10px 0px;">94 }</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<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; font-size: 11.818181991577148px;"><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;">1 //Jquery提供的获取json的方法</div><div style="word-break: break-all; margin: 10px 0px;">2 //使用前先导入Jquery</div><div style="word-break: break-all; margin: 10px 0px;">3</div><div style="word-break: break-all; margin: 10px 0px;">4 $('#button').click(function(){</div><div style="word-break: break-all; margin: 10px 0px;">5 &nbsp; &nbsp; //url:请求的地址</div><div style="word-break: break-all; margin: 10px 0px;">6 &nbsp; &nbsp; $.getJSON('url', {</div><div style="word-break: break-all; margin: 10px 0px;">7 &nbsp; &nbsp; &nbsp; &nbsp; //id是需要传的参数</div><div style="word-break: break-all; margin: 10px 0px;">8 &nbsp; &nbsp; &nbsp; &nbsp; id: 1</div><div style="word-break: break-all; margin: 10px 0px;">9 &nbsp; &nbsp; &nbsp; &nbsp; }, function(data) {//成功后data即为获取的json字符串</div><div style="word-break: break-all; margin: 10px 0px;">10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //例如data：[{"name":"高等数学I","price":34.1},{"name":"线性代数","price":12.7}]</div><div style="word-break: break-all; margin: 10px 0px;">11 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert("第二本书是："+data[1].name+" &nbsp;价格是："+data[1].price);</div><div style="word-break: break-all; margin: 10px 0px;">12 &nbsp; &nbsp; &nbsp; &nbsp; });</div><div style="word-break: break-all; margin: 10px 0px;">13 });</div></td></tr></tbody></table></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/414694.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-13 10:09 <a href="http://www.blogjava.net/qileilove/archive/2014/06/13/414694.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>前端自动化测试工具doh学习总结（一）</title><link>http://www.blogjava.net/qileilove/archive/2014/05/29/414238.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 29 May 2014 03:42:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/05/29/414238.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/414238.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/05/29/414238.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/414238.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/414238.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;">　前言</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;">　　项目中需要用到前端<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;">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>。一开始研究的是的selenium，但由于项目使用了大量的dijit控件，写起testCase来很费劲；最主要的是selenium有严重的浏览器兼容性问题，于是彻底放弃，改投doh门下，毕竟是dojo他爸爸开发的跟dojo继承起来非常方便。这几篇主要介绍doh、doh/Robot以及将doh与selenium结合进而与CI工具集成起来。</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;">　一、DOH 是什么</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;">　　DOH 是 Dojo Objective Harness 的简称，是 Dojo 在 0.9 版本之后新增的<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>工具。随着 Javascript 代码的数量和复杂度的增加，Web 前端开发者也需要一个 Javascript 代码的单元测试框架来保证自己写出来的 Javascript 代码是健壮的。所以，DOH 是 Web 前端开发者对&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;">JUnit</strong></u></a>&nbsp;的回应。DOH有如下特点：</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;">　　提供用户界面：JUnit中的红条测试失败、绿条测试通过，大家都已经很熟悉了，DOH也有类似的用户界面，用户在测试时更加一目了然；</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;">　　平台无关：DOH并不依赖某种浏览器平台，甚至不依赖于浏览器；用户可以根据自己的需要在命令行进行Javascript的自动化单元测试；</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;">　　支持Ajax：Ajax编程在Web前端开发中是必不可少的一环，DOH最有价值的一个特性就是支持Ajax的测试；</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;">　　不只适合与于Dojo，可用于任何JavaScript程序的单元测试。</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;">　　下载dojo源码包，解压后可以看到以下目录：</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; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46093" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/05/14982672_201405281543051jGoa.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;">　　<strong style="word-break: break-all; line-height: normal !important;">二、DOH第一次亲密接触</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;">　　部署到服务器后，我们访问runner.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; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46094" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/05/14982672_201405281543052eyv0.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;">　　与JUnit类似，DOH也为我们提供了一个类似的界面，左侧表示运行的测试案例，右侧是测试日志，最上方的进度条表示的是本次运行中的已执行案例，同样绿色表示成功，红色表示失败。默认情况下会加载&#8220;dojo/tests/module.js&#8221;文件，该文件的作用就是像runner.html中加载dojo所有核心模块的测试案例。</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; text-align: center; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46095" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/05/14982672_2014052815430533Dud.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 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>参数指向该模块：</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;">　　http://&lt;server&gt;/util/doh/runner.html?test=dojo/tests/fx</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; text-align: center; background-color: #ffffff;"><font color="#202859"><span style="line-height: normal !important;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/05/14982672_201405281543054U3fL.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></span></font><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">我们可以吧测试案例放到自己的项目目录下，通过test参数指向自定义测试模块，这时需要用到paths参数：</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　util/doh/runner.html?paths=org/myorg,../../../mycode/org/myorg&amp;test=org/myorg/mymodule/tests/alltests</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　paths参数中逗号前后的值相当于dojoConfig定义packages对象时的name和location</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px;"><font color="#202859"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/05/14982672_20140528154305515Cs.jpg" border="0" style="word-break: break-all; list-style: none outside none; margin: 0px; padding: 0px; border: none; max-width: 500px;"  alt="" /></a></font></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　同样在path中我们可以定义多个模块， 模块之间用&#8220;;&#8221;分隔开来</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　util/doh/runner.html?paths=org/myorg,../../../mycode/org/myorg;com/mycom,../../../x/com/mycom&amp;test=com/mycom/tests</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　doh中测试模块要么是一个用来请求多个测试文件的文件，要么是一个使用doh.register方法注册时测试案例，或者两者皆有。</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　define([</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　"my/test/widget/Foo0",</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　"my/test/widget/Foo1",</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　"my/test/widget/Foo2"</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　]);</a></div><div style="word-break: break-all; color: #333333; text-decoration: none; line-height: normal !important; margin: 10px 0px; font-size: 11.818181991577148px; text-align: left;"><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　或者</a></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: 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; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">define(["doh/runner"], function(doh){</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.register("MyTests", [</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">function assertTrueTest(){</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertTrue(true);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertTrue(1);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertTrue(!false);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">},</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">{</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">name: "thingerTest",</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">setUp: function(){</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">this.thingerToTest = new Thinger();</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">this.thingerToTest.doStuffToInit();</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">},</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">runTest: function(){</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertEqual("blah", this.thingerToTest.blahProp);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertFalse(this.thingerToTest.falseProp);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">// ...</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">},</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">tearDown: function(){</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">}</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">},</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">// ...</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">]);</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">});</a></div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　<strong style="word-break: break-all;">　三、测试用例</strong></a></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　doh为我们提供了以下断言函数：</a></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: 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; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertTrue(boolean)</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">Note: This function is aliased to doh.t();</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertFalse(boolean)</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">Note: This function is aliased to doh.f();</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertEqual(obj1, obj2)</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">Note: This function is aliased to doh.is();</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">doh.assertNotEqual(obj1, obj2)</a></div><div style="word-break: break-all; margin: 10px 0px; background-color: #ffffff;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">Note: This function is aliased to doh.isNot()；</a></div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: normal !important; margin: 10px 0px;"><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;">　　Junit中，编写一个测试用例我们需要继承Junit类，同样在doh中也有自己的规则来将一段代码，包装成doh可识别的测试案例。</a><span style="font-size: 11.818181991577148px; line-height: 21.60000228881836px;">　doh中主要提供了以下方法（最常用的就是doh.register）：</span><a href="http://www.51testing.com/batch.download.php?aid=46096" target="_blank"></a></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; 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;">doh.register(...)</div><div style="word-break: break-all; margin: 10px 0px;">An almost 'magical' function. The doh.register() method accepts the function signatures of any of the other registration functions and determines the correct underlying function (listed below) to dispatch registration to. It's the function you'll most commonly use for registering Unit Tests.</div><div style="word-break: break-all; margin: 10px 0px;">doh.registerTest(group, testFuncOrObj)</div><div style="word-break: break-all; margin: 10px 0px;">This function registers a test as a member of the group 'group', and the test can either be a simple function definition or a 'Test Fixture', which is an object that defines the run requirements of the test.</div><div style="word-break: break-all; margin: 10px 0px;">doh.registerTests(group, testFuncOrObjArr)</div><div style="word-break: break-all; margin: 10px 0px;">This function registers an array of tests as a member of the group 'group'. The contents of the array of tests can be an array of simple test functions or an array of 'test fixtures', or a mix of them.</div><div style="word-break: break-all; margin: 10px 0px;">doh.registerTestNs(group, obj)</div><div style="word-break: break-all; margin: 10px 0px;">This function registers an object comprised of functions as a member of the group 'group'. Note that this function will only add in non-private (functions without an _ at the beginning of the name), as a test function. If you'd like to use fixtures (setUp(), tearDown(), and runTest()), please use doh.register(), doh.registerTest() or doh.registerTests().</div><div style="word-break: break-all; margin: 10px 0px;">doh.registerTestUrl(url)</div><div style="word-break: break-all; margin: 10px 0px;">This function registers a URL as a location to load tests from. The URL is used to populate the contents of an iframe, and usually refers to an HTML page that boot-loads D.O.H. internally for running tests in a segmented iframe. A good example showing this is the dojo/tests/fx.html. It loads dojo, doh, and then on dojo load completion calls doh.registerTests(). The D.O.H. instance in the iframe will proxy back the results of the test run to the primary D.O.H. instance.</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　上面提到的dojo/test/fx模块中我们可以看到该文件中主要定义了两个TestSuite：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　define(["doh/main", "require"], function(doh, require){</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　if(doh.isBrowser){</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　doh.register("tests.fx", require.toUrl("./fx.html"), 30000);</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　doh.register("tests.NodeList-fx", require.toUrl("./NodeList-fx.html"), 30000);</div><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;">　　});</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　对应于runner.html中</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=46098" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/05/14982672_201405281543056Np1r.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; font-size: 11.818181991577148px;">　　打开该目录下的fx.html文件，我们可以看到该文件中定义了一系列TestCase</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=46099" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/05/14982672_2014052815430579mRD.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; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">doh中有两种测试结构：</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　1、Simple Tests &nbsp;将一个单独的函数放到doh.register参数testCase数组里</div><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;">　　function mySimpleTest(doh){</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　doh.assertTrue(true);</div><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;">　　异步形式：</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; 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;">function mySimpleAsyncTest(doh){</div><div style="word-break: break-all; margin: 10px 0px;">var deferred = new doh.Deferred();</div><div style="word-break: break-all; margin: 10px 0px;">setTimeout(deferred.getTestCallback(function(){</div><div style="word-break: break-all; margin: 10px 0px;">doh.assertTrue(true);</div><div style="word-break: break-all; margin: 10px 0px;">}), 100);</div><div style="word-break: break-all; margin: 10px 0px;">return deferred;</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;">　　2、Test Fixture</div><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;"><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;">{</div><div style="word-break: break-all; margin: 10px 0px;">name: "thingerTest",</div><div style="word-break: break-all; margin: 10px 0px;">setUp: function(){</div><div style="word-break: break-all; margin: 10px 0px;">// Setup to do before runTest.//类似于JUnit中的@beforeTest</div><div style="word-break: break-all; margin: 10px 0px;">this.thingerToTest = new Thinger();</div><div style="word-break: break-all; margin: 10px 0px;">this.thingerToTest.doStuffToInit();</div><div style="word-break: break-all; margin: 10px 0px;">},</div><div style="word-break: break-all; margin: 10px 0px;">runTest: function(){</div><div style="word-break: break-all; margin: 10px 0px;">// Our test function to run.//类似于JUnit中的@Test</div><div style="word-break: break-all; margin: 10px 0px;">doh.assertEqual("blah", this.thingerToTest.blahProp);</div><div style="word-break: break-all; margin: 10px 0px;">doh.assertFalse(this.thingerToTest.falseProp);</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;">tearDown: function(){</div><div style="word-break: break-all; margin: 10px 0px;">// cleanup to do after runTest.//类似于JUnit中的@afterTest</div><div style="word-break: break-all; margin: 10px 0px;">},</div><div style="word-break: break-all; margin: 10px 0px;">timeout: 3000 // 3 second timeout.//测试运行时间，超过改时间会报错</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 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; 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;">name: "thingerTest",</div><div style="word-break: break-all; margin: 10px 0px;">setUp: function(){</div><div style="word-break: break-all; margin: 10px 0px;">// Setup to do before runTest.</div><div style="word-break: break-all; margin: 10px 0px;">this.thingerToTest = new Thinger();</div><div style="word-break: break-all; margin: 10px 0px;">this.thingerToTest.doStuffToInit();</div><div style="word-break: break-all; margin: 10px 0px;">},</div><div style="word-break: break-all; margin: 10px 0px;">runTest: function(){</div><div style="word-break: break-all; margin: 10px 0px;">// Our test function to run.</div><div style="word-break: break-all; margin: 10px 0px;">var deferred = new doh.Deferred();</div><div style="word-break: break-all; margin: 10px 0px;">setTimeout(deferred.getTestCallback(function(){</div><div style="word-break: break-all; margin: 10px 0px;">doh.assertEqual("blah", this.thingerToTest.blahProp);</div><div style="word-break: break-all; margin: 10px 0px;">doh.assertFalse(this.thingerToTest.falseProp);</div><div style="word-break: break-all; margin: 10px 0px;">}), 100);</div><div style="word-break: break-all; margin: 10px 0px;">return deferred;</div><div style="word-break: break-all; margin: 10px 0px;">},</div><div style="word-break: break-all; margin: 10px 0px;">tearDown: function(){</div><div style="word-break: break-all; margin: 10px 0px;">// cleanup to do after runTest.</div><div style="word-break: break-all; margin: 10px 0px;">},</div><div style="word-break: break-all; margin: 10px 0px;">timeout: 3000 // 3 second timeout.</div><div style="word-break: break-all; margin: 10px 0px;">}</div></td></tr></tbody></table></div></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/414238.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-29 11:42 <a href="http://www.blogjava.net/qileilove/archive/2014/05/29/414238.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web应用功能测试测试点</title><link>http://www.blogjava.net/qileilove/archive/2014/05/26/414091.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 26 May 2014 02:16:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/05/26/414091.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/414091.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/05/26/414091.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/414091.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/414091.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;">　做了几年的<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>，也经手了好几个Web应用的项目，在做项目当中积累了一些经验。在这里我对通用一些功能模块的测试点做个记录，一来梳理一下<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;">　　<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;">　　（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;">　　（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;">　　（3）按[Tab]键，光标是否能够按照从左到右，由上到下的顺序在输入域间切换；</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;">　　（4）单击[Enter]，检查是否相当于单击了[注册]按钮，将注册信息提交到系统中；</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;">　　（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;">　　（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;">　　（7）用户名大小写校验：若有已注册用户&#8220;abc&#8221;，输入用户名&#8220;ABC&#8221;和正确的密码也可以成功登录；若以用户名&#8220;Abc&#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;">　　（8）输入字符数等于域允许的最大字符数，检查系统是否能正确保存该信息；</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;">　　（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;">　　（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;">　　（11）输入的确认密码与设置密码不一致，检查系统是否做了密码校验；</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;">　　（12）在&#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;">　　（13）过期处理：在注册页面填写所有的注册信息，之后停留30分钟，再单击[注册]按钮，系统提示网页已过期；</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;">　　（14）页面切换校验：在用户注册页面输入所有所需的用户信息，单击浏览器工具栏上的[后退]按钮，然后再单击[前进]按钮，系统进入到&#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;">　　<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;">　　（1）回车验证：填入管理员帐号和密码，直接按[Enter]键，相当于单击了[登录]键；</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;">　　（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;">　　（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;">　　（4）注入式登录：利用sql漏洞，使用不存在的用户登录。如用户名输入为admin'OR'1'='1，密码输入为x'OR'1'='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;">　　（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;">　　（6）Tab验证：按[Tab]键光标应该能够按照从左到右，由上到下的顺序在输入域间切换。</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;">　<strong style="word-break: break-all; line-height: normal !important;">　3. 注册用户登录</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;">　　（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;">　　（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;">　　（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;">　　（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;">　　（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;">　　（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;">　　（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;">　　（8）注入式登录：同管理员登录；</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;">　　（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;">　　（10）Tab键验证：同管理员登录。<br /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;">4. 修改注册信息</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（1）不修改直接按&#8220;保存&#8221;，检查是否保存成功；</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）在修改的状态下，将某个必填项置为空，检查系统是否对必填项为空的情况做了处理；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（4）在修改的状态下，将某个必填项中仅输入空格，检查系统是否能够正确处理；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（5）输入字符数等于域允许的最大字符数，检查系统是否能正确保存该信息；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（6）输入字符数大于域允许 的最大字符数，检查系统是否对域输入长度进行验证，并对超过的字符做合理的处理；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（7）按[Tab]键，光标是否能够按照从左到右，由上到下的顺序在输入域间切换；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（8）单击[Enter]，检查是否相当于单击了[修改]按钮，将信息提交到系统中；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（9）检查系统是否对用户名中的空格做处理；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（10）输入特殊字符，系统应该对特殊字符做合理的处理；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（11）输入的确认密码与设置密码不一致，检查系统是否做了密码校验；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（12）在&#8220;密码&#8221;和&#8220;确认密码&#8221;输入域里输入密码，均未显示明文；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（13）页面切换校验：在修改的状态下，单击浏览器工具栏上的[后退]按钮，然后再单击[前进]按钮，系统进入到&#8220;用户信息&#8221;页面，密码和确认密码输入域应该被清空，其它输入域的信息仍然被保留；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（14）过期处理：在注册页面填写所有的注册信息，之后停留30分钟，再单击[注册]按钮，系统提示网页已过期。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">5. 一些属于UI测试的测试点</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（1）按钮状态是否正确：与正在进行的操作无关的按钮应该加以屏蔽；</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）重要按钮的摆放位置是否合适：重要的命令按钮与使用较频繁的按钮要放在界面上醒目的位置；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（4）关闭错误提示后的光标定位：关闭用户输入错误的提示信息后，光标应定位到对应的输入框中；</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　（5）非法访问：未登录直接访问（复制需要登录后才可以访问的页面的URL）。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">版权声明：本文出自 jrjiarui 的51Testing软件测试博客：http://www.51testing.com/?362432</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/414091.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-26 10:16 <a href="http://www.blogjava.net/qileilove/archive/2014/05/26/414091.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>UI测试常用技巧</title><link>http://www.blogjava.net/qileilove/archive/2014/05/04/413207.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Sun, 04 May 2014 04:59:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/05/04/413207.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/413207.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/05/04/413207.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/413207.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/413207.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;">　　如何在当前界面中查找第一个ListView中的带有文本属性为Apps的子控件。</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;">UiObjectappItem=newUiObject(newUiSelector()</div><div style="word-break: break-all; margin: 10px 0px;">.className("<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">android</strong></u></a>.widget.ListView").instance(1)</div><div style="word-break: break-all; margin: 10px 0px;">.childSelector(newUiSelector().text("Apps")));</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;">　　如何查找当前显示界面中的取消按钮和确认按钮：</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;">　　UiObjectcancelButton=newUiObject(newUiSelector().text("Cancel"));</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;">　　UiObjectokButton=newUiObject(newUiSelector().text("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;">　　查找到的UiObject实例可以在其他<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>代码中重用。需要注意的是：每次使用UiObject做操作的时候uiautomator都会在当前屏幕重新查找该控件。</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;">　　如下代码uiautomator工具在当前界面查找文本内容为&#8220;OK&#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;"><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;">if(okButton.exists()&amp;&amp;okButton.isEnabled())</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">okButton.click();</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; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　还可以限制仅仅查找特定类型的控件。例如如下代码只查找文本为&#8220;Cancel&#8221;和&#8220;OK&#8221;的android.widget.Button类型控件。</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;">UiObjectcancelButton=newUiObject(newUiSelector().text("Cancel")</div><div style="word-break: break-all; margin: 10px 0px;">.className("android.widget.Button"));</div><div style="word-break: break-all; margin: 10px 0px;">UiObjectokButton=newUiObject(newUiSelector().text("OK")</div><div style="word-break: break-all; margin: 10px 0px;">.className("android.widget.Button"));</div><div style="word-break: break-all; margin: 10px 0px;">UiCollection</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;">　　代表控件的集合。获取UiCollection的方式和UiObject一样，通过UiSelector查找。UiCollection对应Android系统中的ViewGroup以及子控件。</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;">　　如下代码演示如何通过UiSelector来获取包含视频集合的UiCollection。</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;">　　UiCollectionvideos=newUiCollection(newUiSelector()</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;">　　.className("android.widget.FrameLayout"));</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;">　　如果每个视频是放到LinearLayout中的，则可以通过如下方式获取视频的数目：</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;">　　intcount=videos.getChildCount(newUiSelector()</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;">　　.className("android.widget.LinearLayout"));</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;CuteBabyLaughing&#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;"><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;">UiObjectvideo=videos.getChildByText(newUiSelector()</div><div style="word-break: break-all; margin: 10px 0px;">.className("android.widget.LinearLayout"),"CuteBabyLaughing");</div><div style="word-break: break-all; margin: 10px 0px;">video.click();</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;">　　同样还可以模拟其他用户操作。例如，模拟选择视频的操作如下：</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;">UiObjectcheckBox=video.getChild(newUiSelector()</div><div style="word-break: break-all; margin: 10px 0px;">.className("android.widget.Checkbox"));</div><div style="word-break: break-all; margin: 10px 0px;">if(!checkBox.isSelected())checkbox.click();</div><div style="word-break: break-all; margin: 10px 0px;">UiScrollable</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;">　　代表可滚动的控件。可以用UiScrollable来模拟水平或者垂直滚动的UI元素。如果需要操作的元素在屏幕外需要滚动屏幕才能看到的情况下需要使用UiScrollable。</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;Settings&#8221;菜单并点击&#8220;Abouttablet&#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;"><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;">UiScrollablesettingsItem=newUiScrollable(newUiSelector()</div><div style="word-break: break-all; margin: 10px 0px;">.className("android.widget.ListView"));</div><div style="word-break: break-all; margin: 10px 0px;">UiObjectabout=settingsItem.getChildByText(newUiSelector()</div><div style="word-break: break-all; margin: 10px 0px;">.className("android.widget.LinearLayout"),"Abouttablet");</div><div style="word-break: break-all; margin: 10px 0px;">about.click()</div></td></tr></tbody></table></div><img src ="http://www.blogjava.net/qileilove/aggbug/413207.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-04 12:59 <a href="http://www.blogjava.net/qileilove/archive/2014/05/04/413207.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试—性能环境与数据</title><link>http://www.blogjava.net/qileilove/archive/2014/05/04/413203.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Sun, 04 May 2014 04:56:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/05/04/413203.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/413203.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/05/04/413203.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/413203.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/413203.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>人员很重要的一个问题。如何模拟线上真实的环境？如何在测试环境进行的性能测试结果，能准确的反应到生产线上去？</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;"><a href="http://www.51testing.com/batch.download.php?aid=45511" 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_201404231110371pchw.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，而服务器A需要依赖到服务器B和C提供的服务，而服务器C与DB存储打交道。那么在性 能测试环境，为了模拟用户的行为，需要搭建服务器A,B,C和DB各一台。通过对单台服务器A的压测结果TPS，再线性乘以机器数量，完成线上服务器A集 群的TPS的评估。</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;">　　硬件方面，比如机器是4核4G的xen虚拟机，千兆网卡，SATA磁盘。</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>的版本，位数，比如：redhat 5.4，**位机器；JDK版本：openJDK 1.6.0；JVM参数配置；<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>容器：tomcat7.</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;">　　性能测试<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：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个部分。1是业务数据，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，有100个商品。100就是业务数据。基础数据就是商品所在表的总数据量。比如100W。</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;">　　性能测试的数据，不光要关注业务，更要关注数据库表的量级，因为100条数据，和100W条数据，性能测试出来完全是两个结果。</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;">　<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;">　　每个公司的业务不同，系统架构也不同，所以性能测试环境方面肯定有很大的差异。我只是简单的写了我所在公司的性能环境的一些知识，分享给大家，供大家一个参考，希望你能从这里获得有用的东西。关于性能测试环境，我的一些观点：</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. 测试环境的配置可以与线上一样，可以做下N：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;">　　3. 真没条件，线上线下环境差异很大。就尽量找一些代码级别的性能瓶颈。优化后再上线，线下的结果就不用去推算线上，很不科学</div><img src ="http://www.blogjava.net/qileilove/aggbug/413203.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-04 12:56 <a href="http://www.blogjava.net/qileilove/archive/2014/05/04/413203.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web Api单元测试写法</title><link>http://www.blogjava.net/qileilove/archive/2014/05/04/413204.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Sun, 04 May 2014 04:56:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/05/04/413204.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/413204.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/05/04/413204.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/413204.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/413204.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;">　例如我们在Web Api项目中有个Controller</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;">public class SomeController : ApiController</div><div style="word-break: break-all; margin: 10px 0px;">{</div><div style="word-break: break-all; margin: 10px 0px;">public HttpResponseMessage Get()</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;">return Request.CreateResponse(HttpStatusCode.OK, someModel);</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; 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>中直接调用 SomeController 的Get()方法，那么你将会收到一个Exception提示Request为Null。</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;">　　因此我们需要在测试代码中构造一个Request，有两种方法</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; 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;">[TestMethod]</div><div style="word-break: break-all; margin: 10px 0px;">public void UnitTestMethod()</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;">YourNameSpace.Controllers.SomeController controller = new SomeController();</div><div style="word-break: break-all; margin: 10px 0px;">// 下面两个语句是构造一个简单的请求报文</div><div style="word-break: break-all; margin: 10px 0px;">controller.Request = new HttpRequestMessage();</div><div style="word-break: break-all; margin: 10px 0px;">controller.Request.SetConfiguration(new HttpConfiguration());</div><div style="word-break: break-all; margin: 10px 0px;">var result = controller.Get();</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; 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;"><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;">[TestMethod]</div><div style="word-break: break-all; margin: 10px 0px;">public void UnitTestMethod()</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;">YourNameSpace.Controllers.SomeController controller = new SomeController();</div><div style="word-break: break-all; margin: 10px 0px;">var config = new HttpConfiguration();</div><div style="word-break: break-all; margin: 10px 0px;">var request = new HttpRequestMessage(HttpMethod.Post, "YourUrl");</div><div style="word-break: break-all; margin: 10px 0px;">var route = config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}");</div><div style="word-break: break-all; margin: 10px 0px;">var routeData = new HttpRouteData(route, new HttpRouteValueDictionary { { "controller", "products" } });</div><div style="word-break: break-all; margin: 10px 0px;">controller.ControllerContext = new HttpControllerContext(config, routeData, request);</div><div style="word-break: break-all; margin: 10px 0px;">controller.Request = request;</div><div style="word-break: break-all; margin: 10px 0px;">controller.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config;</div><div style="word-break: break-all; margin: 10px 0px;">var result = controller.Get();</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; 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/413204.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-04 12:56 <a href="http://www.blogjava.net/qileilove/archive/2014/05/04/413204.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>PAAS平台的web应用性能测试与分析</title><link>http://www.blogjava.net/qileilove/archive/2014/04/29/413028.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Tue, 29 Apr 2014 02:46:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/29/413028.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/413028.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/29/413028.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/413028.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/413028.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;">引言</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;">　　为什么我会写这一篇博客，因为最近很多京东云擎jae的用户反应一个问题就是他们部署在jae上面的应用访问很慢，有极少数应用甚至经常出现504超时现象，当然大家首先想到的是jae性能太差，这也是人之常情，往往出现什么错误的时候首先想到是别人的不好，<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>中很多同事也是这样，如果软件系统出现一个bug首先怀疑的肯定不是自己写的代码。今天花时间写这一篇博客主要就是告诉大家怎样确定我们部署在PAAS平台（不仅仅是JAE哦）<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;">　　<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;">　　出现访问自己web应用慢从宏观上可以总结为下面三点：</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）网络慢：具体来说就是访问者同部署web应用的PAAS平台之间的网络慢;</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）PAAS平台性能出现问题：具体来说就是由于各种原因导致PAAS平台不能很好服务部署在它上面的应用;</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）web应用本身慢：由于各种原因（频繁读写磁盘，大量耗时的计算，资源竞争等）导致web应用不能很快的响应访问者的请求。</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应用的访问路径，因为访问PAAS平台的web应用首先需要经过网络，然后经过PAAS平台的过滤和转发等处理，最后才到达web应用本身处理。这三个环节任何一个出现问题都会导致web应用访问变慢。知道原因了，我们还需要判断到底是哪一个环节出现了问题，下面就说说怎样定位具体的环节。</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;">　　上面分析的三个原因除了第二个原因以外，大家都可以自己定位和排除，首先检查网络，为了更加准确我们可以从一下方面进行排除：</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）访问对应PAAS平台提供的相关网站和PAAS平台所属公司的网站，例如JAE，你可以访问京东商城主站和京东云平台首页等，BAE可以访问<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>相关网站，SAE可以访问新浪相关网站，因为这些关联网站一般部署在同一个机房或者同一个城市，如果这些网站也很慢，那多半说明这些网站相关机房网络出现问题或者访问量很大，导致这些网站对外出口流量和访问速度变慢，也就是对外提供服务的能力扛不住了，如果没有问题，那么可以排除大的网络环境是没有问题的;</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;">　　排除了网络因素，我们就可以排除后面两个原因了，由于PAAS平台的性能对用户基本上是透明的，就是用户基本上无从得知，所以可以直接跳过这个原因的排除，当然其实是有手段的，只是稍微复杂，所以不方便所有用户，如果是这种原因最好还是交给PAAS平台的开发人员去处理。</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应用自身的实现了，我发现很多用户反馈的网站访问慢的原因都是由于自己代码实现的问题。</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性能<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>工具做验证即可，例如比较常用的web性能测试工具ab，这个事apache自带的测试工具，ubuntu下安装和使用都非常方便，例如我们直接在控制台中输入ab，如果没有安装，ubuntu系统会如下提示：</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;">　　The program 'ab' is currently not installed. &nbsp;You can install it by typing:</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;">　　sudo apt-get install apache2-utils</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;">　　然后安装提示安装即可，安装成功以后我们就可以使用ab软件对我们部署在本地的web应用进行<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;">　　ab -n1000 -c10 http://localhost/</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;">　　上面命令的意思是总共发送1000次请求，每次10各并发请求，访问的路径就是本地web服务器的根路径，结果如下：</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;">This is ApacheBench, Version 2.3 &lt;$Revision: 1430300 $&gt;</div><div style="word-break: break-all; margin: 10px 0px;">Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/</div><div style="word-break: break-all; margin: 10px 0px;">Licensed to The Apache Software Foundation, http://www.apache.org/</div><div style="word-break: break-all; margin: 10px 0px;">Benchmarking localhost (be patient)</div><div style="word-break: break-all; margin: 10px 0px;">Completed 100 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 200 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 300 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 400 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 500 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 600 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 700 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 800 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 900 requests</div><div style="word-break: break-all; margin: 10px 0px;">Completed 1000 requests</div><div style="word-break: break-all; margin: 10px 0px;">Finished 1000 requests</div><div style="word-break: break-all; margin: 10px 0px;">Server Software: &nbsp; &nbsp; &nbsp; &nbsp;Apache/2.4.6</div><div style="word-break: break-all; margin: 10px 0px;">Server Hostname: &nbsp; &nbsp; &nbsp; &nbsp;localhost</div><div style="word-break: break-all; margin: 10px 0px;">Server Port: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;80</div><div style="word-break: break-all; margin: 10px 0px;">Document Path: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/</div><div style="word-break: break-all; margin: 10px 0px;">Document Length: &nbsp; &nbsp; &nbsp; &nbsp;177 bytes</div><div style="word-break: break-all; margin: 10px 0px;">Concurrency Level: &nbsp; &nbsp; &nbsp;10</div><div style="word-break: break-all; margin: 10px 0px;">Time taken for tests: &nbsp; 0.075 seconds</div><div style="word-break: break-all; margin: 10px 0px;">Complete requests: &nbsp; &nbsp; &nbsp;1000</div><div style="word-break: break-all; margin: 10px 0px;">Failed requests: &nbsp; &nbsp; &nbsp; &nbsp;0</div><div style="word-break: break-all; margin: 10px 0px;">Write errors: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0</div><div style="word-break: break-all; margin: 10px 0px;">Total transferred: &nbsp; &nbsp; &nbsp;446000 bytes</div><div style="word-break: break-all; margin: 10px 0px;">HTML transferred: &nbsp; &nbsp; &nbsp; 177000 bytes</div><div style="word-break: break-all; margin: 10px 0px;">Requests per second: &nbsp; &nbsp;13283.74 [#/sec] (mean)</div><div style="word-break: break-all; margin: 10px 0px;">Time per request: &nbsp; &nbsp; &nbsp; 0.753 [ms] (mean)</div><div style="word-break: break-all; margin: 10px 0px;">Time per request: &nbsp; &nbsp; &nbsp; 0.075 [ms] (mean, across all concurrent requests)</div><div style="word-break: break-all; margin: 10px 0px;">Transfer rate: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5785.69 [Kbytes/sec] received</div><div style="word-break: break-all; margin: 10px 0px;">Connection Times (ms)</div><div style="word-break: break-all; margin: 10px 0px;">min &nbsp;mean[+/-sd] median &nbsp; max</div><div style="word-break: break-all; margin: 10px 0px;">Connect: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; 0.1 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 1</div><div style="word-break: break-all; margin: 10px 0px;">Processing: &nbsp; &nbsp; 0 &nbsp; &nbsp;1 &nbsp; 0.2 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 2</div><div style="word-break: break-all; margin: 10px 0px;">Waiting: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; 0.2 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 2</div><div style="word-break: break-all; margin: 10px 0px;">Total: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;1 &nbsp; 0.1 &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; 2</div><div style="word-break: break-all; margin: 10px 0px;">ERROR: The median and mean for the processing time are more than twice the standard</div><div style="word-break: break-all; margin: 10px 0px;">deviation apart. These results are NOT reliable.</div><div style="word-break: break-all; margin: 10px 0px;">Percentage of the requests served within a certain time (ms)</div><div style="word-break: break-all; margin: 10px 0px;">50% &nbsp; &nbsp; &nbsp;1</div><div style="word-break: break-all; margin: 10px 0px;">66% &nbsp; &nbsp; &nbsp;1</div><div style="word-break: break-all; margin: 10px 0px;">75% &nbsp; &nbsp; &nbsp;1</div><div style="word-break: break-all; margin: 10px 0px;">80% &nbsp; &nbsp; &nbsp;1</div><div style="word-break: break-all; margin: 10px 0px;">90% &nbsp; &nbsp; &nbsp;1</div><div style="word-break: break-all; margin: 10px 0px;">95% &nbsp; &nbsp; &nbsp;1</div><div style="word-break: break-all; margin: 10px 0px;">98% &nbsp; &nbsp; &nbsp;1</div><div style="word-break: break-all; margin: 10px 0px;">99% &nbsp; &nbsp; &nbsp;1</div><div style="word-break: break-all; margin: 10px 0px;">100% &nbsp; &nbsp; &nbsp;2 (longest request)</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;">　　Requests per second，从结果看这个值是13283.74 [#/sec] (mean)，表示每一秒钟可以处理13283.74各请求，因为我这个很简单的一个静态页面（就是apache服务器安装后默认的首页），所以看起很不错，而且是通过本地localhost，没有经过网络。我们可以改变访问的条件持续做很多组测试，例如我把并发请求数改为100,即-c100,得到参数值为：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Requests per second: &nbsp; &nbsp;11843.29 [#/sec] (mean)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　明显比上面减少了一些，继续改总请求数为10000,并发数1000,即-n10000 -c1000得到如下值：</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Requests per second: &nbsp; &nbsp;747.98 [#/sec] (mean)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　这个时候减少的相当的可怕了，所以通过这个ab测试工具就能够知道我们的web应用能够承担多少的并发访问，当然我们可以通过不断的挑战参数进行测试，然后绘制成一个曲线图观察就很方便看出我们web应用的最佳性能点，超过那么最佳性能点可能就导致性能下降，那么访问速度也就跟着下降了。</div><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;">　　Time per request: &nbsp; &nbsp; &nbsp; 0.753 [ms] (mean)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Time per request: &nbsp; &nbsp; &nbsp; 8.444 [ms] (mean)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　Time per request: &nbsp; &nbsp; &nbsp; 1336.942 [ms] (mean)</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　从三次测试可以看出，随着并发数的增长，一个用户平均等待的时间也在变长，这个最终就反应到用户web访问的结果（速度的快慢），这里测试的只是一个简单的静态网页，如果是复杂的动态网页（例如访问数据库，读写磁盘和大量的计算等）那么就更加复杂了，一个请求的快慢由于web应用需要处理的业务逻辑有很大的关系，当然怎样让这些业务逻辑执行更快并且并行执行，这个就需要程序实现者考虑了。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　<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; font-size: 11.818181991577148px;">　　这里只是简单介绍了部署在PAAS平台web应用访问很慢的可能原因和简单定位方法，起始我觉得大家应该中的关注在第三点上，自身应用的优化，因为前面两点都是我们不可控的，网络这个PAAS平台自身也解决不了，最多可以部署多个机房多个宽带运营商和cdn处理等，但是用户自身的网络问题PAAS平台也是解决不了的。至于PAAS平台自身的原因，大家就更不用担心了，他们比你们更关系自身PAAS平台的性能，因为上面托管着成千上万的web应用，他们时时刻刻都在关系着自身平台的性能拼劲，想着各种方法优化。如果PAAS平台的原因导致用户部署的web应用访问很慢甚至不可用那么这个PAAS平台自身也做不下去的。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　最后还想强调一点就是web应用自身的性能优化问题，现在各种语言都提供了很好的开发框架，理论上都是稳定的并且性能是不错的，当然特殊场景需要特殊考虑。但是我们自身在设计web应用的时候可能需要考虑的更多，不要妄想一个简单的开发框架就能解决所有的问题，尤其是性能问题。设计到web应用优化的知识和技术非常的多也非常的复杂，还有很多场景，所以这是各长久的过程。后面有机会也会给大家介绍一些web性能优化的方法和技术，并且结合实际场景进行分析和演练。</div></div><img src ="http://www.blogjava.net/qileilove/aggbug/413028.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-29 10:46 <a href="http://www.blogjava.net/qileilove/archive/2014/04/29/413028.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能分析软件之yourkit入门介绍</title><link>http://www.blogjava.net/qileilove/archive/2014/04/28/412996.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 28 Apr 2014 02:30:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/28/412996.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412996.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/28/412996.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412996.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412996.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;">安装、运行，</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 下载windows版本的yourkit，安装并破解。</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 在本机tomcat安装yourkit插件</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 打开tomcat的环境参数配置文件catalina.bat。</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 增加<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>系统参数：</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;">　　set JAVA_OPTS=%JAVA_OPTS% -agentpath:D:/java/share/yjpagent.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;">　　yjpagent.dll从your kit的安装目录能找到，如D:\Program Files (x86)\YourKit Java Profiler 9.0.3\bin\win32下。</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;">　　请注意，不能将系统参数设置为-agentpath: D:/Program Files (x86)/YourKit Java Profiler 9.0.3/bin/win32/ yjpagent.dll,否则tomcat将无法启动，因为路径中含有空格。因此将yjpagent.dll复制到无空格的目录，如D:/java/share/yjpagent.dll。（本人当初因踩了&#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.3如果是监控远程linux上的tomcat，唯一的区别是下载linux版yourkit获取linux版的yjpagent库文件。</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 启动tomcat</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 运行your kit</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 在&#8221;show all running JVMS&#8221; 复选框打勾，能看到本机运行的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;">　　6 在列表中双击tomcat对应的进程，即可以看到your kit的监控界面。</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 看各函数cpu资源消耗比例</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.1点Cpu标签页</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在cpu 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;">　　1.3在底下的分析栏：CPU Usage Estimation，将显示该时间段各个函数cpu资源利用比例。选择函数点击能显示子函数的占用比。</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=45540" 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_201404241153481MU13.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;">　<strong style="word-break: break-all; line-height: normal !important;">2<span class="Apple-tab-span" style="word-break: break-all; white-space: pre;">	</span>分析内存</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　　2.1<span class="Apple-tab-span" style="word-break: break-all; line-height: normal !important; white-space: pre;">	</span>选择Memory 标签页</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　　2.2<span class="Apple-tab-span" style="word-break: break-all; line-height: normal !important; white-space: pre;">	</span>在底下分析栏：CPU List，能看到jvm中各类的内存占用情况，如要查询具体类可在输入类名进行模糊查看那。</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=45541" 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_201404241153531Znkp.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;"></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px; height: 21px; position: relative; width: 627.1875px;"></div></a></div><img src ="http://www.blogjava.net/qileilove/aggbug/412996.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:30 <a href="http://www.blogjava.net/qileilove/archive/2014/04/28/412996.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ubuntu下搭建jira4.2</title><link>http://www.blogjava.net/qileilove/archive/2014/04/24/412861.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 24 Apr 2014 02:24:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/24/412861.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412861.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/24/412861.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412861.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412861.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;">　由于我们的项目缺少一个bug管理系统，刚好以前用过jira，感觉很不错，就安装一个用用了，下面是安装步骤，参考了一些网上的教材，特此表示感谢。</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;">　　系统环境为ubuntu10.04+mysql5.1.14+jdk1.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;">　<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;">　　由于jira是用<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>写的，jdk当然是比不可少了；我用的是mysql数据库，所以mysql也是需要安装的，安装时注意修改编码为utf-8，后面我们会提到。</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;">　　jira现在最新的版本为4.2，可以到jira官方网站去下载，可以免费试用30天；当然，如果您喜欢，您也可以去破解。</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;">　3.安装过程</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）在/usr/local下新建一个文件夹jira，然后在jira文件夹下建立jira_home文件夹</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）复制下载后的文件atlassian-jira-enterprise-4.2-standalone.tar.gz到/usr/local/jira目录下并解压(tar xf at*.gz)</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）安装mysql，并修改/etc/mysql/my.cnf文件，在[mysql]和[mysqld]下分别增加一句：default-character-set=utf8</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）通过mysql -u root -p 命令登入mysql，创建数据库jiradb，操作命令为 create database jiradb character set 'utf8'</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）创建用户jira，操作命令为 grant all privileges on jiradb.* to 'jira'@'%' identified by 'jira'</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）进入/usr/local/jira/atlassian-jira-enterprise-4.2-standalone/目录，编辑conf文件夹下的<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>.xml,找到如下内容并修改：</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;">&lt;Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"</div><div style="word-break: break-all; margin: 10px 0px;">driverClassName="com.mysql.jdbc.Driver"</div><div style="word-break: break-all; margin: 10px 0px;">url="jdbc:mysql://localhost/jiradb?useUnicode=true&amp;amp;characterEncoding=UTF8"</div><div style="word-break: break-all; margin: 10px 0px;">username="jira"</div><div style="word-break: break-all; margin: 10px 0px;">password="jira"</div><div style="word-break: break-all; margin: 10px 0px;">maxActive="20"</div><div style="word-break: break-all; margin: 10px 0px;">validationQuery="SELECT 1"</div><div style="word-break: break-all; margin: 10px 0px;">/&gt;</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;">　　（7）进入 /usr/local/jira/atlassian-jira-enterprise-4.2-standalone/atlassian-jira/目录，分别执行如下操作：</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-INF/classes目录下的jira-application.properties文件，修改jira.home =/usr/local/jira/jira_home</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_INF/classes目录下的entityengine.xml文件，将&lt;datasource name= "defaultDS" &nbsp;field-type-name= "hsql" 中的hsql改为"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;">　　schema-name="PUBLIC"</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;">4.破解</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;">　　下载licence文件 http://files.cnblogs.com/flyingzl/jira_licence.rar并 覆盖/usr/local/jira/atlassian-jira-enterprise-4.2-standalone/目录<br /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　<strong style="word-break: break-all; line-height: normal !important;">5.启动jira</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　进入/usr/local/jira/atlassian-jira-enterprise-4.2-standalone/bin，执行./catalina.sh run</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">6.访问jira</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　打开浏览器，输入http://localhost:8080/就能看到jira的主页面了。在首页会看到你的ServerID，比如ServerID为BL7M-KJJC-06XD-R275,那么拷贝如下licence:</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;">Description=JIRA\: COMMERCIAL</div><div style="word-break: break-all; margin: 10px 0px;">CreationDate=2010-11-04</div><div style="word-break: break-all; margin: 10px 0px;">ContactName=flyingzl@gmail.com</div><div style="word-break: break-all; margin: 10px 0px;">jira.LicenseEdition=ENTERPRISE</div><div style="word-break: break-all; margin: 10px 0px;">ContactEMail=flyingzl@gmail.com</div><div style="word-break: break-all; margin: 10px 0px;">Evaluation=false</div><div style="word-break: break-all; margin: 10px 0px;">jira.LicenseTypeName=COMMERCIAL</div><div style="word-break: break-all; margin: 10px 0px;">jira.active=true</div><div style="word-break: break-all; margin: 10px 0px;">licenseVersion=2</div><div style="word-break: break-all; margin: 10px 0px;">MaintenanceExpiryDate=2011-10-24</div><div style="word-break: break-all; margin: 10px 0px;">Organisation=flyingzl</div><div style="word-break: break-all; margin: 10px 0px;">jira.NumberOfUsers=-1</div><div style="word-break: break-all; margin: 10px 0px;">ServerID=BL7M-KJJC-06XD-R275</div><div style="word-break: break-all; margin: 10px 0px;">LicenseID=LID</div><div style="word-break: break-all; margin: 10px 0px;">LicenseExpiryDate=2011-10-24</div><div style="word-break: break-all; margin: 10px 0px;">PurchaseDate=2010-11-04</div></td></tr></tbody></table></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/412861.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:24 <a href="http://www.blogjava.net/qileilove/archive/2014/04/24/412861.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试关联学习</title><link>http://www.blogjava.net/qileilove/archive/2014/04/18/412643.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 18 Apr 2014 05:23:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/18/412643.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412643.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/18/412643.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412643.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412643.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>的关联。以前都是从ppt上简单知道关联操作，不懂得那些操作需要关联，关联意义，为什么需要关联，那些字段需要关联。今天在kelly帮助讲解下，了解了关联的意义。</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;">　　举例从创建预收货订单保存订单-》保存商品明细-》审核-》确认收货 &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;">　　其中涉及需要关联有商品明细的保存、审核、收货确认 均需要关联</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.录制脚本，进行回放发现，回放一次只会在在原来的订单下新增一条商品明细，不会每次回放均新增一条记录，同时状态均是新增，故存在问题。</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.寻找问题出在商品保存的时候，一直获取是原因的订单的ID和OrderNO &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;">　　3.把脚本切换到TREE目录下，查找商品明细保存的这段的request的内容，在&lt;Operation&gt;的节点中，看到代码写的方法，可以看到变量，分析哪些变量是不变，哪些变量是更新。从中得知ID和OrderNO，是一直保存于订单头部的一致。</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.ID和OrderNO是可以从订单头部的保存自动生成，即在TREE的Response的XML下可以找到服务器反馈回来的值。</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.此时需要在订单头部查找到Response函数，然后点击函数右键，保存在一个参数里。即Response全部信息均保存在参数里。</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.由于商品保存只需要获得ID和OrderNO，所以需要把这两个另存为其他参数，在商品保存可以直接调用。</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.在商品保存查看Request和tree模式下，找到ID和OrderNO，点击save value in parameter 。即name可以是默认，XML Source是来源头部保存的参数。</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.此时在Script脚本下，在商品保存中，去把ID和OrderNO参数化，调用在request中保存的参数即可。</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.审核和收货确认也一样进行分析。</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><img src ="http://www.blogjava.net/qileilove/aggbug/412643.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-18 13:23 <a href="http://www.blogjava.net/qileilove/archive/2014/04/18/412643.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web测试中，各类web控件测试点总结</title><link>http://www.blogjava.net/qileilove/archive/2014/04/17/412560.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 17 Apr 2014 02:19:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/17/412560.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/412560.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/17/412560.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/412560.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/412560.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;">　一 、界面检查</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;">　　进入一个页面<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>，首先是检查title，页面排版，字段等，而不是马上进入文本框校验</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、页面名称title是否正确</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;您的位置：xxx&gt;xxxx</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;">　　复选框，是否保存打&#8730;，或者保存不打&#8730;</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;">　<strong style="word-break: break-all; line-height: normal !important;">　二、单文本框（type=text）</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;">　　判空：是否可以为空</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;">　　唯一性：是否唯一 &nbsp; &nbsp; &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;">　　考虑语言，操作环境</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;">　　' or 1&lt;&gt;'1　　　' or '1'='1　　' or '1'&lt;&gt;'2　　"|?&gt;&lt;</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;">　　where a='xxx'　　　下划线是否允许　　输入全部空格 &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;">　　&gt;&lt;script&gt;alert(&#8220;123&#8221;);&lt;/script&gt;&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;">　　特殊字段输入限定：</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;">　　框内容是否合法（tel，ip，url，email）序号等，直接限制输入数字，其他过滤掉</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;">　　输入金额文本框，整数首位为0，过滤掉，小数点后面，一般保留两个有效数字。</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)、(字段长度输入最大允许长度时)数据允许长度的测试：</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、页面是否被挤出的测试(都输入长英文字符串，是否断行)；</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、<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.60000228881836px; margin: 10px 0px; color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 11.818181991577148px; background-color: #ffffff;">　　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）、对于允许为空的字段，不填入，再次数据传递后，看是否报500错误。</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）、未规定字段长度（或者数值大小），不按死板输入，输入非常多字符（或者非常大的数值）时，做允许动作的正确性校验，看是否报错。(要达到的结果：不管有没有长度限制(没有给最长、最大限制让你去测？)，最终页面不能抛数据库异常。)monkey&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;">test</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;">　　<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;">　　A、页面(前台)有校验长度、大小； &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;">　　B、无校验，数据库报错。</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、自动截断处理，并且给用户提示<br /><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;"><strong style="word-break: break-all; line-height: normal !important;">　关于长度概念：</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　1、 数据库规定的字节长度A</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　2、 页面上可以输入的字符数B</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">控制方法：</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　1）、页面上，不管输入什么字符（全角如汉字、半角如字母），统一规定不能超过B个字符，此种限制，</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　测试点：全部输入全角B个，测试（B*3字节）会不会超过数据库字节长度</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　全部输入半角B个，测试（B*1字节）会不会超过数据库字节长度</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　混合输入全角X半角Y，测试（X*3+Y字节）会不会超过数据库长度</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　2）、页面上，不以字符统计，以总的输入字节数统计，比如，全部输入全角字符，允许可以输入A/3个字符，全部输入半角字符，允许输入A个字符（ 民生网的设计）</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　测试点：全部输入全角，看是否允许输入A/3个字符</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　全部输入半角，看是否允许输入A个字符</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　混合输入全角X，半角Y，看是否允许X*3+Y=A</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　(5个：判空、唯一、边界值、特殊字符、正确流程(多种数据、多种分支))</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　+测试校验位置：ajax鼠标事件校验、前台提交按钮js校验，服务器拿到数据后再次验证</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　<strong style="word-break: break-all; line-height: normal !important;">　三、多文本框（type=textarea）</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　1)、空格和换行的问题，看需求，是否需要做支持HTML Encoding</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　输入全部空格时，是否判空处理？&#8221;&#8221;空格， &nbsp; 。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　输入折行，是否也显示折行？</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　比如：列点说明原因，就需要支持。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　2)、字母截断的问题</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　对于一串字母，开发人员往往会忘掉做截断，这样如果展示在我们的平台上的话，这一串字母就会把我们的UI撑开</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　3）、长度控制格式， 您还可以输入***个字符</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　<strong style="word-break: break-all; line-height: normal !important;">　四、添加按钮</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　添加动作检查范围：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　失败：是否提示</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　提示内容是否正确</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　失败时：保存用户已输入的内容，避免重新再输入</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　成功：对话框消失</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　记录是否可直接查看（还需要刷新？）</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　列表记录顺序</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　重复提交情况，点击一次后，是否变成disable</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　上传附件的添加：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　A. 文件名称：文件名称很长；文件名称字符多样化(汉字，英文，符号)；文件名称重复。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　B. 判空？</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　C. 附件格式类型支持？</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　D. 附件个数？</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　E. 附件空间大小。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">五、移除按钮</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　1.一般都要在前台先给出一个提示操作&#8220;确定移除该&#8230;&#8230;&#8221;</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　2.相关联的东西，是否需要限制移除&#8220;该类型下存在应用，无法移除&#8221;有到后台比较</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　3.确定后，真正执行移除操作。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　结果：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　移除后，列表数据是否立即消失。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　必须有确认删除的提示信息</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">六、列表</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　1）、列表记录顺序</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　2）、是否需要翻页、有没有翻页功能</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　3）、字段名称是否与表单一致</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　<strong style="word-break: break-all; line-height: normal !important;">　七、搜索-文本框</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　1、功能点、需求点考虑：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　是否提供模糊查询、输入数值有种类有限定时，是否考虑换成下拉框搜索；</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　2、检查点：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　文本框值是否消失(是否回填条件值)，再次点击&#8220;查询&#8221;可查看所有记录；</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　考虑搜索结果：是否存在分页，分页是否正常；是否有序；</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　注意：分页是否仍保存查询条件，检查后面的记录是否符合条件</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　3、查询数据多样性：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　输入不存在的字段值测试、包括特殊字符查询测试例如：' or '1'='1；</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　输入类似程序语句的条件时是否执行查询，如：XXXX&#8221;、XXX and ；</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　4、操作类型：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　1) 不输入的查询</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　2) 输入全部空格的查询</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　3) 模糊查询(输入部分字段，或者说，输入英文字母，查询到相关中文数据)</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　4) 输入不存在的查询</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　5) 输入存在的查询</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　6) 单个查询和多个条件复合查询。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">八、搜索-下拉框</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　检查点：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　a) 搜索结果是否有序；</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　b) 下拉框值是否齐全；(下拉框值本身也是一个动态查询的结果)</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　c) 下拉框值是否自动消失，再次点击&#8220;查询&#8221;可查看所有记录(是否要回填条件值)；</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　d) 分页时，是否保存搜索条件。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　（从UI、开发、业务逻辑、用户使用等角度测试）</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">PS:</strong></div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　以上总结的， 是比较纯粹的从页面控件角度测试点出发， 对于完整测试一个整体页面，需要各类测试有机结合起来：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　1）UI测试：</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　页面布局； 页面样式检查；控件长度是否够长；显示时，是否会被截断；支持的快捷键，Tab键切换焦点顺序正确性等。</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　2）功能测试：页面上各类控件的测试范围，测试点，可参考上方</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　结合控件的实际作用来补充检查点： 比如， 密码框是否*显示， 输入是否做trim处理等</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　3）安全测试：输入特殊字符，sql注入，脚本注入测试</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　后台验证测试，对于较重要的表单 ，绕过js检验后台是否验证</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　数据传输是否加密处理，比如， 直接请求转发，地址栏直接显示发送字符串？</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　数据库存储，特别密码等，是否加密形式存储</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　4）兼容性测试</div><div style="word-break: break-all; margin: 10px 0px; font-size: 11.818181991577148px;">　　5）性能测试<br /></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/412560.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:19 <a href="http://www.blogjava.net/qileilove/archive/2014/04/17/412560.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>谈谈容量规划</title><link>http://www.blogjava.net/qileilove/archive/2014/04/03/411880.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Thu, 03 Apr 2014 02:57:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/04/03/411880.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/411880.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/04/03/411880.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/411880.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/411880.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>是个资源管理的命题，其目标是解答运行中的系统需要多少容量以及在什么时候需要这些容量的问题，更简单的说法就是回答我们需要在什么时候加多少机器的问题。</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;">　　容量水位是一种常用的容量规划模型，其定义为：集群流量 / 集群性能 x 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;">　　容量水位模型把容量规划问题转化为两个方面，即</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. 系统的负荷(集群流量)是多少？通过线上监控回答</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;">　　<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;">　　集群性能 = 单机性能 x 集群机器数</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. 用什么来描述系统的性能？TPS还是网络流量，根据具体业务具体分析，关键是它能真正反映实际性能</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. 用什么样的标准来度量最大性能？比如CPU达到80%，响应时间超过1s</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;">　　根据选取的性能指标，监控当前系统的运行情况，记录其变化趋势</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;">　　系统各个部分存在一定的依赖关系。从业务上理解，即最靠近用户的入口调用会转化为中间层和底层系统上的调用。</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><img src ="http://www.blogjava.net/qileilove/aggbug/411880.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-03 10:57 <a href="http://www.blogjava.net/qileilove/archive/2014/04/03/411880.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>12个最好的免费网站速度和性能测试工具</title><link>http://www.blogjava.net/qileilove/archive/2014/03/31/411708.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 31 Mar 2014 03:39:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/31/411708.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/411708.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/31/411708.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/411708.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/411708.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;">　如果你是位个人站长，就能理解网站速度的重要性。自从&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;">Google</strong></u></a>&nbsp;算法开始使用网页加载时间作为搜索排序参数之后，网站速度对 SEO 的影响非常大。而且，很慢的加载速度会对网站访问者产生消极的影响。如果你的网站加载速度很慢，需要等待一段时间才能加载，那么用户很有可能不会再次访问 这个网站。</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;">　　<strong style="word-break: break-all; line-height: normal !important;">1. Google PageSpeed Insights</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;">　　Google PageSpeed Insights 允许用户分析网站页面的内容，并且会提供加快网站访问速度的建议。</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. GT Matrix</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;">　　GTmetrix 可以帮助用户开发一个快速，高效，能全面改善用户体验的网站。它会为网站性能打分，然后提供可行性的建议来改善已发现的问题。</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;">3. Neustar Free Load Testing &amp; Performance Test</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;">　　neustar 这个工具是个简单快速生成网站性能分析数据的工具。它能忽略掉大小和地理位置来检测和负载测试网站，非常容易得出网站的性能分析，帮助用户加快网站加载速度。</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;">　4.&nbsp;<a target="_self" style="word-break: break-all; color: #202859;"><u style="word-break: break-all;"><strong style="word-break: break-all;">Web</strong></u></a>&nbsp;Page Analyzer</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;">　　Web Page Analyzer 是个非常强大的速度<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>，提供详细的网站分析数据并且会提供提高网站性能的建议。它提供大量的 web 页面速度报告，global report，外部文件计算，加载时间，网站分析数据和改善建议。</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;">　5. Pingdom</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;">　　Pingdom 是个非常杰出的工具，帮助用户生成大量网站的报告（页面大小，浏览器缓存，性能等级等），确定网站的加载时间，而且允许用户跟踪性能的历史记录，能在不同位置进行网站测试。</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;">　6. Load Impact</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;">　　Load Impact 允许用户做些 web 应用的负载和<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 Impact 会选择一个全球负载区，测试模拟客户，带宽，接收数据和每秒请求等。越来越多客户变活跃，这个工具会用个漂亮的图表来展示测量的加载时间。</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;">7. WebPage Test</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;">　　用户可以使用 WebPage Test 来进行简单的测试，又或者是进行高级的测试，比如多步事物处理，视频采集，内容屏蔽等。测试结果会提供丰富的诊断信息，包括资源加载瀑布图表，页面速度优化检测和改善建议等。</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;">　　8. Octa Gate Site Timer</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;">　　Octa Gate Site Timer 工具允许用户检测每个用户加载一个或多个页面的时间。当页面加载的时候，SiteTimer 存储每个项目加载的数据和用户接收的数据，这些数据会用一个网格来显示。</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;">9. Which Loads Faster</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;">　　Which Loads Faster 是用来测试 web 性能问题的工具，可以在每个用户的浏览器测试。whichloadsfaster 是开源的，使用 HTML 和 JavaScript 编写的测试工具，完全在客户端运行。</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;">10. Yslow</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;">　　YSlow 能分析 web 页面，基于一系列 web 页面高性能规则提供改进网页性能的建议。</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;">11. Show Slow</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;">　　Show Slow 是个开源测试工具，帮助检测各种网站性能指标。它会把页面速度的检测结果排序，有 dynaTrace AJAX 版，WebPageTest 和 YSlow。它会用图形化显示排序结果，帮助用户理解哪些因素会影响网站的性能。</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;">12. Free Speed Test</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;">　　Free Speed Test 是个在线网站速度测试工具，可以通过全球多个数据中心来检测加载时间和网站速度。这可以让用户了解全球各个角落网站的实际加载速度。</div><img src ="http://www.blogjava.net/qileilove/aggbug/411708.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-03-31 11:39 <a href="http://www.blogjava.net/qileilove/archive/2014/03/31/411708.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web服务性能测试：Node完胜Java</title><link>http://www.blogjava.net/qileilove/archive/2014/03/31/411702.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Mon, 31 Mar 2014 03:07:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/31/411702.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/411702.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/31/411702.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/411702.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/411702.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;">简介</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;">　　我最近做了一些简单的关于内存的<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;Service性能测试。我使用Java(REST + SOAP)和Node.js(REST)将一些接口功能缓存起来。跟期望的一样，Node应用的性能远远超出Java。（响应时间至少快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;">　　译者注* &nbsp;NodeJS跟许多其他单线程语言一样，对内存并不贪婪，因为没有关于线程的内存开销，内存占用不会随着连接数的增长而增长，尤其在剔除掉读写文件/数 据库等异步操作后，完全基于内存的NodeJS将有更显著的性能提升，从某种意义上来说基于内存的nodejs服务所能支持的最大并发数将仅受限于带宽和 CPU的处理能力。</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;">　　可参见: 性能测评：Ngix_Lua, Node.JS&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;">Python</strong></u></a>三者性能相当，均比php快近一倍, &nbsp;PayPal为什么从Java迁移到Node.js</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：关于缓存应用的原理图。缓存支持插入，获取，删除键/值对</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=45133" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403271434041zdIE.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;">　　图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 href="http://www.51testing.com/batch.download.php?aid=45134" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403271434042pvSH.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;">　　这里使用了另外一种形式的REST，cache操作通过HTTP verbs来完成（Insert = PUT, Fetch = GET, Remove = DELETE)。数据刷新通过使用timeouts(Node)和scheduled threads(Java)来完成。缓存冗余是通过服务器间的REST调用来实现。（通过PUT/DELETE)<br /><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　　对于Java SOAP的扩展，cache操作通过经典的HTTP POST SOAP包来实现。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;">　<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; font-size: 11.818181991577148px;">　　图3：基于Cache的Java REST组织结构图。Apache Tomcat + Jersey (servlet)在这一层。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=45135" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403271434043elOE.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; font-size: 11.818181991577148px;">　　图4：基于Cache的Java SOAP组织结构图。Apache Tomcat + Axis2 (servlet)在这一层。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=45136" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403271434044Qx4X.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; font-size: 11.818181991577148px;">　　图5：为Node应用。仅初始化了一个worker。</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=45137" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403271434045eIIO.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; font-size: 11.818181991577148px;">　　<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; font-size: 11.818181991577148px;">　　图6: 为我测试时使用的环境</div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; font-size: 11.818181991577148px;"><a href="http://www.51testing.com/batch.download.php?aid=45138" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403271434201cZAF.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;"><strong style="word-break: break-all; line-height: normal !important;">Java + Node REST 缓存插入测试</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; 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;">ab -A username:password -u restput.txt -n 1000 -c 1 https://server/ctispan/rest/key/111 &gt; results.txt</div><div style="word-break: break-all; margin: 10px 0px;">restput.txt</div><div style="word-break: break-all; margin: 10px 0px;">value=test111</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　　<strong style="word-break: break-all; line-height: normal !important;">Java SOAP 缓存获取测试</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; 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;">ab -A client:password -T "application/soap+xml; charset=UTF-8" -p soapget.xml -n 1000 -c 1 https://server/ctispan/services/CacheProxyWS.CacheProxyWSHttpSoap11Endpoint/ &gt; results.txt</div><div style="word-break: break-all; margin: 10px 0px;">soapget.xml</div><div style="word-break: break-all; margin: 10px 0px;">&lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;soapenv:Body&gt;&lt;ns1:getValue xmlns:ns1="http://server.ctispan.jwisoft.com"&gt;&lt;ns1:key&gt;111&lt;/ns1:key&gt;&lt;/ns1:getValue&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　<strong style="word-break: break-all; line-height: normal !important;">　Java SOAP 缓存插入测试</strong></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; 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;">ab -A client:password -T "application/soap+xml; charset=UTF-8" -p soapput.xml -n 1000 -c 1 https://server/ctispan/services/CacheProxyWS.CacheProxyWSHttpSoap11Endpoint/ &gt; results.txt</div><div style="word-break: break-all; margin: 10px 0px;">soapput.xml</div><div style="word-break: break-all; margin: 10px 0px;">&lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;soapenv:Body&gt;&lt;ns1:putValue xmlns:ns1="http://server.ctispan.jwisoft.com"&gt;&lt;ns1:key&gt;111&lt;/ns1:key&gt;&lt;ns1:value&gt;text111&lt;/ns1:value&gt;&lt;/ns1:putValue&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;</div></td></tr></tbody></table></div><div style="word-break: break-all; line-height: 21.60000228881836px; margin: 10px 0px; color: #333333; font-size: 11.818181991577148px;">　<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-size: 11.818181991577148px;">　　下面A/B测试生成的一些数据。对于Node对比Java的结果，我并不吃惊。不过对于Java REST和SOAP的对比让我稍微有些吃惊。我原本以为因为SOAP的复杂性，REST的性能应该比SOAP好很多才对。这也许是因为Apache Axis2 API要比Jersey API高效的多造成的吧。</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=45139" target="_blank" style="word-break: break-all; color: #202859; text-decoration: none; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_2014032714342026Bsh.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; text-align: center;"><a href="http://www.51testing.com/batch.download.php?aid=45140" target="_blank" style="word-break: break-all; color: #45a2fc; line-height: normal !important;"><img src="http://www.51testing.com/attachments/2014/03/14982672_201403271434203q82v.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></a></div></div><img src ="http://www.blogjava.net/qileilove/aggbug/411702.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-03-31 11:07 <a href="http://www.blogjava.net/qileilove/archive/2014/03/31/411702.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>性能测试学习内容指南</title><link>http://www.blogjava.net/qileilove/archive/2014/03/26/411478.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 26 Mar 2014 02:50:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/26/411478.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/411478.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/26/411478.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/411478.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/411478.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;">1.&nbsp;<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;">　　性能测试常用术语</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;">　<strong style="word-break: break-all; line-height: normal !important;">　2.LoardRunner基本操作及应用</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;">　　LoardRunner原理分析</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;">　　LoardRunner脚本开发流程</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(基本设置、检查点、参数化、关联、调试、事物)</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(场景设计、场景监视&lt;Windows Resources、IIS服务器、Unix/Linux Resource、Weblogic Server、<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>服务器&gt;、集合点、IP欺骗技术、负载均衡、场景执行)</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;">　　Analysis(摘要报告、常见图分析、结果分析实践&lt;分析图合并、分析图关联、页面细分、钻取技术、外部数据导入、HttpWatch分析&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;">　　<strong style="word-break: break-all; line-height: normal !important;">3.Linux监测、分析、调优</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;">　　CPU监控</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;">　　网络监控</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;">4.Windows监测、分析、调优</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;">　　LoardRunner直接监控、<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>性能工具监控、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;">　　<strong style="word-break: break-all; line-height: normal !important;">5. 数据库监测、分析、调优</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;">　　6. 常用的服务器监测、分析、调优</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;">　　Apache监控</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;">　　Apache调优</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;">　　Tomcat监控</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;">7. 前端性能调优</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;">　　Firebug工具</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;">　　HttpWatch</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;">　　Chrome自带的开发工具</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;">　　DynaTrace Ajax Edition工具</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;">8.网络分析</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;">　　9.代码分析与调优</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;">　　10.项目实战</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;">　　11.推荐书籍</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;">　　&lt;&lt;软件性能测试过程详解与案例剖析&gt;&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;">　　&lt;&lt;性能测试进阶指南&gt;&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;">　　&lt;&lt;深入性能测试LoardRunner&gt;&gt;</div><img src ="http://www.blogjava.net/qileilove/aggbug/411478.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-03-26 10:50 <a href="http://www.blogjava.net/qileilove/archive/2014/03/26/411478.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web中小项目性能测试</title><link>http://www.blogjava.net/qileilove/archive/2014/03/14/411011.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Fri, 14 Mar 2014 02:49:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/14/411011.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/411011.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/14/411011.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/411011.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/411011.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月8号，我去参加了一个叫孙弘美女关于中小型项目<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></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、未来市场的预测</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;">　　<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、网站能否正常运行，能否被用户使用</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;">　　<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;">　　一般日pv量达到亿级只有少数几个之名的网站，如<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>。百万级的访问量如搜房网，51job。根据站长统计分析所得，一般大部分存活的网站日pv量只有1000左右，对于这种访问量的中小型网站该如何做性能测试？</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、低成本，不需要做数据统计分析，直接利用共有的性能指标来做性能测试</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;">　<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、基准测试，关注一个用户访问网站的情况</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;">　<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、数据库-索引；锁（死锁等）</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、Js脚本-加载顺序以及自身脚本缺陷等</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;">　　<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、关键路径以及场景</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><img src ="http://www.blogjava.net/qileilove/aggbug/411011.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-03-14 10:49 <a href="http://www.blogjava.net/qileilove/archive/2014/03/14/411011.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WebService性能测试</title><link>http://www.blogjava.net/qileilove/archive/2014/03/12/410912.html</link><dc:creator>顺其自然EVO</dc:creator><author>顺其自然EVO</author><pubDate>Wed, 12 Mar 2014 02:40:00 GMT</pubDate><guid>http://www.blogjava.net/qileilove/archive/2014/03/12/410912.html</guid><wfw:comment>http://www.blogjava.net/qileilove/comments/410912.html</wfw:comment><comments>http://www.blogjava.net/qileilove/archive/2014/03/12/410912.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/qileilove/comments/commentRss/410912.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/qileilove/services/trackbacks/410912.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;">什么是WebService?</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;">　　假如有两个国家，<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>国和.net国；两国为了发展经济，互通贸易，需要交流，但java国说的是java语言，.net国说的.net语言。为了方便交流，创造了第三方语言WebService。这样说不准确，WebService不是一个语言；暂时先这样理解。</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>一门语言，他们不乐意了。自己国的语言说的好好的，干嘛要费那么大力气再学一个语言。 那能不能造出个电子产品来完成这种功能？从表面上来理解：WebService 就是一个应用程序，它向外界暴露出一个能够通过Web进行调用的API。你能够用编程的方法通过Web来调用这个应用程序。当然，不能把把这个电子产品理解一为一个通用的东西，我们做<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>外贸的，要做具有手机相关于功能的电子产品（应用程序）。你做衣服外贸的，要做具有衣服相关功能的电子产品。也可以这样理解：Web service平台是一套标准，它定义了应用程序如何在Web上实现互操作性。你可以用任何你喜欢的语言，在任何你喜欢的平台上写Web service ，只要我们可以通过Web service标准对这些服务进行查询和访问。</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;">　　两国人民打算要做这么个东西，那就要来制定这个东西的规范，不是java国作出来的东西，.net国的人怎么知道它是什么玩意，有什么功能。对吧。Web service平台必须提供一套标准的类型系统，用于沟通不同平台、编程语言和组件模型中的不同类型系统。Web service平台也必须提供一种标准来描述Web service，让客户可以得到足够的信息来调用这个Web service。最后，我们还必须有一种方法来对这个Web service进行远程调用。这种方法实际是一种远程过程调用协议(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;">　　好了，两国人民既然要来制定这个规范，那就坐下来具体说说，应该怎么制定吧！</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;">　XML和XSD</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;">　　可扩展的标记语言(XML)是Web service平台中表示数据的基本格式。除了易于建立和易于分析外，XML主要的优点在于它既是平台无关的，又是厂商无关的。无关性是比技术优越性更重要的：软件厂商是不会选择一个由竞争对手所发明的技术的。</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;">　　XML解决了数据表示的问题，但它没有定义一套标准的数据类型，更没有说怎么去扩展这套数据类型。例如，整形数到底代表什么？16位，32位，还是64位？这些细节对实现互操作性都是很重要的。W3C制定的XML Schema(XSD)就是专门解决这个问题的一套标准。它定义了一套标准的数据类型，并给出了一种语言来扩展这套数据类型。Web service平台就是用XSD来作为其数据类型系统的。当你用某种语言(如VB.NET或C#)来构造一个Web service时，为了符合Web service标准，所有你使用的数据类型都必须被转换为XSD类型。你用的工具可能已经自动帮你完成了这个转换，但你很可能会根据你的需要修改一下转换过程。在第二章中，我们将深入XSD，学习怎样转换自定义的数据类型(例如类)到XSD的类型。</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;">SOAP</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;">　　Web service建好以后，你或者其他人就会去调用它。简单对象访问协议(SOAP)提供了标准的RPC方法来调用Web service。实际上，SOAP在这里有点用词不当：它意味着下面的Web service是以对象的方式表示的，但事实并不一定如此：你完全可以把你的Web service写成一系列的C函数，并仍然使用SOAP进行调用。SOAP规范定义了SOAP消息的格式，以及怎样通过HTTP协议来使用SOAP。SOAP也是基于XML和XSD的，XML是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;">　<strong style="word-break: break-all; line-height: normal !important;">　WSDL</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;">　　你会怎样向别人介绍你的Web service有什么功能，以及每个函数调用时的参数呢？你可能会自己写一套文档，你甚至可能会口头上告诉需要使用你的Web service的人。这些非正式的方法至少都有一个严重的问题：当程序员坐到电脑前，想要使用你的Web service的时候，他们的工具(如Visual Studio)无法给他们提供任何帮助，因为这些工具根本就不了解你的Web service。解决方法是：用机器能阅读的方式提供一个正式的描述文档。Web service描述语言(WSDL)就是这样一个基于XML的语言，用于描述Web service及其函数、参数和返回值。因为是基于XML的，所以WSDL既是机器可阅读的，又是人可阅读的，这将是一个很大的好处。一些最新的开发工具既能根据你的Web service生成WSDL文档，又能导入WSDL文档，生成调用相应Web service的代码。</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;">　　好吧！我想我们大体的了解了WebService是什么东西，再来理解WebService性能，你写好的一个WebService的应用程序的接口放那里，会有好多人来调用，当然会有质量问题了。人多的时候，会不会有不成功啊？会不会慢啊？所以要 对这个&#8220;接口&#8221;做<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;做测试，soapUI是自动帮我们完成SOAP协议请求的！由于刚接触这个工具，希望一高手指点学习。</div><img src ="http://www.blogjava.net/qileilove/aggbug/410912.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-03-12 10:40 <a href="http://www.blogjava.net/qileilove/archive/2014/03/12/410912.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>