凤凰涅槃 浴火重生

发布新日志

  • VBA自己看的 [2016年05月02日]

    2016-05-02 17:09:36

    Public WSBatchSet As Worksheet
    Public RowsCount As Integer             
    Public dicExcuteLine As Object          

    Const ForReading = 1
    Const ForWriting = 2
    Const ForAppending = 8

    Sub Main()

        Application.ScreenUpdating = False 
        Call Init
        Application.ScreenUpdating = True    
        MsgBox "Done~"

    End Sub

    Sub Init()

        Dim CountRange As Range
        Set WSBatchSet = Worksheets("SetFlag")
        Set CountRange = WSBatchSet.Range("C:C")
            RowsCount = Application.WorksheetFunction.CountA(CountRange)
        Set dicExcuteLine = CreateObject("Scripting.Dictionary") 

    End Sub

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''写入文件
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Function writefile(ByVal fPath As String, ByVal pName As String, ByVal pValue As String)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Dim fso As Object, f As Object
    Set fso = CreateObject("scripting.filesystemobject")
    Set f = fso.opentextfile(fPath, ForWriting, True)

        With f
            .writeline pName
            .writeline pValue
            .Close
        End With
        
    Set f = Nothing
    Set fso = Nothing

    End Function
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''检查文件路径是否存在
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Function chkIsFilePathExist(ByVal fPath As String) As Boolean
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Dim fso As Object
    Set fso = CreateObject("scripting.filesystemobject")

        If fso.fileexists(fPath) Then
            chkIsFilePathExist = True
        Else
            chkIsFilePathExist = False
        End If
        
    Set fso = Nothing

    End Function


  • QuickTest自动化对象模型 chm帮助文档

    2013-04-12 21:25:53

    寻了N久,终于淘出来了。
     
    mlgb
    坑人的  希SDN, 坑人的 XXX网站,去你们麻的,都塔嘛一群剑货。
     
    现共享给大家,自动化对象模型,可用来参考,
     
    使用VBS脚本操作QTP工具,实现真正意义上的自动化执行。
     
    总而言之,坂田的某巨型私企历经3年,终于在HP专家的帮助下搞出了很不错自动化测试框架,
     
    本人不才,目前正在苦心研究其内在的设计思想和驱动程序架构。
     
     
     
     
    希望外面的弟兄们能早日悟道~~
     
     
     
    解压密码:  文中自己找去
     
    fly_away
     
     
  • 日期正则式(测试中……)

    2012-12-17 00:04:37

    检查日期格式和内容是否正确
     
    日期格式: YYYY-MM-DD
    日期范围: 0000-01-01~9999-12-31
     
    思路:将日期进行等价类划分,
         日期格式加上 ^ 和 $ 进行起始和结束的强制定义
     
    一、特殊日期,闰年2月(XXXX-02-29),分为两种:
      1、小闰年 不以“00”结尾的年份,被4整除的。转化正则式为:
    ((^\d\d[13579][26])|(^\d\d[2468][048])|(^\d\d0[48]))-02-29$
     
      2、大闰年 以“00”结尾的年份, 被400整除的。转化正则式为:
    ((^[02468][048])|(^[13579][26]))00-02-29$
    二、常规日期,(无视年份)分为三种:
      1、常规大月 1,3,5,7,8,10,12 (31天)。转化正则式为:
    ^\d{4}-((0[13578])|(1[02]))-((0[1-9]$)|([12]\d$)|(3[01]$))
     
      2、常规小月 4,6,9,11          (30天)。转化正则式为:
    ^\d{4}-((0[469])|(11))-((0[1-9]$)|([12]\d$)|(30$))
     
      3、常规2月  2                   (28天)。转化正则式为:
    ^\d{4}-02-((0[1-9]$)|(1\d$)|(2[0-8]$))
     
    组合以上五种正则式,便可得到最终正则式:
    (((^\d\d[13579][26])|(^\d\d[2468][048])|(^\d\d0[48]))-02-29$)|(((^[02468][048])|(^[13579][26]))00-02-29$)|(^\d{4}-((0[13578])|(1[02]))-((0[1-9]$)|([12]\d$)|(3[01]$)))|(^\d{4}-((0[469])|(11))-((0[1-9]$)|([12]\d$)|(30$)))|(^\d{4}-02-((0[1-9]$)|(1\d$)|(2[0-8]$)))
     
    当然,这只是简单的拼接而已,未考虑到正则式的运算效率。
  • 清理Windows系统垃圾的批处理代码

    2011-08-03 22:29:58


    ======就是下面的文字(这行不用复制)=============================

    @echo off
    echo 正在清除系统垃圾文件,请稍等......
    del /f /s /q %systemdrive%\*.tmp
    del /f /s /q %systemdrive%\*._mp
    del /f /s /q %systemdrive%\*.log
    del /f /s /q %systemdrive%\*.gid
    del /f /s /q %systemdrive%\*.chk
    del /f /s /q %systemdrive%\*.old
    del /f /s /q %systemdrive%\recycled\*.*
    del /f /s /q %windir%\*.bak
    del /f /s /q %windir%\prefetch\*.*
    rd /s /q %windir%\temp & md %windir%\temp
    del /f /q %userprofile%\cookies\*.*
    del /f /q %userprofile%\recent\*.*
    del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
    del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
    del /f /s /q "%userprofile%\recent\*.*"
    echo 清除系统LJ完成!
    echo. & pause

    =====到这里为止(这行不用复制)==============================================
  • 《独立宣言》 1776年7月4日

    2011-04-18 22:28:17

     

    The Declaration of Independenceevents

    IN CONGRESS, JULY 4,
    1776 THE UNANIMOUS
    DECLARATION OF THE
    THIRTEEN UNITED
    STATES OF AMERAICA

          When in the course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the laws Nature and Nature’s God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.

         We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable rights, that they are among these are life, liberty and the pursuit of happiness. That to secure these rights, governments are instituted among them, deriving their just power from the consent of the governed. That whenever any form. of government becomes destructive of these ends, it is the right of the people to alter or to abolish it, and to institute new government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their safety and happiness. Prudence, indeed, will dictate that governments long established should not be changed for light and transient causes; and accordingly all experience hath shown that mankind are more disposed to suffer, while evils are sufferable, than t right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same object evinces a design to reduce them under absolute despotism, it is their right, it is their duty, to throw off such government, and to provide new guards for their future security. Such has been the patient sufferance of these Colonies; and such is now the necessity, which constrains them to alter their former systems of government. The history of the present King of Great Britain is usurpations, all having in direct object tyranny over these States. To prove this, let facts be submitted to a candid world.

         He has refused his assent to laws, the most wholesome and necessary for the public good.
         He has forbidden his Governors to pass laws of immediate and pressing importance, unless suspended in their operation till his assent should be obtained; and when so suspended, he has utterly neglected to attend them.
    He has refused to pass other laws for the accommodation of large districts of people, unless those people would relinquish the right of representation in the Legislature, a right inestimable to them and formidable to tyrants only.
         He has called together legislative bodies at places unusual, uncomfortable, and distant from the depository of their public records, for the sole purpose of fatiguing them into compliance with his measures.]
         He has dissolved representative houses repeatedly, for opposing with manly firmness his invasion on the rights of the people.
         He has refused for a long time, after such dissolution, to cause others to be elected ; whereby the legislative powers, incapable of annihilation, have returned to the people at large for their exercise; the State remaining in the meantime exposed to all the dangers of invasion from without and convulsion within.
         He has endeavored to prevent the population of these states; for that purpose obstructing the laws of naturalizing of foreigners; refusing to pass others to encourage their migration hither, and raising the condition of new appropriations of lands.
         He has obstructed the administration of justice, by refusing his assent of laws for establishing judiciary powers.
         He has made judges dependent on his will alone, for the tenure of their office, and the amount and payment of their salary. 
         He has erected a multitude of new officers, and sent hither swarms of officers to harass our people, and eat out our substances.
         He has kept among us, in times of peace, standing armies without the consent of our legislatures.
         He has affected to render the military independent of and superior to the civil power.
        He has combined with others to subject us to a jurisdiction foreign to our constitution, and unacknowledged by our laws; giving his assent to their acts of pretended legislation.
         For quartering large bodies of armed troops among us;
         For protecting them, by a mock trial, from punishment for any murder which they should commit on the inhabitants of these States.
         For cutting off our trade with all parts of the world;
         For imposing taxes on us without our consent;
         For depriving us in many cases, of the benefits of trial by jury;
         For transporting us beyond seas to be tried for pretended offenses;  
         For abolishing the free systems of English laws in a neighboring Province, establishing therein an arbitrary government, and enlarging its boundaries so as to render it at once an example and fit instrument for introducing the same absolute rule these Colonies;
         For taking away our Charters, abolishing our most valuable laws, and altering fundamentally the forms of our governments;
         For suspending our own Legislatures, and declaring themselves invested with power to legislate for us in all cases whatsoever.
         He has abdicated government here, by declaring us out of his protection and waging war against us.
        He has plundered our seas, ravaged our coasts, burnt our towns, and destroyed the lives of our people.
         He is at this time transporting large armies of foreign mercenaries to complete the works of death, desolation and tyranny, already begun with circumstances of cruelty and perfidy scarcely parallel in the most barbarous ages, and totally unworthy the head of a civilized nation.
         He has constrained our fellow citizens taken captive on the high seas to bear arms against their country, to become the executioners of their friends and brethren, or to fall themselves by their hands.
         He has excited domestic insurrection amongst us, and has endeavored to bring on the inhabitants of our frontiers, the merciless Indian savages, whose known rule of warfare, is an undistinguished destruction of all ages, sexes, and conditions.
         In every stage of these oppressions we have petitioned for redress in the most humble terms: our repeated petition have been answered only by repeated injury. A prince whose character is thus marked by every act which may define a tyrant is unfit to be the ruler of a free people.
         Nor have we been wanting in attention to our British brethren. We have warned them from time to time of attempts by their legislature to extend an unwarrantable jurisdiction over us. We have reminded them of the circumstances of our emigration and settlement here. We have appealed to their native justice and magnanimity, and we have conjured them by the ties of our common kindred to disavow these usurpation, which would inevitably interrupt our connections and correspondence. They too have been deaf to the voice of justice and of consanguinity. We must, therefore, acquiesce in the necessity, which denounces our separation, and hold them., as we hold the rest of mankind, enemies in war, in peace friends.
          We, therefore, the Representatives of the United States of America, in General Congress assembled , appealing to the supreme Judge of the world for the rectitude of our intentions, do, in the name, and by authority of the good people of these Colonies, solemnly publish and declare, That these United States Colonies and Independent States; that they are absolved by from all allegiance to the British Crown, and that all political connection between them and the State, they have full power to levy war, conclude peace, contract alliances, establish commerce, and to do all other acts and things which Independent States may of right do. And for the support of this declaration, with a firm reliance on the protection of Divine Providence, we mutually pledge to each other our lives, our fortunes, and our sacred honor.


        在人类事务发展的过程中,当一个民族必须解除同另一个民族的联系,并按照自然法则和上帝的旨意,以独立平等的身份立于世界列国之林时,出于对人类舆论的尊重,必须把驱使他们独立的原因予以宣布。

      我们认为下述真理是不言而喻的:人人生而平等,造物主赋予他们若干不可让与的权利,其中包括生存权、自由权和追求幸福的权利。为了保障这些权利,人们才在他们中间建立政府,而政府的正当权利,则是经被统治者同意授予的。任何形式的政府一旦对这些目标的实现起破坏作用时,人民便有权予以更换或废除,以建立一个新的政府。新政府所依据的原则和组织其权利的方式,务使人民认为唯有这样才最有可能使他们获得安全和幸福。若真要审慎的来说,成立多年的政府是不应当由于无关紧要的和一时的原因而予以更换的。过去的一切经验都说明,任何苦难,只要尚能忍受,人类还是情愿忍受,也不想为申冤而废除他们久已习惯了的政府形式。然而,当始终追求同一目标的一系列滥用职权和强取豪夺的行为表明政府企图把人民至于专制暴政之下时,人民就有权也有义务去推翻这样的政府,并为其未来的安全提供新的保障。这就是这些殖民地过去忍受苦难的经过,也是他们现在不得不改变政府制度的原因。当今大不列颠王国的历史,就是屡屡伤害和掠夺这些殖民地的历史,其直接目标就是要在各州之上建立一个独裁暴政。为了证明上述句句属实,现将事实公诸于世,让公正的世人作出评判。

      他拒绝批准对公众利益最有益、最必需的法律。

      他禁止他的殖民总督批准刻不容缓、极端重要的法律,要不就先行搁置这些法律直至征得他的同意,而这些法律被搁置以后,他又完全置之不理。

      他拒绝批准便利大地区人民的其他的法律,除非这些地区的人民情愿放弃自己在自己在立法机构中的代表权;而代表权对人民是无比珍贵的,只有暴君才畏惧它。

      他把各州的立法委员召集到一个异乎寻常、极不舒适而有远离他们的档案库的地方去开会,其目的无非是使他们疲惫不堪,被迫就范。

      他一再解散各州的众议院,因为后者坚决反对他侵犯人民的权利。

      他在解散众议院之后,又长期拒绝另选他人,于是这项不可剥夺的立法权便归由普通人民来行使,致使在这其间各州仍处于外敌入侵和内部骚乱的种种危险之中。

      他力图阻止各州增加人口,为此目的,他阻挠外国人入籍法的通过,拒绝批准其他鼓励移民的法律,并提高分配新土地的条件。

      他拒绝批准建立司法权利的法律,以阻挠司法的执行。

      他迫使法官为了保住任期、薪金的数额和支付而置于他个人意志的支配之下。

      他滥设新官署,委派大批官员到这里骚扰我们的人民,吞噬他们的财物。

      他在和平时期,未经我们立法机构同意,就在我们中间维持其常备军。

      他施加影响,使军队独立于文官政权之外,并凌驾于文官政权之上。

      他同他人勾结,把我们置于一种既不符合我们的法规也未经我们法律承认的管辖之下,而且还批准他们炮制的各种伪法案,以便任其在我们中间驻扎大批武装部队;不论这些人对我们各州居民犯下何等严重的谋杀罪,他可用加审判来庇护他们,让他们逍遥法外;他可以切断我们同世界各地的贸易;未经我们同意便向我们强行征税;在许多案件中剥夺我们享有陪审制的权益;以莫须有的罪名把我们押送海外受审;他在一个邻省废除了英国法律的自由制度,在那里建立专制政府,扩大其疆域,使其立即成为一个样板和合适的工具,以便向这里各殖民地推行同样的专制统治;他取消我们的许多特许状,废除我们最珍贵的法律并从根本上改变我们各州政府的形式;他终止我们立法机构行使权力,宣称他们自己拥有在任何情况下为我们制定法律的权力。

      他们放弃设在这里的政府,宣称我们已不属他们保护之列,并向我们发动战争。

      他在我们的海域里大肆掠夺,蹂躏我们的沿海地区,烧毁我们的城镇,残害我们人民的生命。

      他此时正在运送大批外国雇佣兵,来从事其制造死亡、荒凉和暴政的勾当,其残忍与卑劣从一开始就连最野蛮的时代也难以相比,他已完全不配当一个文明国家的元首。

      他强迫我们在公海被他们俘虏的同胞拿起武器反对自己的国家,使他们成为残杀自己亲友的刽子手,或使他们死于自己亲友的手下。

      他在我们中间煽动内乱,并竭力挑唆残酷无情的印地安蛮子来对付我们边疆的居民,而众所周知,印地安人作战的准则是不分男女老幼、是非曲直,格杀勿论。

      在遭受这些压迫的每一阶段,我们都曾以最谦卑的言辞吁请予以纠正。而我们一次又一次的情愿,却只是被报以一次又一次的伤害。

      一个君主,其品格被他的每一个只有暴君才干的出的行为所暴露时,就不配君临自由的人民。

      我们并不是没有想到我们英国的弟兄。他们的立法机关想把无理的管辖权扩展到我们这里来,我们时常把这个企图通知他们。我们也曾把我们移民来这里和在这里定居的情况告诉他们。我们曾恳求他们天生的正义感和雅量,念在同种同宗的分上,弃绝这些掠夺行为,因为这些掠夺行为难免会使我们之间的关系和来往中断。可他们对这种正义和同宗的呼声也同样充耳不闻。因此,我们不得不宣布脱离他们,以对待世界上其他民族的态度对待他们:同我交战者,就是敌人;同我和好者,即为朋友。

      因此我们这些在大陆会议上集会的美利坚合众国的代表们,以各殖民地善良人民的名义,并经他们授权,向世界最高裁判者申诉,说明我们的严重意向,同时郑重宣布:

      我们这些联合起来的殖民地现在是,而且按公理也应该是,独立自由的国家;我们对英国王室效忠的全部义务,我们与大不列颠王国之间大不列颠一切政治联系全部断绝,而且必须断绝。

      作为一个独立自由的国家,我们完全有权宣战、缔和、结盟、通商和采取独立国家有权采取的一切行动。

      我们坚定地信赖神明上帝的保佑,同时以我们的生命、财产和神圣的名誉彼此宣誓来支持这一宣言。

      〔说明〕

      杰斐逊起草了《独立宣言》的第一稿,富兰克林等人又进行了润色。大陆会议对此稿又进行了长时间的、激烈的辩论,最终作出了重大的修改。特别是在佐治亚和卡罗来纳代表们的坚持下,删去了杰斐逊对英王乔治三世允许在殖民地保持奴隶制和奴隶买卖的有力谴责。这一部分的原文是这样的:

      他的人性本身发动了残酷的战争,侵犯了一个从未冒犯过他的远方民族的最神圣的生存权和自由权;他诱骗他们,并把他们运往另一半球充当奴隶,或使他们惨死在运送途中。

      托马斯.杰斐逊(1743-1826),生于弗吉尼亚的一个富裕家庭。曾就读于威廉-玛丽学院。1767年成为律师,1769年当选为弗吉尼亚下院议院。他积极投身于独立运动之中,并代表弗吉尼亚出席大陆会议。他曾两次当选弗吉尼亚州长。1800年当选美国总统。

      杰斐逊在为自己的墓碑而作的墓志铭中这样写到:

      这里埋葬着托马斯.杰斐逊,美国《独立宣言》的作者,弗吉尼亚宗教自由法规的制定者和弗吉尼亚大学之父。

  • Web安全测试小结

    2011-03-31 00:06:16

    小小地总结一下下

    目前工作中应用到的Web安全测试分为以下4种:


    1、跨站脚本

    在页面的提交内容中加入JS代码,例如: <script>alert("hello")</script>
    如果服务器端未对提交内容中的特殊字符进行转义,而直接保存进数据库。那么,当再次访问此内容的时候,此JS代码将会被浏览器解析和执行,

    2、SQL注入

    SQL注入可以算得上很严重的漏洞,如果出现,将对后台数据库造成非常严重的威胁。
    检查方法分四步:
    第一步:加单引号。
    在类似于 这样的URL:http://www.51testing.com/spacecp.php?action=spaceblogs&op=edit&itemid=233044 (其实就是这篇日志的链接地址) 的itemid的值后面加单引号,like this:  itemid=233044'  然后提交此页面,如果页面返回信息中有类似于查询语句异常或者是数据库脚本出错。则初步判断可能会有SQL注入的问题。

    第二步:加两个单引号。
    还是拿以上的URL为例子,在itemid的值后面加两个单引号,like this:  itemid=233044''  然后提交此页面,如果页面返回正常,则执行第三步。

    第三步:加上或条件为真的语句。
    还是拿以上的URL为例子,在itemid的值后面加或条件为1的语句,like this:  itemid=233044' or '1'='1  然后提交此页面,如果返回了所有日志的信息,则可以肯定存在SQL注入的漏洞。

    第四步:加上与条件为假的语句。
    还是拿以上的URL为例子,在itemid的值后面加或条件为1的语句,like this:  itemid=233044' and '1'='2  然后提交此页面,如果返回结果为空,则结合第三步的结果,可以肯定存在SQL注入的漏洞。


    3、跨文件目录
    这个漏洞一般出现在WEB页面上传附件功能,或者是图片、文件资源显示的功能。
    右键显示图片、附件的属性,查看其URL,(待补充)


    4、权限漏洞
    这个漏洞比较容易检查出来,准备两个高低权限的帐号,比如一个管理员帐号A,一个普通用户B。
    第一步,使用A帐号登录,打开只有管理员才能操作的页面,记录该页面的URL(A)
    第二步,使用B帐号登录,访问URL(A),如果能够打开此页面,则说明存在权限漏洞。

     

     

  • LR 性能测试结果分析基本方法 (网络收集)

    2011-03-13 16:04:33

    一:性能分析的基础知识:
        1.几个重要的性能指标:响应时间、吞吐量、吞吐率、TPS(每秒钟处理的交易数)、点击率等。

        2.系统的瓶颈分为两类:网络的和服务器的。服务器瓶颈主要涉及:应用程序、WEB服务器、数据库服务器、操作系统四个方面。

        3.常规、粗略的性能分析方法:
       当增大系统的压力(或增加并发用户数)时,吞吐率和TPS的变化曲线呈大体一致,则系统基本稳定;若压力增大时,吞吐率的曲线增加到一定程度后出现变化缓慢,甚至平坦,很可能是网络出现带宽瓶颈,同理若点击率/TPS曲线出现变化缓慢或者平坦,说明服务器开始出现颈。

        4.性能分析基本原则:由外而内、由表及里、层层深入
        应用此原则,分析步骤具体可以分为以下三步:
       第一步:将得到的响应时间和用户对性能的期望值比较确定是否存在瓶颈;
       第二步:比较Tn(网络响应时间)和Ts(服务器响应时间)可以确定瓶颈发生在网络还是服务器;
       第三步:进一步分析,确定更细组件的响应时间,直到找出发生性能瓶颈的根本原因。
     
    二:以WEB应用程序为例来看下具体的分析方法:
        1.用户事务分析:
        a.事务综述图(Transaction Summary ):以柱状图的形式表现了用户事务执行的成功与失败。通过分析成功与失败的数据可以直接判断出系统是否运行正常。若失败的事务非常多,则说明系统发生了瓶颈或者程序在执行过程中发生了问题。
        b.事务平均响应时间分析图(Average Transaction Response Time): 该图显示在测试场景运行期间的每一秒内事务执行所用的平均时间,还显示了测试场景运行时间内各个事务的最大值、最小值和平均值。通过它可以分析系统的性能走向。若所有事务响应时间基本成一条曲线,则说明系统性能基本稳定;否则如果平均事务响应时间逐渐变慢,说明性能有下降趋势,造成性能下降的原因有可能是由于内存泄漏导致。
        c.每秒通过事务数分析图(Transaction per Second即TPS):显示在场景运行的每一秒中,每个事 务通过、失败以及停止的数量。通过它可以确定系统在任何给定时刻的实际事务负载。若随着测试的进展,应用系统在单位时间内通过的事务数目在减少,则说明服务器出现瓶颈。
         d.每秒通过事务总数分析图(Total Transactions per Second):显示场景运行的每一秒中,通过、失败以及停止的事务总数。若在同等压力下,曲线接近直线,则性能基本趋于稳定;若在单位时间内通过的事务总量越来越少,即整体性能下降。原因可能是内存泄漏或者程序中的缺陷。
          e.事务性能摘要图(Transaction Performance Summary):显示方案中所有事务的最小、最大平均执行时间,可以直接判断响应时间是否符合客户要求(重点关注事务平均、最大执行时间)。
          f.事务响应时间与负载分析图(Transaction Response Time Under load):通过该图可以看出在任一时间点事务响应时间与用户数目的关系,从而掌握系统在用户并发方面的性能数据。
          g.事务响应时间(百分比)图(Transaction Response Time(percentile)):该图是根据测试结果进行分析而得到的综合分析图。分析该图应从整体出发,若可能事务的最大响应时间很长,但如果大多数事务具有可接受的响应时间,则系统的性能是符合。
          h.事务响应时间分布情况图(Transaction Response Time (Distribution)):该图显示了测试过程中不同响应时间的事务数量。若系统预先定义了相关事务可以接受的最小和最大事务响应时间,则可以使用此图确定系统性能是否在接受范围内。
  • LR 性能分析名词解释 (网络收集)

    2011-03-13 14:27:35

    Transactions(用户事务分析)
      用户事务分析是站在用户角度进行的基础性能分析。
    1、Transation Sunmmary(事务综述)
      对事务进行综合分析是性能分析的第一步,通过分析测试时间内用户事务的成功与失败情况,可以直接判断出系统是否运行正常。

    2、Average Transaciton Response Time(事务平均响应时间)
      “事务平均响应时间”显示的是测试场景运行期间的每一秒内事务执行所用的平均时间,通过它可以分析测试场景运行期间应用系统的性能走向。
      例:随着测试时间的变化,系统处理事务的速度开始逐渐变慢,这说明应用系统随着投产时间的变化,整体性能将会有下降的趋势。

    3、Transactions per Second(每秒通过事务数/TPS)
      “每秒通过事务数/TPS”显示在场景运行的每一秒钟,每个事务通过、失败以及停止的数量,使考查系统性能的一个重要参数。通过它可以确定系统在任何给定时刻的时间事务负载。分析TPS主要是看曲线的性能走向。
      将它与平均事务响应时间进行对比,可以分析事务数目对执行时间的影响。
      例:当压力加大时,点击率/TPS曲线如果变化缓慢或者有平坦的趋势,很有可能是服务器开始出现瓶颈。

    4、Total Transactions per Second(每秒通过事务总数)
      “每秒通过事务总数”显示在场景运行时,在每一秒内通过的事务总数、失败的事务总署以及停止的事务总数。

    5、Transaction Performance Sunmmary(事务性能摘要)
      “事务性能摘要”显示方案中所有事务的最小、最大和平均执行时间,可以直接判断响应时间是否符合用户的要求。
      重点关注事务的平均和最大执行时间,如果其范围不在用户可以接受的时间范围内,需要进行原因分析。

    6、Transaction Response Time Under Load(事务响应时间与负载)
      “事务响应时间与负载”是“正在运行的虚拟用户”图和“平均响应事务时间”图的组合,通过它可以看出在任一时间点事务响应时间与用户数目的关系,从而掌握系统在  用户并发方面的性能数据,为扩展用户系统提供参考。此图可以查看虚拟用户负载对执行时间的总体影响,对分析具有渐变负载的测试场景比较有用。

    7、Transaction Response Time(Percentile)(事务响应时间(百分比))
      “事务响应时间(百分比)”是根据测试结果进行分析而得到的综合分析图,也就是工具通过一些统计分析方法间接得到的图表。通过它可以分析在给定事务响应时间范围内能执行的事务百分比。

    8、Transaction Response Time(Distribution)(事务响应时间(分布))
      “事务响应时间(分布)”显示在场景运行过程中,事务执行所用时间的分布,通过它可以了解测试过程中不同响应时间的事务数量。如果系统预先定义了相关事务可以接受的最小和最大事务响应时间,则可以使用此图确定服务器性能是否在可以接受的范围内。

    ----------------------------------------------------------------------------------------

    Web Resources(Web资源分析)
        Web资源分析是从服务器入手对Web服务器的性能分析。

    1、Hits per Second(每秒点击次数)
      “每秒点击次数”,即使运行场景过程中虚拟用户每秒向Web服务器提交的HTTP请求数。
      通过它可以评估虚拟用户产生的负载量,如将其和“平均事务响应时间”图比较,可以查看点击次数对事务性能产生的影响。通过对查看“每秒点击次数”,可以判断系统是否稳定。系统点击率下降通常表明服务器的响应速度在变慢,需进一步分析,发现系统瓶颈所在。

    2、Throughput(吞吐率)
      “吞吐率”显示的是场景运行过程中服务器的每秒的吞吐量。其度量单位是字节,表示虚拟用在任何给定的每一秒从服务器获得的数据量。
      可以依据服务器的吞吐量来评估虚拟用户产生的负载量,以及看出服务器在流量方面的处理能力以及是否存在瓶颈。
      “吞吐率”图和“点击率”图的区别:
      “点击率”图,是每秒服务器处理的HTTP申请数。
      “吞吐率”图,是客户端每秒从服务器获得的总数据量。

    3、HTTP Status Code Summary(HTTP状态代码概要)
      “HTTP状态代码概要”显示场景或会话步骤过程中从Web服务器返回的HTTP状态代码数,该图按照代码分组。HTTP状态代码表示HTTP请求的状态。

    4、HTTP Responses per Second(每秒HTTP响应数)
      “每秒HTTP响应数”是显示运行场景过程中每秒从Web服务器返回的不同HTTP状态代码的数量,还能返回其它各类状态码的信息,通过分析状态码,可以判断服务器在压力下的运行情况,也可以通过对图中显示的结果进行分组,进而定位生成错误的代码脚本。

    5、Pages Downloader per Second(每秒下载页面数)
      “每秒下载页面数”显示场景或会话步骤运行的每一秒内从服务器下载的网页数。使用此图可依据下载的页数来计算Vuser生成的负载量。
      和吞吐量图一样,每秒下载页面数图标是Vuser在给定的任一秒内从服务器接收到的数据量。但是吞吐量考虑的各个资源极其大小(例,每个GIF文件的大小、每个网页的大小)。而每秒下载页面数只考虑页面数。
      注:要查看每秒下载页数图,必须在R-T-S那里设置“每秒页面数(仅HTML模式)”。

    6、Retries per Second(每秒重试次数)
      “每秒重试次数”显示场景或会话步骤运行的每一秒内服务器尝试的连接次数。
      在下列情况将重试服务器连接:
      A、初始连接未经授权
      B、要求代理服务器身份验证
      C、服务器关闭了初始连接
      D、初始连接无法连接到服务器
      E、服务器最初无法解析负载生成器的IP地址

    7、Retries Summary(重试次数概要)
      “重试次数概要”显示场景或会话步骤运行过程中服务器尝试的连接次数,它按照重试原因分组。将此图与每秒重试次数图一起使用可以确定场景或会话步骤运行过程中服务器在哪个时间点进行了重试。

    8、Connections(连接数)
      “连接数”显示场景或会话步骤运行过程中每个时间点打开的TCP/IP连接数。
      借助此图,可以知道何时需要添加其他连接。
      例:当连接数到达稳定状态而事务响应时间迅速增大时,添加连接可以使性能得到极大提高(事务响应时间将降低)。

    9、Connections Per Second(每秒连接数)
      “每秒连接数”显示方案在运行过程中每秒建立的TCP/IP连接数。
      理想情况下,很多HTTP请求都应该使用同一连接,而不是每个请求都新打开一个连接。通过每秒连接数图可以看出服务器的处理情况,就表明服务器的性能在逐渐下降。

    10、SSLs Per Second(每秒SSL连接数)
      “每秒SSL连接数”显示场景或会话步骤运行的每一秒内打开的新的以及重新使用的SSL连接数。当对安全服务器打开TCP/IP连接后,浏览器将打开SSL连接。

     

  • 日志 [2011年01月07日] vs2008升级方法 有效

    2011-01-07 01:53:07

    vs2008试用期到期解决办法[注册码]

    vs2008试用期结束之后, 或者在刚刚安装完成后

    在“控制面板”中启动“添加删除程序”,

    选中Vs2008,点击“更改、删除”, 别担心会真的删除IDE,在删除或之前还会有提示的。

    在出现的维护模式对话框中, 选择下一步,输入下面的CD-Key。

    点击升级->出现成功画面即可完美将试用版升级成为正式版。

    CD-Key:PYHYP-WXB3B-B2CCM-V9DX9-VDY8T 。

  • Python Excel操作 [待验证]

    2010-11-08 22:26:56

    PYTHON 操作Excel 先留着,未验证

    from win32com.client import Dispatch
    import win32com.client
    import re

    class xlsExcel:
        def __init__(self, filename=None):
            self.xlApp = win32com.client.Dispatch('Excel.Application')
            self.xlApp.visible = 1
            self.displayalerts = 1
            if filename:
                self.filename = filename
                self.xlBook = self.xlApp.Workbooks.Open(filename)
            else:
                self.xlBook = self.xlApp.Workbooks.Add()
                self.filename = ''#'d:\ftp\test2.xls'
       
        def save(self, newfilename=None):
            if newfilename:
                self.filename = newfilename
                self.xlBook.SaveAs(newfilename)
            else:
                self.xlBook.Save()   

        def close(self):
            self.xlBook.Close(SaveChanges=0)
            del self.xlApp

        def setCell(self, sheet, row, col, value):
            "set value of one cell"
            sht = self.xlBook.Worksheets(sheet)
            sht.Cells(row, col).Value = value

    #file operator
    FH = open('d:/ftp/dat','rb')
    #FH = open('d:/ftp/col_bdg.txt','rb')
    count = 0
    if __name__ == "__main__":
        xls = xlsExcel() #(r'd:\ftp\a.xls')
        xlsExcel.setCell(xls,1,1,1,"TableName")
        xlsExcel.setCell(xls,1,1,2,"Field")
        xlsExcel.setCell(xls,1,1,3,"Risk")
        row = 1
        while (FH):
            ++count
            aLine = FH.readline()
            if (aLine):          
                aLine = aLine.split()
                key0 = aLine[0]
                key1 = aLine[1]
                #key = re.compile(r'date')
                key = re.compile(r'phone|tel[\d ]|mail|fax|(_pass)$|pwd|password|address|^(name)$|[^(tel|dic|rea|ty)]_name|idcard|(_no)$|date')
               
                #key2 = re.findall(r'phone|tel[\d ]|mail|fax|(_pass)$|pwd|password|address|^(name)$|[^(tel|dic|rea|ty)]_name|idcard|(_no)$|date',aLine[1].lower())
                #print key1,key2
                row = row + 1
                xlsExcel.setCell(xls,1,row,1,key0)
                xlsExcel.setCell(xls,1,row,2,key1)
                if ( key.search(aLine[1].lower())):
                    xlsExcel.setCell(xls,1,row,3,'1')
                    #can't to display the characters
                else:
                    continue
            else:
                break
        print count
    FH.close


  • [VBS] 获取windows下进程信息 [转]

    2010-11-08 21:59:53

    没时间验证,

     

    不过可以通过遍历进程的内容来判断哪些进程可以kill掉

     

    获取本机当前所有进程信息,代码如下:


    strComputer ="." 
    Set bjWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")  
    Set colProcess = objWMIService.ExecQuery("Select * from Win32_PerfFormattedData_PerfProc_Process",,48)  
     
    For Each objItem in colProcess  
    if objItem.Name <> "Idle" and objItem.Name <> "_Total" then   
        print  objItem.Name & ":"& objItem.PercentProcessorTime  
    end if  
    Next 

     


  • [VBS] Excel文件内容控制 [转]

    2010-11-08 21:54:03

    没时间验证,先留着

     

    (一) 使用动态创建的方法

    首先创建 Excel 对象,使用ComObj:

    oExcel = CreateObject( "Excel.Application" )

    1) 显示当前窗口:
    oExcel.Visible = True

    2) 更改 Excel 标题栏:
    oExcel.Caption = "应用程序调用 Microsoft Excel"

    3) 添加新工作簿:
    oExcel.WorkBooks.Add

    4) 打开已存在的工作簿:
    oExcel.WorkBooks.Open( "C:\Excel\Demo.xls" )

    5) 设置第2个工作表为活动工作表:
    oExcel.WorkSheets(2).Activate

    oExcel.WorksSheets( "Sheet2" ).Activate

    6) 给单元格赋值:
    oExcel.Cells(1,4).Value = "第一行第四列"

    7) 设置指定列的宽度(单位:字符个数),以第一列为例:
    oExcel.ActiveSheet.Columns(1).ColumnsWidth = 5

    8) 设置指定行的高度(单位:磅)(1磅=0.035厘米),以第二行为例:
    oExcel.ActiveSheet.Rows(2).RowHeight = 1/0.035 ' 1厘米

    9) 在第8行之前插入分页符:
    oExcel.WorkSheets(1).Rows(8).PageBreak = 1

    10) 在第8列之前删除分页符:
    oExcel.ActiveSheet.Columns(4).PageBreak = 0

    11) 指定边框线宽度:
    oExcel.ActiveSheet.Range( "B3:D4" ).Borders(2).Weight = 3
    1-左 2-右 3-顶 4-底 5-斜( \ ) 6-斜( / )

    12) 清除第一行第四列单元格公式:
    oExcel.ActiveSheet.Cells(1,4).ClearContents

    13) 设置第一行字体属性:
    oExcel.ActiveSheet.Rows(1).Font.Name = "隶书"
    oExcel.ActiveSheet.Rows(1).Font.Color = clBlue
    oExcel.ActiveSheet.Rows(1).Font.Bold = True
    oExcel.ActiveSheet.Rows(1).Font.UnderLine = True

    14) 进行页面设置:

    a.页眉:
    oExcel.ActiveSheet.PageSetup.CenterHeader = "报表演示"
    b.页脚:
    oExcel.ActiveSheet.PageSetup.CenterFooter = "第&P页"
    c.页眉到顶端边距2cm:
    oExcel.ActiveSheet.PageSetup.HeaderMargin = 2/0.035
    d.页脚到底端边距3cm:
    oExcel.ActiveSheet.PageSetup.HeaderMargin = 3/0.035
    e.顶边距2cm:
    oExcel.ActiveSheet.PageSetup.TopMargin = 2/0.035
    f.底边距2cm:
    oExcel.ActiveSheet.PageSetup.BottomMargin = 2/0.035
    g.左边距2cm:
    oExcel.ActiveSheet.PageSetup.LeftMargin = 2/0.035
    h.右边距2cm:
    oExcel.ActiveSheet.PageSetup.RightMargin = 2/0.035
    i.页面水平居中:
    oExcel.ActiveSheet.PageSetup.CenterHorizontally = 2/0.035
    j.页面垂直居中:
    oExcel.ActiveSheet.PageSetup.CenterVertically = 2/0.035
    k.打印单元格网线:
    oExcel.ActiveSheet.PageSetup.PrintGridLines = True

    15) 拷贝操作:

    a.拷贝整个工作表:
    oExcel.ActiveSheet.Used.Range.Copy
    b.拷贝指定区域:
    oExcel.ActiveSheet.Range( "A1:E2" ).Copy
    c.从A1位置开始粘贴:
    oExcel.ActiveSheet.Range.( "A1" ).PasteSpecial
    d.从文件尾部开始粘贴:
    oExcel.ActiveSheet.Range.PasteSpecial

    16) 插入一行或一列:
    a. oExcel.ActiveSheet.Rows(2).Insert
    b. oExcel.ActiveSheet.Columns(1).Insert

    17) 删除一行或一列:
    a. oExcel.ActiveSheet.Rows(2).Delete
    b. oExcel.ActiveSheet.Columns(1).Delete

    18) 打印预览工作表:
    oExcel.ActiveSheet.PrintPreview

    19) 打印输出工作表:
    oExcel.ActiveSheet.PrintOut

    20) 工作表保存:
    if not oExcel.ActiveWorkBook.Saved then
    oExcel.ActiveSheet.PrintPreview

    21) 工作表另存为:
    oExcel.SaveAs( "C:\Excel\Demo1.xls" )

    22) 放弃存盘:
    oExcel.ActiveWorkBook.Saved = True

    23) 关闭工作簿:
    oExcel.WorkBooks.Close

    24) 退出 Excel:
    oExcel.Quit

    (二) 使用VBS 控制Excle二维图

    1)选择当第一个工作薄第一个工作表
    set Sheet=oExcel.Workbooks(1).Worksheets(1)

    2)增加一个二维图
    achart=oSheet.chartobjects.add(100,100,200,200)

    3)选择二维图的形态
    achart.chart.charttype=4

    4)给二维图赋值
    set series=achart.chart.seriescollection
    range="sheet1!r2c3:r3c9"
    series.add range,true

    5)加上二维图的标题
    achart.Chart.HasTitle=True
    achart.Chart.ChartTitle.Characters.Text=" Excle二维图"

    6)改变二维图的标题字体大小
    achart.Chart.ChartTitle.Font.size=18

    7)给二维图加下标说明
    achart.Chart.Axes(xlCategory, xlPrimary).HasTitle = True
    achart.Chart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "下标说明"

    8)给二维图加左标说明
    achart.Chart.Axes(xlValue, xlPrimary).HasTitle = True
    achart.Chart.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "左标说明"

    9)给二维图加右标说明
    achart.Chart.Axes(xlValue, xlSecondary).HasTitle = True
    achart.Chart.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = "右标说明"

    10)改变二维图的显示区大小
    achart.Chart.PlotArea.Left = 5
    achart.Chart.PlotArea.Width = 223
    achart.Chart.PlotArea.Height = 108


     

  • [VBS] Excel文件格式设置

    2010-11-08 21:49:01

    '''打开已存在文件'''''

    set ExcelApp = CreateObject("Excel.Application")    
    set ExcelBook = ExcelApp.Workbooks.Open (filepath)   
    Set ExcelSheet = ExcelApp.Sheets.Item(1)     '''''指定sheet编号

    '''''设置属性'''''

    With ExcelSheet                            '''''描述性编程 With 与 End With 配对

    ''''' .Name = "apple"                     '''''用来指定sheet,也可不用.使用时必须与sheet编号相对应

    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''''''
    '''''设置列宽'''''
    ''''''''''''''''''

        .Columns("A:A").ColumnWidth = 20
        .Columns("B:B").ColumnWidth = 15
        .Columns("C:C").ColumnWidth = 10
        .Columns("D:D").ColumnWidth = 25
        .Columns("E:E").ColumnWidth = 20
        .Columns("F:F").ColumnWidth = 10

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '   .Columns("A:f").ColumnWidth = 20      '''''指定从A列至F列的列宽
    '   .Columns("b").ColumnWidth = 20        '''''指定b列列宽
    '   .Columns("F").ColumnWidth = 20        '''''指定F列列宽
    '   .Columns("A:A").ColumnWidth = 20      '''''指定A列列宽
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    ''''''''''''''''''''''''''''''''''''
    '''''设置行高'''''''''很少使用此设置
    ''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''行高至少>10
        .Rows(1).RowHeight = 15
        .Rows(2).RowHeight = 20
        .Rows(3).RowHeight = 25
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''''''''''''''''''''''''''''''''''''
    '''''设置显示区域的字体类型和大小'''''
    ''''''''''''''''''''''''''''''''''''''

    ''''''''''''''''''
    '''''字体类型'''''
    ''''''''''''''''''
                      
        .Range("A:A").Font.Name = "Arial"
        .Range("B:B").Font.Name = "宋体"
        .Range("C:C").Font.Name = "黑体"
        .Range("D:D").Font.Name = "新宋体"
        .Range("E:E").Font.Name = "Times New Roman"
        .Range("F:F").Font.Name = "Times New Roman"

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '   .Range("A:D").Font.Name = "Arial"  
    '   .Range("a:b").Font.Name = "Arial"
    '   .Range("A:f").Font.Name = "Arial"
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''''''''''''''''
    '''''字体大小'''''
    ''''''''''''''''''

        .Range("A:A").Font.Size = 12  
        .Range("B:B").Font.Size = 16
        .Range("C:C").Font.Size = 20

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '   .Range("A:F").Font.Size = 6  
    '   .Range("a:b").Font.Size = 8
    '   .Range("A:f").Font.Size = 10
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''''''''''''''''''''''
    '''''给指定区域赋值'''''
    ''''''''''''''''''''''''

        .Range("A1").Value = "用例名称"             
        .Range("B1").Value = "测试号码"
        .Range("C1").value = "号码类型"
        .Range("D1").value = "执行时间"
        .Range("E1").value = "检查点描述"    
        .Range("F1").value = "检查结果"

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '   .Range("a1").Value = "for"             '''''A1单元格内容为 for
    '   .Range("b:b").Value = "test"           '''''B列内容都为 test
    '   .Range("c:A").Value = "test"           '''''从A列至C列的内容均为 test
    '   .Range("a3:F3").Value = "great"        '''''第三行,从A至F列均为 great
    '   .Range("b3:E6").Value = "day"          '''''从B3单元格至E6单元格矩形区间范围的值均为 day
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''''''''''''''''
    '''''合并居中'''''
    ''''''''''''''''''

        .Range("B1:C1").Merge                  '''''B1单元格与C1单元格合并居中

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '   .Range("a:f").Merge                    '''''A列至F列合并居中
    '   .Range("B3:g7").Merge                  '''''从B3单元格至G7单元格矩形区间合并居中
    '   .Range("a2:f2").Merge                  '''''A2,B2,C2,D2,E2,F2单元格合并居中
    '
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''设置文字颜色'''''颜色取值范围:0~56''0为无颜色''
    ''''''''''''''''''''''''''''''''''''''''''''''''''''

        .Range("A1").Font.ColorIndex = 5

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '   .Range("g:G").Font.ColorIndex = 48       '''''G列的字体颜色设为48
    '   .Range("A:c").Font.ColorIndex = 28       '''''A列至C列的字体颜色设为 28
    '   .Range("b2:c2").Font.ColorIndex = 3      '''''B2至C2单元格字体颜色设为 3
    '   .Range("A1:c4").Font.ColorIndex = 9      '''''A1至C4单元格矩形区间字体颜色设为 9
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''''''''''''
    '''''加粗'''''
    ''''''''''''''
        
        .Range("A1").Font.Bold = True             

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '   .Range("g:G").Font.Bold = True           '''''G列的字体设为粗体
    '   .Range("A:C").Font.Bold = True           '''''A列至C列的字体设为粗体
    '   .Range("b3:g5").Font.Bold = True         '''''B3至G5单元格矩形区间的字体设为粗体
    '   .Range("c1:G1").Font.Bold = True         '''''C1至G1单元格的字体设为粗体
    '
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''''''''''''''''
    '''''对齐方式'''''
    ''''''''''''''''''

    '''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''' 1     常规方式   '''''''''''''''
    ''''''''''''''' 2     左对齐     '''''''''''''''
    ''''''''''''''' 3     居中       '''''''''''''''
    ''''''''''''''' 4     右对齐     '''''''''''''''
    ''''''''''''''' 5     填充方式   '''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''

        .Range("A:A").HorizontalAlignment = 4        '''''右边对齐   A列所有行
        .Range("B:B").HorizontalAlignment = 1        '''''常规方式
        .Range("C:C").HorizontalAlignment = 2        '''''左对齐
        .Range("D:D").HorizontalAlignment = 3        '''''居中
        .Range("E:E").HorizontalAlignment = 5        '''''填充方式

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '
    '
    '
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    ''''''''''''''''''''''''''''''''''''''''''''''
    '''''单元格背景'''''取值范围0~56'''0为无颜色''
    ''''''''''''''''''''''''''''''''''''''''''''''

        .Range("A1:F1").Interior.ColorIndex = 45

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '
    '
    '
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''' 以下语句可以显示所有颜色对应的数值
    ''''' For i=1 to 56
    '''''    A="A"&i
    '''''    B="c"&i
    '''''    .Range(A).Interior.ColorIndex = i
    '''''    .Range(B).Value = i  
    ''''' NEXT
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    ''''''''''''''''''''
    '''''单元格边框'''''
    ''''''''''''''''''''

    '''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''    Borders参数    '''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''' 1     左边框     '''''''''''''''
    ''''''''''''''' 2     右边框     '''''''''''''''
    ''''''''''''''' 3     上边框     '''''''''''''''
    ''''''''''''''' 4     下边框     '''''''''''''''
    ''''''''''''''' 5     左斜线     '''''''''''''''
    ''''''''''''''' 6     右斜线     '''''''''''''''
    ''''''''''''''' 不可为0          '''''''''''''''
    ''''''''''''''' 其余作用未知     '''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''' Linestyle参数    '''''''''''''''
    ''''''''''''''' 设置边框线条格式 '''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''''''''' 0     不显示     '''''''''''''''
    ''''''''''''''' 1     实线条显示 '''''''''''''''
    ''''''''''''''' 其余参数未知     '''''''''''''''
    ''''''''''''''' 不常用           '''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''

        .Range("A:F").Borders(1).LineStyle. = 1
        .Range("A:F").Borders(2).LineStyle. = 1
        .Range("A:F").Borders(3).LineStyle. = 1
        .Range("A:F").Borders(4).LineStyle. = 1

    '''''''''''''''''''''''''''''''''''''''''''''''以下设置方式均合法
    '
    '
    '
    '
    '
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


    End with

    '''''保存退出'''''

        ExcelBook.Save                  
        ExcelBook.Close                  
    Set ExcelBook = nothing
        ExcelApp.Quit    


  • [VBS] Excel文件操作

    2010-11-08 21:33:04

    '################################################
    '## 功    能:打开指定路径的Excel文件              ##
    '## 输入参数:Excel路径                          ##
    '## 输出参数:无                                ##
    '## 创建日期:2010-01-24                        ##
    '## 修改日期:2010-01-24                         ##
    '################################################

    Function xls_OpenExcelFile(FilePath)

    Dim ExcelApp

    Dim ExcelBook

    Set ExcelApp = CreateObject("Excel.Application")       '创建Excel对象
    Set ExcelBook = ExcelApp.Workbooks.Open (FilePath)     '打开指定路径的Excel表格

        ExcelApp.Visible = true                   'true 为显示excel对象,false为不显示

    Set ExcelSheet = ExcelApp.Sheets.Item(1)      '选择指定Sheet页

    '
    '单元格操作代码区域
    '
    '

          ExcelBook.Save                          '保存工作表
          ExcelApp.Quit                           '退出Excel对象
    Set ExcelApp = nothing                        '释放Excel对象

    End Function

    '################################################
    '## 功    能:创建指定路径的Excel文件             ##
    '## 输入参数:Excel文件路径                      ##
    '## 输出参数:无                                ##
    '## 创建日期:2010-01-24                        ##
    '## 修改日期:2010-01-24                        ##
    '################################################

    Function xls_CreateExcelFile(FilePath)

    Dim ExcelApp

    Dim ExcelSheet

    Set ExcelApp = CreateObject("Excel.Application")    '定义一个excel对象
        ExcelApp.Workbooks.Add                          '新建一个excel实例
        ExcelApp.Visible = true                         '显示excel对象
    Set ExcelSheet = ExcelApp.Sheets.Item(1)            '获取工作簿的第一个Sheet页
    '   ExcelApp.Sheets.Item(1).Select                  '获取工作簿的第一个Sheet页,同样效果

    ''''单元格操作代码区域

    '''''例如:    ExcelSheet.cells(1,1).value = "abcd"               


        ExcelApp.ActiveWorkbook.SaveAs FilePath         '保存工作表
        ExcelApp.Quit                                   '退出Excel对象
    Set ExcelApp = nothing                              '释放Excel对象

    End Function

  • Python 学习资料

    2010-11-03 17:33:09

    JavaEye上面的

    http://fyan.javaeye.com/blog/796459
  • [BAT] for 语句 纠结啊~~~~

    2010-10-30 17:47:05

    心寒,自学这么久还是没有掌握   for 的语法


    在windows下用的清理CVS目录的批处理脚本

    for /r /d %D in (CVS*) do @rmdir /q /s "%D

  • Python 中的 for 语句[0]

    2010-10-30 10:19:32

    在python中for语句被赋于了更大的灵活性,不仅用于循环,也能用来进行遍历。
                                                    (貌似JS也是这个功能。)

    一、循环


    二、遍历

    2.1  遍历字符串

    例如:26个英语字母,分别用1~26标识,对于attitude单词这个标识和为多少?

    写法1:sum(ord(ch)-96 for ch in list('attitude'))    
    写法2:sum(ord(ch)-96 for ch in 'attitude')

    注释:在python中,字符串、列表(list)都是可遍历的元素。
  • 同行概述QTP在项目中应用[0]

    2010-10-28 10:17:23

    感谢  飞鱼的传说  的分享

    以下为整理内容:

        去年9月被抽调来做QTP,因为公司原来做QTP那位辞职了,那时候公司也才开始做,只有他一个,这位兄台写了一个框架,把对象的属性全存到数据库,利用表关联在脚本运行时动态建立对象结构识别对象,这个框架写得那叫一个天书,几乎没人能看懂。我一个人做了3,4个月,北美那边还有2个同事,才开始学QTP,所以不懂的问题也只有问她们,主要是看她们的代码,我们全是描述性编程,所有的操作全封装在Function里,看了她们的代码才知道原来vbs可以写得这么复杂。今年年初,来了2位高手,一个在HP干了3年,另外一个也是在上家公司带QTP团队的,公司开始砸钱了。这时候真正开始高速成长,我们公司系统前台是FLEX,加上后台service不是太稳定,同步是个大问题,所以脚本要考虑到这一点,必须在很多地方用不同的方式验证页面是否真正到达,现在我们做的就是维护一个自动化的API,所有的操作放到API里面,复杂的逻辑都写进Function里,在Action里直接添加检查点。现在想来做自动化最难的是什么,不是语言,不是QTP技术,而是解决问题的思路,当有的对象不能识别的时候这么绕过,当然最好找开发改,但是也需要想想办法绕过去,是否可用坐标,用坐标是否有偏差,是否可以通过TAB建从其他能识别的对象开始查找焦点,然后进行操作。
       最后说说所谓的框架,经常听人谈论,但是把自动化做成功这个一点不重要,而是脚本的质量,是否跑不挂,错误信息打印是否完整利于查找问题等等,框架只是一个改进,例如QTP批量跑脚本自带的testbatchrunner不好用,我们就用vbs自己写了个自动化QTP自身的小程序,跑完把结果输出到指定的文件夹。
       就说这么多

    你如果把对象结构全写进function里,在Action里全是检查点,在每个脚本里关联functin library,对象更新了直接在function library里replace all就可以了,你用框架同样不可避免这样的问题

    我们用到QTP的功能就是描述性编程去识别对象,场景恢复,虚拟对象,对象库都没用到,错误处理就是用的reportmanager对象在脚本里打印出错误信息,没进行更多的封装之类的,

  • QTP中对象库的合并[0]

    2010-10-28 09:34:50

    第一步:把需要加到共享对象库中的各个用例脚本的对象库,分别导出成.tsr文件。
    操作方法:先用QTP打开已经录制完毕的脚本后,选择Resources——> Object Repository.然后file——>export……取名导出文件。


    第二步:把需要加入到共享对象库中的各个用例脚本的对象库,合并对象及对象属性,形成一个大的共享对象库。


    第三步:调用上面保存好的共享对象库。给新的脚本使用。
    操作步骤:Resources——>Associate Repository.选择上面保存好的共享对象库的。tsr文件。加入到Associate Repository

  • [VBS] 文件操作函数

    2010-01-25 00:18:48

    '################################################
    '##  功    能:获取文件名                      ##
    '##  输入参数:文件路径                        ##
    '##  输出参数:文件名                          ##
    '##  创建日期:2010-01-19                      ##
    '##  修改日期:2010-01-19                      ##
    '################################################

    Function fun_GetBaseName()

    Dim FSO
    Set FSO=CreateObject("Scripting.FileSystemObject")
        fun_GetBaseName=FSO.GetBaseName(fun_GetFileFullPath())
    Set FSO=Nothing

    End Function


     

211/212>
Open Toolbar