发布新日志

  • QTP指南中Flight的例子

    2011-02-16 09:39:02

    依照Tutorial的描述操作如下步骤:

    1.         Record Test

    2.         Add CheckPoints

    A.        Checking Objects

    B.        Checking Pages

    C.        Checking Text

    D.        Checking Tables

     

    3.         Parameterizing Test

    A.     Add Parameter Values to a Data Table

    B.     Modifying Steps Affected by Parameterization

     

    4.         Create Output Value

    Creating an Output Value

     

    5.         Using Regular Expression

    Working with Regular Expressions

     

     

    Testing your own application – getting started

    Procedure outlined

    1.         Plan your test

    Decide how to organize your test

    Which operations to record

    Decide how to store the objects in your test

    You can store the objects for each action in its corresponding local object repository, or you Can store the objects for each action in shared object repository, you can also use the same shared object repository for multiple actions. If you are new to testing, you may want to use a local object repository for each action. This is the default setting, and all objects are automatically added to the local repository of each action. If you are familiar with testing, it is probably most efficient to work in the shared object repository mode. In this mode, you can use shared object repository for one or more actions. This means that object information is kept in one central location. When the objects in your application change, you can update then in one location for multiple actions in multiple tests.

     

    2.         Recoded your test

    3.         Enhance your recorded test

    Add checkpoint

    Parameters

    Create output values

    Use regular expressions

    You can further enhance your test with programming and conditional and loop statements, which Add logic to your test!

     

    4.         Debug your test

    Debug your test to check that it operations smoothly and without interruption.

     

    5.         Run your test

    Run your test on your application or web site to check that the application functions as expected.

     

    6.        Analyze the test results

    Examine the result of your test to pinpoint defects in your application

     

    7.         Report defects

    If you have quality center installed, you can submit any defects discovered to a

    quality center database.

     

     

  • 本地对象库与共享对象库理解

    2011-02-14 14:20:46

    Work with Test Object

    Object repository:

    一般来讲,测试对象都是保存在库里面,库又可以分为本地库和共享库,那么该如何选择恰当的库来保存测试对象呢?

     

    在创建一个简单的测试的时候经常使用的库是本地对象库,尤其一下情况:

    1.         针对一个指定的程序,接口或者对象设置的时候,录制一个很少测试的时候;

    2.         不需要频繁修改对象属性是;

    3.         创建单一操作测试时;

    相反在下一情况下建议使用共享对象库:

    1.         使用关键字驱动测试技术创建测试时;

    2.         包含多个测试程序,接口或对象设置的多个测试时;

    3.         需要实施修改测试对象的属性或有规律的更新测试对象属性是;

    4.         经常进行多个测试和有规律的使用“Insert Copy of Action”和“Insert Call to Action”时;

     

    如何理解本地对象库?

    1.         QTP正对动作创建的一个新的对象库;

    2.         QTP获得这些新的对象的时候,会自动保存这些对象的信息到指定的本地对象库中,当共享数据库和这些新的对象存在一定关系时,QTP依然会把新的对象添加到本地对象库中;

    3.         当一个子对象被添加到本地对象库中,而父对象在共享对象库中时,QTP会自动的把共享库中的父对象异动到本地对象库中;

    4.         QTP在每次创建一个新的动作的时候,QTP会创建一个新的,指定的对象库并把这个新的测试对象保存在这个库中;

    5.         QTP在录制测试的时候,在不同的测试步骤中,遇到两个相同的测试对象,QTP会保存两个不同的测试对象到每一个对应的本地对象库中;

    6.         在保存测试的时候,本地对象库会一起被保存到这个测试中,不能单独保存;

     

    如何理解共享对象库呢?

    对于指定的动作,QTP会使用一个或多个共享对象库。在创建测试的时候,你可以指定一个共享对象库,也可以新建一个与之相关的共享对象库。在运行这个测试前必须保证你的测试中使用的共享对象库包含了所有的测试对象,否则运行失败。

    编辑共享对象库可以使用Object Repository Manager工具。共享对象库具有以下的属性:

    1.         QTP在获取一个已经存在共享库或本地库中的对象的时候,它会利用这些信息,而不会将该对象加入到对象库中;

    2.         当子对象被保存在本地对象库时,父对象如果在共享对象库,QTP会自动将父对象转移到本地对象库中;

    3.         QTP在获取测试对象的时候,首先会将对象添加本地对象库中,除非这个对象已经存在共享数据中;

    本地对象库可以被导出到共享对象库中,也可以替换共享对象库;对于相同的动作的对象,QTP可以直接把本地对象库的对象合并到共享数据库中。

     

    Local object Repository > Object Repository > only the specific component can access the stored objects.

    Notes: If you modify an object in the local object repository, your changes do not have any effect on any other component

     

    Shared object repository> Object Repository Manager> can be accessed by multiple components

    Notes: You can update them in one location for all the components that use this shared object repository.

     

     

    Local objects are saved locally with the component, and can be accessed only from that component. When using a shared object repository, you can use the same object repository for multiple components. You can also use multiple object repositories for each component.

     

     

    Deciding Whether to Use Local or Shared Object Repositories

     

     

    Local Object Repositories

    Few components

    Not frequently modify test object properties

     

    1.         QTP create new object repository for each component

    2.         QTP automatically stores the information with objects if the objects not exist in an associated shared object repository.

    3.         QTP add new objects to local object repository even if one or more shared object repositories are already associated with the component. Assumes object not exist the associated shared object.

    4.         If a child object is added to a local object repository, and its parents are in shared object repository, its parents are automatically moved to the local object repository.

    5.         When you save your component, the local object repository is automatically saved with it.

     

     

    Shared Object Repositories

    Creating components using keyword-driven methodologies

    1.         If you record operations on an object that already exists in either the shared or local object repository, QTP uses the existing information and does not add the object to the object repository.

    2.         If a child object is added to a local object repository, and its parents are in a shared object repository, its parents are automatically moved to the local object repository.

     

    Associated with the selected component

    Local objects are editable (black); shared objects are in read-only format (gray)

     

    This dialog box lists the object repository files associated with all the actions in the current test. You can change the associations and perform. other administrative tasks.

     

    Delete object

    You can delete objects from the local object repository using the Object Repository window. You can delete objects from a shared object repository using the Object Repository Manager. For more information

     

    Filter toolbar list, filter function.

     

     

    1.         Copy an object to the local object repository, its parent objects are also copied to the local object repository.

    2.         If an object or its parent objects use unmapped repository parameters, you cannot copy the object to the local object repository, make sure all repository parameters are mapped before copy.

    3.         If an object or its parent objects are parameterized using one or more repository parameters, the repository parameter values are converted when you copy the object to the local object repository.

    4.         If you are copying multiple objects to the local object repository, during the copy process you can choose to skip a specific object if it has unmapped repository parameters, or if it has mapped repository parameters whose values you do not want to convert. You can then continue copying the next object from your original selection.

     

    Object Properties and Property values—description properties, ordinal identifier, and additional details.

     

     

    Edit > Step Properties > Object Properties.

     

    Test object Details  > Restore mandatory property set

     

     

    Renaming Test Objects

     

     

    If you do not want to automatically update test object names for all occurrences of the test object, you can clear the Automatically update test and component steps when you rename test objects check box in the General tab of the Options dialog box (Tools > Options). If you clear this option, you will need to manually change the test object names in all steps in which they are used, otherwise your component run will fail.

     

     

    Define new property

     

    Mapping repository parameter value??

     

    Locating an object in the object repository

     

    Export local objects to a new shared object repository = a file with a .tsr extension

     

     

    Test object classes:

    Standard Windows

    Visual Basic

    Web

     

    Ordinal identifier

    Note: You cannot include the same property in both the mandatory and assistive property lists

     

    Reset Test Object: the system default.

    Reset Environment: the system default.

    Reset ALL

     

     

    Managing Object Repositories

     

     

    Working with Repository Parameters ?

    Managing Repository Parameters

    The Manage Repository Parameters dialog box enables you to add, edit, and delete repository parameters for a single shared object repository.

    Clear default value button.

  • QTP指南中Action调用例子

    2011-02-14 13:04:43

    如下是记录Action的一些知识点:

     

    Call to copy of action

    对于调用复制的Action的时候,此Action可以变更,不会影响和被其余的Action影响。相对独立。

     

     

    Call to existing action

    调用的已存在的Action是只读的,因此只能修改已保存的原Action,这有一个好处:

    1.         可以从不同的Test调用Action

    2.         维护Action变得简单,因为只需要更新最初的已存在的Action

     

    如果原封不动,选择Calls to existing action

    如果稍微改动,选择Copy of another existing action

     

     

    From Test:选择你需要调用action所在的Test

    Action:只显示Test中可复用的Action

     

    Sign_in[ActionPractice] 

    external action

     

    所谓Test Flow就是Test主干部分

     

    关于Action位置的放置问题:

    只读的在前,可修改的在后面

     

     

    调用的Action Item样子如下

    Copy: Copy of FlightOrder

    Existing: Sign_in[ActionPractice]

     

    Parameterizing an action

    参数化Action

    DataTable显示

    DataTableViewsheet显示为相关的Actions

    Global, Sign_in [ActionA], ReturnHome [ActionA], and Copy of FlightOrder

     

    The Global tab is data sheet whose data is used for the entire test. If five rows of data are displayed in the global table, the test will run five times. You can create data sets in each action using the relevant action sheet. So you can define action to run many times within each test iteration.

     

    Note: The call action data sheets are displayed in gray and cannot be edited because each of these data sheets belong to the corresponding called action and can be edited from the called action’s original test only.

     

    Exclusively

    选择参数化的Action只可以用于当前Action

     

     

    By default, QTP only runs one iteration of each action in a test.

     

    Action Call Properties

    Hint: When an action runs in iterations, it must end in the same condition in which it started.

    Otherwise, the test run may fail when beginning a new iteration.

Open Toolbar