分离大家乐棋牌映射以简化维护

最后编辑了

鳞片大家乐棋牌映射是一个强大的概念,以简化测试维护,以防测试下的应用程序(aut)更改。但是,在使用锻炼复杂应用程序或测试的测试时,管理大家乐棋牌名称可以构成一个真正的挑战,这些挑战是同时执行多个应用程序的测试。以下文章将讨论发生这些问题的两种情况,以及如何分离大家乐棋牌图有助于减轻风险。

分裂大家乐棋牌映射

In general, splitting an object map is only viable when using script-based object maps. The idea is to not have a single file (typically called shared/scripts/names.*) holding all object names but rather factoring the names into multiple files and then including them into the central script file.

例如,给定基于JavaScript的大家乐棋牌映射

source(findFile("scripts", "javascript/objectmaphelper.js"));

export var itemViewsQTreeView = {"occurrence": 2, "type": "QTreeView", "unnamed": 1, "visible": 1};
export var ingredientsTreeView = {"type": "QTreeView", "name": "ingredients_tv"};
export var snapshotsTreeView = {"type": "QTreeView", "name": "snapshots_tv"};
export var okButton = {"type": "QPushButton", "text": "OK"}
export var cancelButton = {"type": "QPushButton", "text": "Cancel"}
export var retryButton = {"type": "QPushButton", "text": "Retry"}
名称.js.

we might decide to move all names related to tree controls into a file names_trees.js. and all button names into a file called names_buttons.js.. We can then reexport both files in the main 名称.js. script:

export * from 'names_trees.js';
export * from 'names_buttons.js';
名称.js.
export var itemViewsQTreeView = {"occurrence": 2, "type": "QTreeView", "unnamed": 1, "visible": 1};
export var ingredientsTreeView = {"type": "QTreeView", "name": "ingredients_tv"};
export var snapshotsTreeView = {"type": "QTreeView", "name": "snapshots_tv"};
names_trees.js.
export var okButton = {"type": "QPushButton", "text": "OK"}
export var cancelButton = {"type": "QPushButton", "text": "Cancel"}
export var retryButton = {"type": "QPushButton", "text": "Retry"}
names_buttons.js.

激励案例:保持大家乐棋牌地图尺寸可管理

随着测试的努力进展,测试套件通常会增长,因为所添加的测试案例。对于所有但最简单的应用程序,添加测试用例意味着添加了新的脚本代码,该代码与新的UI控件进行交互,从而导致存储在大家乐棋牌映射中的持续不断增长的大家乐棋牌名称集。在诸如集成开发环境(IDE)之类的复杂应用程序上创建全面测试可以要求大家乐棋牌映射与数千个条目。这使维护具有挑战性,特别是当多人同时正在测试时:

解决此问题的良好策略是将大家乐棋牌映射拆分为多个概念部分。例如,每个对话框都有一个单独的大家乐棋牌映射文件可能是可想象的。然后,这样的部分可以与维护该大家乐棋牌图的人员相关联。这将解决上述两个问题:

激励案例:去耦大家乐棋牌名称

但是,即使是较小的大家乐棋牌映射也可以受益于分成单独的部分。一个这样的情况是在创建涉及多个应用程序的测试时; SWIMISH脚本函数(如初始脚本或AtheatToApplication)使得在单个测试脚本中可以轻松创建自动化多个应用程序(可能在不同计算机上运行)的测试。一个简单的例子,当这很有用的是聊天客户端:要测试聊天客户端,您可能会指定一个行为驱动的测试,这些测试看起来像这样:

Feature: Sending Messages

    Scenario: Sending messages to a different (compatible) client

        This test verifies that sending a message from our chat client
        to the third party chat client 'FrogChat' works

        Given I launch the chat client on computer 'systemA'
        And I log in as user 'Alice'
        And I launch the FrogChat chat client on computer 'systemB'
        And I log in as user 'Bob'
        When I enter the message 'Hello Bob' into the chat client
        Then I should see the message 'Hello Bob' in the FrogChat chat client

在实施此测试时,例如通过录制交互,大家乐棋牌映射将不仅在我们自己的聊天客户端中对应于UI控件的大家乐棋牌名称填充,而且还会在第三方中使用大家乐棋牌名称进行UI控件的大家乐棋牌名称‘FrogChat’ client.

特别是,它可能发生在我们自己的聊天客户端中的单个大家乐棋牌名称中用于控制,以及在Frogchat聊天客户端中的类似控制,例如,

export var okButton = {"type": "QPushButton", "text": "OK"}
名称.js.

此GUI.OKBUTTON名称与类型的任何大家乐棋牌匹配‘QPushButton’ with the text ‘OK’. It’S并不难以想象与两个聊天客户端中的任何一个都存在匹配此描述的大家乐棋牌。事实上,当录制测试脚本时,Quish将为两个应用程序中的任何一个重用此大家乐棋牌名称。

但是,如果按钮的标题更改,则会发生什么 - 但仅在两个聊天客户之一中?例如,UI设计部门可能会决定‘Ok’ is preferable to ‘OK’. The okButton name would need to be adjusted - but doing so would break the test since the button in the FrogChat client still uses ‘OK’ with a capital K.

拆分大家乐棋牌映射使得大家乐棋牌名称由引用的大家乐棋牌Blongs避免此问题的应用程序分组。