Qtp 简明教程
QTP - Frameworks
框架定义了一套准则/最佳实践来执行一组标准,这让最终用户易于使用。有不同类型的自动化框架,最常见的类型如下:
A Framework defines a set of guidelines/best practices that enforces a set of standards, which makes it easy to use for the end users to work with. There are different types of automation frameworks and the most common ones are listed below −
-
Keyword-Driven Framework
-
Data-Driven Framework
-
Hybrid Framework
Keyword-Driven Framework
关键字驱动测试是一种类型的功能自动测试框架,也称为表格驱动测试或动作词驱动测试。
Keyword driven testing is a type of functional automation testing framework which is also known as table-driven testing or action word based testing.
在关键字驱动测试中,我们使用表格格式(通常是电子表格)来针对我们要执行的每个功能定义关键词或动作词。
In Keyword-driven testing, we use a table format, usually a spreadsheet, to define keywords or action words for each function that we would like to execute.
Advantages
-
It is best suited for novice or a non-technical tester.
-
Enables writing tests in a more abstract manner using this approach.
-
Keyword driven testing allows automation to be started earlier in the SDLC even before a stable build is delivered for testing.
-
There is a high degree of reusability.
Data Driven Framework
数据驱动测试是创建测试脚本的地方,其中每次运行测试时,测试数据和/或输出值从数据文件读取,而不是使用相同的硬编码值。通过这种方式,测试人员可以有效地测试应用程序如何处理各种输入。它可以是以下任何数据文件:
Data-driven testing is creation of test scripts where test data and/or output values are read from data files instead of using the same hard-coded values each time the test runs. This way, the testers can test how the application handles various inputs effectively. It can be any of the following data files −
-
datapools
-
Excel files
-
ADO objects
-
CSV files
-
ODBC sources
Flow Diagram
数据驱动测试可以通过以下图表得到最好的理解:
Data Driven Testing can be best understood by the following diagram −
Hybrid Framework
混合框架是关键字驱动和数据驱动框架的结合,下图是对它的最佳描述。
Hybrid Framework is a combination of Keyword driven and data Driven framework that can be best described using the following flow diagram.
Affecting Factors
以下是开发框架时应该考虑的参数。影响因素如下所示 -
Following are the parameters one should take into account while developing the framework. The affects factors are listed below −
-
Framework files should support versioning controlling software such as SVN, CVS, MS Source Control
-
Framework should support executing the scripts in different environments viz- QA, SAT, DEV
-
Upon Object changes, scripts should execute with minimal changes.
-
Framework should configure itself and take care of prerequisite such as creating folders/databases.
-
Framework should have robust reporting structure so that issues in the script/application can be easily spotted
-
Framework should have greater flexibility so that it should be easy to use
-
Framework should follow coding standards so that files, functions, and history of changes are maintained correctly.
在下一章,我们将学习如何设计一个简单的框架。
In the next chapter, we will learn how to design a simple framework.