如何选择自动化测试框架

更新时间:2023-06-18 06:22:29 阅读: 评论:0

Michael Kelly在《Choosing a test automation framework》一文中提到测试自动化框架是一组假设、概念和惯例的集合,用于支持自动化测试。(A test automation framework is a t of assumptions, concepts, and practices that provide support for automated software testing.)
Michael Kelly把自动化测试框架划分为5大类:
(1)模块化框架(test script modularity)。
(2)函数库结构框架(test library architecture)。
(3)关键字驱动测试框架(keyword-driven/table-driven testing)。
(4)数据驱动测试框架(data-driven testing)。
(5)混合型框架(hybrid test automation)。
模块化框架(test script modularity)
首先编写底层的三级脚本,例如:
双鱼白羊座配对
Sub Main
      Window Set Context, "Caption=Calculator", ""     
      '5
      PushButton Click, "ObjectIndex=10"     
      '+
      PushButton Click, "ObjectIndex=20"     
      '6
      PushButton Click, "ObjectIndex=14"     
      '=重庆市应急管理局
      PushButton Click, "ObjectIndex=21"     
      '11
      Result = LabelUP (CompareProperties, "Text=11.", "UP=Object Properties")     
End Sub
Sub Main
      Window Set Context, "Caption=Calculator", ""     
      '20
      PushButton Click, "ObjectIndex=11"
      PushButton Click, "ObjectIndex=8"     
      '-
      PushButton Click, "ObjectIndex=19"     
      '10
      PushButton Click, "ObjectIndex=7"
      PushButton Click, "ObjectIndex=8"     
      '=
      PushButton Click, "ObjectIndex=21"     
      '10
      Result = LabelUP (CompareProperties, "Text=10.", "UP=Object Properties")     
End Sub
底层脚本可以作为测试脚本开发任务,分模块下发给每个测试工程师负责开发。然后用一个二级脚本来组织和整合这几个底层的脚本,例如下面是计算器的标准视图下组合底层测试脚本的例子:
'Test Script Modularity Framework
'Script for Standard View
Sub Main
      'Test Add Functionality
      CallScript "Test Script Mod Framework - Add"     
      'Test Subtract Functionality
      CallScript "Test Script Mod Framework - Substract"     
      'Test Divide Functionality
      CallScript "Test Script Mod Framework - Divide"     
      'Test Multiply Functionality
      CallScript "Test Script Mod Framework - Multiply"      GTD时间管理
End Sub
最后,最顶层的测试脚本(一级脚本)再去把二级脚本组织和整合在一起执行,例如下面的脚本组合了计算器的标准视图和科学视图的测试脚本:
'Test Script Modularity Framework
'Top level script - reprents test ca
Sub Main
      'Test the Standard View
圆形体积计算公式      CallScript "Test Script Mod Framework - Standard"     
      'Test the Scientific View
      CallScript "Test Script Mod Framework - Scientific"     
End Sub
库结构框架(test library architecture)
宫紫把测试脚本做成函数,通过函数之间互相调用来组织测试用例。例如下面的一个函数实现了计算器标准视图的测试:
'Header File
'Test Library Architecture Framework
"Functions Library
Declare Sub StandardViewFunction BasicLib "Functions Library" (OperandOne As Integer, _
'Library Source File
'Test Library Architecture Framework
'Functions Library
Sub StandardViewFunction (OperandOne As Integer, _
                                      OperandTwo As Interger, _
                                      Operation As String)
      'Click on first operand
      Select Ca OperandOne
            Ca 0
                  PushButton Click, "ObjectIndex=8"
            Ca 1
                  PushButton Click, "ObjectIndex=7"
            Ca 2
                  PushButton Click, "ObjectIndex=11"
            Ca 3
                  PushButton Click, "ObjectIndex=15"
            Ca 4
                  PushButton Click, "ObjectIndex=6"
            Ca 5
                  PushButton Click, "ObjectIndex=10"
            Ca 6
                  PushButton Click, "ObjectIndex=14"
            Ca 7
                  PushButton Click, "ObjectIndex=5"
            Ca 8
                  PushButton Click, "ObjectIndex=9"
            Ca 9
                  PushButton Click, "ObjectIndex=13"
        End Select
       
      'Click on cond operand
      Select Ca OperandOne
            Ca "+"
                  PushButton Click, "ObjectIndex=8"
            Ca "-"
                  PushButton Click, "ObjectIndex=7"
            Ca "*"
                  PushButton Click, "ObjectIndex=11"
            Ca "/"
                  PushButton Click, "ObjectIndex=15"
        End Select
       
      'Click on third operand
      Select Ca OperandOne
            Ca 0
                  PushButton Click, "ObjectIndex=8"
            Ca 1
                  PushButton Click, "ObjectIndex=7"
            Ca 2
                  PushButton Click, "ObjectIndex=11"
            Ca 3
                  PushButton Click, "ObjectIndex=15"
            Ca 4
木乃伊英文
                  PushButton Click, "ObjectIndex=6"
            Ca 5手工教案
                  PushButton Click, "ObjectIndex=10"
            Ca 6
                  PushButton Click, "ObjectIndex=14"
            Ca 7西芹炒鱿鱼
                  PushButton Click, "ObjectIndex=5"
            Ca 8
                  PushButton Click, "ObjectIndex=9"
            Ca 9
                  PushButton Click, "ObjectIndex=13"
        End Select

本文发布于:2023-06-18 06:22:29,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/981244.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:测试   脚本   框架   视图   底层
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图