רעÓÚ×Ô¶¯»¯²âÊÔ,ÐÔÄܲâÊÔ.......

·¢²¼ÐÂÈÕÖ¾

  • TestCompleteʹÓÃÈ«¾Ö±äÁ¿(Ô­´´)

    2009-09-13 22:51:16

                             

      ÔÚʹÓÃTestcomplete£¨ÒÔϼò³ÆTC£©¹ý³ÌÖУ¬¾­³£»áÔڽű¾»òÕßProjectÖ®¼ä´«µÝ±äÁ¿Öµ£¬µ«ÊÇVBS½Å±¾µÄÃæÏò¶ÔÏóÌØÐԱȽÏÈõ£¬ºÜÄÑͨ¹ý´«µÝÀàµÄÊôÐÔÀ´×öµ½ÕâÒ»µã¡£Í¬Ê±£¬vbsҲûÓÐPythonµÄ³Ö¾Ã´æ´¢µÄ¹¦ÄÜ¡£µ±È»Äã¿ÉÒ԰ѱäÁ¿´æ´¢ÔÚ±¾µØʵÌåÎļþÖУ¬µ«ÊÇÕâÑùµÄ×ö·¨Âé·³ÇÒЧÂÊÒ²²»¸ß¡£TC¸ø³öÁËÒ»ÖÖ½â¾ö·½°¸£¬ÄǾÍÊÇʹÓÃVariables¶ÔÏó¡£Õâ¸ö¶ÔÏó¹²ÓÐÈýÖÖÀàÐÍ£¬·Ö±ðΪ:project,project suite,network suite

    ·Ö±ð¶ÔÓ¦Á˲»Í¬µÄ×÷ÓÃÓò£¬µ±Ç°ÏîÄ¿£¬µ±Ç°ÏîÄ¿¼¯£¬Õ¾µã¼¯¡£

    ´´½¨variablesÓÐÁ½ÖÖ·½Ê½:

     1£©Í¨¹ý±à¼­Æ÷½øÐпÉÊÓ»¯±à¼­

     2£©Í¨¹ý½Å±¾½øÐб༭

    ÏÂÃæÎÒÃÇ·Ö±ð½øÐн²½â:

    ±à¼­Æ÷½øÐб༭ÓпÉÊÓ»¯£¬±ã½ÝµÄÓŵ㣬µ«ÊDz»¹»Áé»î¡£´ò¿ª±à¼­Æ÷ͨ¹ýµã»÷Project£¬project Suite£¬Nework Suite½Úµã¾Í¿ÉÒÔ´ò¿ª£¬½çÃæÖÐÖ÷ÒªÓÐÒÔϼ¸Ïî:

    Column

    Description

    Name

    ±äÁ¿Ãû³Æ

     

    Type

    ±äÁ¿µÄÀàÐÍ,·Ö±ðΪ Boolean,Double,Integer,Object£¬String

    Default Value

    ĬÈÏÖµ,Object¶ÔÏóûÓÐĬÈÏÖµ,Èç¹û¶ÔĬÈÏÖµ½øÐÐÐ޸ģ¬»áÓ°ÏìËùÓÐʹÓøÃÏîÄ¿µÄÈË

    Local Value

    µ±Ç°±äÁ¿Öµ,Õâ¸öֵȡ¾öÓÚµ±Ç°´ò¿ªÏîÄ¿µÄ¼ÆËã»ú,Object¶ÔÏóÖ»ÄÜÔÚÔËÐÐʱ±»ÉèÖá£

    Category

    ¶Ô±äÁ¿½øÐзÖÀ࣬ÓÃÓÚ¸üºÃµÄ¹ÜÀí±äÁ¿£¬±ÈÈ磬¶Ô±äÁ¿½øÐÐÅÅÐò£¬·ÖÀà

    Description

    ±äÁ¿µÄÎÄ×ÖÃèÊö

     

    ʹÓýű¾¶Ôvariables½øÐб༭¾ßÓÐÁé»îµÄÌص㡣

     ´´½¨±äÁ¿

       Project.Variables.Addvariable Name,Type   ---NameΪ±äÁ¿Ãû TypeΪ±äÁ¿ÀàÐÍ

     Ð޸ıäÁ¿

       Project.Variables.Name = ±äÁ¿Öµ  ---NameΪ±äÁ¿Ãû

     »ñÈ¡±äÁ¿µÄÊôÐÔ

      

    GetVariableCategory

    ·µ»Ø±äÁ¿·ÖÀà

    GetVariableDefaultValue

    ·µ»Ø±äÁ¿Ä¬ÈÏÖµ

    GetVariableDescription

    ·µ»Ø±äÁ¿ÃèÊö

    GetVariableName

    ¸ù¾ÝÒ»¸ö±äÁ¿¼¯ºÏµÄË÷ÒýÖµ·µ»Ø±äÁ¿Ãû³Æ

    GetVariableType

    ·µ»Ø±äÁ¿ÀàÐÍ

    VariableCount

    ·µ»Ø±äÁ¿µÄ¸öÊý

    »ñÈ¡±äÁ¿Öµ

     Project.variables.Name    Or

     Project. .Variables.VariableByName(Name) ---NameΪ±äÁ¿Ãû

     

    ɾ³ý±äÁ¿

     Project.Variables.RemoveVariable   Name  ---NameΪ±äÁ¿Ãû

    PS£ºÀûÓÃPythonµÄ³Ö¾Ã´æ´¢Ò²¿ÉÒÔʵÏÖÈ«¾Ö±äÁ¿µÄ´æ´¢£¬Ê¹Ó㬷ÖÀàÒÔ¼°ÅÅÐò¡£

  • ×ï¹ý,×ï¹ý!

    2009-04-13 01:53:28

      ½ñÌìÖÜÄ©³öÈ¥¹ä½Ö,¿´µ½Â·ÅÔÓÐÂôС½ðÓãµÄ,¼ûÁÔÐÄϲ¾ÍÂòÁ˼¸Ìõ,²»³ÉÏë»Øµ½¼Òºó²»¾Ã¾ÍËÀÁ˼¸Ìõ.×ï¹ý°¡,Ï£Íû½ðÓãµÄÔÚÌìÖ®Áé¿ÉÒÔ¿íË¡ÎÒµÄÎÞÐÄ֮ʧ.
  • VbscriptÖеĶ¯Ì¬Êý×éÒÔ¼°´ÓexcelÖÐÈ¡Öµ£¬·ÅÈ붯̬Êý×éÖÐ

    2008-06-04 23:55:00

    1£®Vbscr¨©ptÖеĶ¯Ì¬Êý×éÒÔ¼°´ÓexcelÖÐÈ¡Öµ£¬·ÅÈ붯̬Êý×éÖС£

    '¶¨ÒåÈ«¾Ö±äÁ¿£¬¹©ËùÓгÌÐò¿éʹÓÃ,·Ö±ðΪexcelʵÀý¶ÔÏó£¬excelÁÐÖµÊý×é

    dim objExcel

    dim ary()

    ' ¶¨Òå°ÑexcelÖÐÁеÄֵת»»ÎªÊý×éµÄº¯Êý

    function testF(i)

    redim ary(i)

    ary(i)=objexcel.cells(i,1).value

    testF = ary(i)

    end function

     

    sub test

    '´ò¿ªexcel¶ÔÏó

    set ¨­bjExcel = createobject("excel.application")

    set ¨­bjwk=objexcel.workbooks.open("d:\myfile.xls")

    Set Driver = DDT.ExcelDriver("d:\MyFile.xls", "Sheet1")

    for i =1 to 4

     log.message testF(i)

    next

    end sub

     

     

  • TestCompleteÖеÄSys¶ÔÏóµÄÊôÐԺͷ½·¨(1)

    2008-06-03 06:24:53

    2.SYS ¶ÔÏó

     

    The Sys object ¡°represents¡± the system in your scr¨©pts -- everything outside TestComplete. Its methods and properties allow you to control scr¨©pt execution, interact with active windows, simulate key presses, etc. For instance, the following code assigns the clipboard contents to cl:

    VBscr¨©pt Copy Code

    Set cl = Sys.Clipboard

    Jscr¨©ptCopy Code

    cl = Sys.Clipboard();

    Delphiscr¨©pt, DelphiCopy Code

    cl: = Sys.Clipboard;

    C++scr¨©pt, C#scr¨©pt, C++, C#Copy Code

    cl = Sys["Clipboard"]();

    Sys Properties

    Sys PropertiesSys Properties

    Name

    Descr¨©ption

    _NewEnum (inherited from Common)

    Returns an enumerator for the collection of children that belongs to the current object.

    ChildCount (inherited from Common)

    Returns the number of child objects of the current object.

    ·µ»Øµ±Ç°¶ÔÏóµÄ×Ó¶ÔÏóµÄÊýÄ¿

    Clipboard

    Puts text or images to the clipboard or retrieves the clipboard data.

    °ÑÎı¾»òÕßͼƬ·ÅÈë¼ôÌù°å»òÕß»ñÈ¡¼ôÌù°åÖеÄÊý¾Ý

    CORBA

    Returns the CORBA object, which lets you work with CORBA objects that reside on the local or remote computer.

    ·µ»ØCORBA¶ÔÏó,ÈÃÄã¿ÉÒÔ²Ù×÷±¾»ú»òÕßÔ¶³ÌµÄCORBA¶ÔÏó

    CPU

    Stores the model and frequency of the computer¡¯s processor(s).

    ´æ´¢¼ÆËã»ú´¦ÀíÆ÷µÄÐͺźÍƵÂÊ

    CPUCount

    Returns the number of CPUs installed on your computer.

    ·µ»Ø±¾»úCPUµÄ¸öÊý

    CPUUsage

    Returns the current approximate percentage of CPU time used by the operating system and all running processes.

    ·µ»Ø´ó¸ÅµÄµ±Ç°±»²Ù×÷ϵͳÒÔ¼°ËùÓнø³ÌÕ¼ÓõÄCPU°Ù·Ö±È

    Desktop

    Returns the desktop as the Desktop object.

    ·µ»Ø×ÀÃæ¶ÔÏó

    DomainName

    Returns the name of the domain to which the current computer belongs.

    ·µ»Ø±¾»úËùÊôÓòµÄÃû×Ö

    Exists (inherited from Common)

    Tells whether an object exists in the system.

    ¼ìÑé¶ÔÏóÊÇ·ñ³öÏÖ

    FullName (inherited from Common)

    Specifies the full name that uniquely identifies the object in TestComplete.

    Ϊ¶ÔÏóÔÚTCÖÐÖ¸¶¨¶ÀÒ»ÎÞ¶þµÄ¹ØÁªÃû³Æ

    HostName

    The name of the current computer.

    ±¾µØ¼ÆËã»úÃû

    Id (inherited from Common)

    Returns ID of the current object.

    µ±Ç°¶ÔÏóID

    MappedName (inherited from Common)

    Returns the custom name that is mapped to the original name of the current object, as a string.

    ·µ»ØÓ³ÉäÃû³Æ

    MemUsage

    Returns the integral size of memory occupied by the processes which are children of the sys object.

    ·µ»Ø½ø³ÌÕ¼ÓеĽø³Ì´óС

    Name (inherited from Common)

    Returns the name of the object as a string.

    ·µ»Ø¶ÔÏóÃû³Æ

    OleObject

    Returns an OLE object specified by name.

    ·µ»ØOLE¶ÔÏó

    OSInfo

    Returns the information on the currently installed operating system as OSInfo object.

    ·µ»Øµ±Ç°°²×°ÏµÍ³µÄÐÅÏ¢

    Parent (inherited from Common)

    Returns the parent object of the current one.

    ·µ»Øµ±Ç°¶ÔÏóµÄ¸¸¶ÔÏó

    UserName

    The name of the user under whose account you are currently working.

    ·µ»Øµ±Ç°Óû§Ãû³Æ

    Sys Methods

    Sys MethodsSys Methods

    Name

    Descr¨©ption

    Child (inherited from Common)

    Returns one child object by its index.

    ͨ¹ýIndex·µ»Ø×Ó¶ÔÏó

    Find (inherited from Common)

    Returns an object by the values of the specified properties.

    ͨ¹ýÖ¸¶¨ÊôÐÔÖµ·µ»Ø¶ÔÏó

    FindAll (inherited from Common)

    Returns an array of objects by the values of the specified properties.

    ͨ¹ýÖ¸¶¨ÊôÐÔÖµ·µ»Ø¶ÔÏóÊý×é

    FindAllChildren (inherited from Common)

    Returns an array of child objects by the specified property values.

    ͨ¹ýÖ¸¶¨ÊôÐÔÖµ·µ»Ø×Ó¶ÔÏóÊý×é

    FindChild (inherited from Common)

    Returns a child object by the specified property values.

    ͨ¹ýÖ¸¶¨ÊôÐÔÖµ·µ»Ø×Ó¶ÔÏó

    FindId (inherited from Common)

    Returns an object by its ID.

    ͨ¹ýID·µ»Ø¶ÔÏó

    HighlightObject

    Highlights a visible onscreen object with a flashing color rectangle.

    ¶ÔÏó¸ßÁÁ

    Keys

    Simulates one or several key presses.

    Ä£ÄâÊäÈë

    ObjectFromPoint

    Returns the visual object that contains the pixel with the specified coordinates.

    ·µ»ØÖ¸¶¨×ø±êµÄ¶ÔÏóͼÏñ

    Process

    Returns a ²é¿´(896) ÆÀÂÛ(0) ÊÕ²Ø ·ÖÏí ¹ÜÀí

  • ÔÚtestcompleÖÐʹÓùؼü×ÖÇý¶¯²âÊÔµÄÒ»µãÏë·¨

    2008-05-09 14:06:24

      ×î½üÔÚÑо¿×Ô¶¯»¯²âÊÔ¿ò¼ÜµÄ×ÊÁÏ,ºÜ¶à¶¼ÊÇʹÓÃrobot¹¤¾ß½øÐÐÀ©Õ¹µÄ,ÄÇôÔÚTCÉÏÄܲ»ÄÜʵÏÖµÄ,×î½ü×öÁËÒ»µãÑо¿(¶Ô¼òµ¥µÄµÇ¼½çÃæ½øÐвâÊÔ) ,×ܽáµÄ¾­ÑéÈçÏÂ:

    excel±íÖеÄÊý¾ÝÈçÏ£º

    ¶¯×÷ÀàÐÍ ¶ÔÏó´°¿Ú ¶ÔÏóÀàÐÍ ¶ÔÏó±ê¼Ç Ö´Ðж¯×÷ Êý¾Ý
    G TFrmLogin Textbox TRzComboBox/Edit keys ksnq zjnq
    G TFrmLogin Textbox2 TRzEdit keys 1 1
    G TFrmLogin Button TRzBmpButton click

    TFrmLogin£º µÇ¼´°¿Ú

    Textbox£º¿Ø¼þÀàÐÍ

    TRzComboBox/Edit£º¿Ø¼þÃû³Æ£¨´Ë¿Õ¼äΪComboBox£¬TCʶ±ðµÄʱºò¾Í»áʶ±ð³ÉÁ½¸ö¿Ø¼þ£ºTRzComboBox£¬Edit£©

    ÎÒTRzComboBox/EditÕâÁ½¸ö¿Ø¼þдÔÚÁËÒ»Æð£¬ÓÃ/·Ö¸ôÆðÀ´£¬ÕâÊÇΪÁËʹexcel±íÖÐÿһÐж¼ÊÇ×îµ×²ãµÄ¿Ø¼þ£¬

    Ò²¾ÍÊÇÎÒÃÇ¿ÉÒÔ»áÖ±½Ó²Ù×÷µÄ¿Ø¼þ¶ÔÏó¡£ÄÇôÎÒÃǰѾßÓвã´ÎµÄ¿Ø¼þ·ÅÔÚÁËÒ»Æð£¬ÄÇôÔÚʹÓÃʱ£¬ÎÒÃÇ»¹µÃ

    ·Ö¿ª£¬ËùÓпÉÒÔʹÓÃSplitº¯Êý£¬°ÑËüÃÇ·Ö¿ª²¢´æÈëÒ»¸öÊý×éÖУ¬·Ö¿ªÊ¹ÓþͿÉÒÔÁË¡£¾ßÌå´úÂëÈçÏ£º


    Sub Test1
      Dim w1
      Dim p1
      Dim w2
      Dim w3
      dim y
      'Êý¾ÝÁÐ,ÉèÁ¢´Ë±äÁ¿µÄÄ¿µÄÊÇΪÁËʹÊý¾ÝµÄÊäÈë¸üÁé»î£¬ÈçÉÏ±í£¬ÎÒÃÇÔÚµÚ6£¬7Áдæ·ÅÊý¾Ý£¬ÄÇôÎÒÃÇ

     Ê¹Óò»Í¬µÄÊý¾ÝÖ»Ðè¸ü»»±äÁ¿µÄÖµ¼´¿É
    Dim Data

    'excel±íµÄÐÐ
    x=2 
    ' ´ò¿ª²âÊÔÓ¦ÓóÌÐò
    set p = testedapps.items("jcysystem36").run
      Set w1 = Aliases.Sys
      Set p1 = w1.JcySystem36
      '-------------------------------
      '´ò¿ªEXCElÎĵµ£¬²¢´ÓÖжÁÈ¡Êý¾Ý
        Set ¨­bjExcel = CreateObject("Excel.Application")
      Set ¨­bjWorkbook = objExcel.Workbooks.Open ("D:\myfile.xls")
     
     
      '¶ÔÓÚ¸´ÔӵĿؼþ£¬°Ñ·¾¶Ð´ÔÚÒ»¸öcellÖУ¬²¢Óá°/¡±·Ö¸ô¿ªÀ´£¬Ê¹ÓÃsplit£¨£©´¦Àí£¬×ª»¯ÎªÊý×é
      y =  objExcel.Cells(x, 4).Value
     myArry = split(y,"/",-1,1)

    'µÇ¼½çÃæ
    Set w2 = p1.Window(objExcel.Cells(X,2).Value, "ϵͳµÇ¼")

    'µã»÷Óû§ÃûÊäÈë¿ò²¢ÊäÈëÊý¾Ý
    call w2.window(myArry(0)).window(myArry(1)).click()
     call w2.window(myArry(0)).window(myArry(1)).keys(objExcel.Cells(X,Data).Value)

    'µã»÷ÃÜÂë¿ò²¢ÊäÈëÊý¾Ý
    call w2.window(objExcel.Cells(X+1,4).Value).click() 
     call w2.window(objExcel.Cells(X+1,4).Value).keys(objExcel.Cells(X+1,Data).Value)

    'µã»÷È·¶¨°´Å¥
    call w2.window(objExcel.Cells(X+2,4).Value,"","2").click()

      objExcel.Quit

    End Sub

    ÕâÊÇÒ»¸ö¼òµ¥µÄÀý×Ó£¬¼ÌÐøÐèÒª°Ñ¿ò¼Ü×÷µÄ¸üÉîÈ룬°ÑһЩÂß¼­ÌáÈ¡³öÀ´£¬»¹ÐèŬÁ¦°¡

     

  • TestcompleteÖÐÑ¡ÖÐtreeviewÖÐcheckboxµÄ·½·¨

    2008-03-17 02:41:33

    ·¢ÏÖ¶ÔTreeViewÖеÄcheckboxµÄ¼ÖƵĽű¾ÔڻطŹý³ÌÖУ¬½Å±¾ÊÇÎÞЧµÄ£¬ÎÞ·¨Ñ¡Öнڵ㡣ÏÖ±àдº¯Êý½â¾ö´ËÎÊÌâ¡£
    'º¯Êý
     Sub ClickCheckBox(tree, itemName) 
       Set item = tree.wItems.Item(itemName)
       x = item.TextBounds.Left - item.TextBounds.Height / 2
       y = item.TextBounds.Top + item.TextBounds.Height / 2
       Call tree.Click(x, y)
      End Sub

    Sub Test1
      Dim w1
      Set w1 = Sys.Process("WindowsApplication3").Form1.WinFormsObject("treeView1")
     Call ClickCheckBox(w1, "|½Úµã2|½Úµã3")
    End Sub