Chinaunix首页 | 论坛 | 博客
  • 博客访问: 25589
  • 博文数量: 18
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 85
  • 用 户 组: 普通用户
  • 注册时间: 2015-11-24 15:45
文章分类

全部博文(18)

文章存档

2016年(8)

2015年(10)

我的朋友

分类: LINUX

2015-12-02 14:35:12

手动测试过程中,有Test Case(Test Environment,Test Data,Test Steps, Expected Result), Test Suite的概念;软件开发过程上有面向对象的概念(即继承、封装,多态),做自动化测试开发需要具备测试人员的基础知识及程序员的思想。

1. Test Case -
包含测试数据,一系列的操作步骤及期望值。

    • Test Case时,可以使用4种格式,分别是hypertext markup language (HTML), tab-separated values (TSV), plain text, or reStructuredText (reST) formats,本实例中使用plain text的格式。
    • Plain text格式的Test Case使用至少2个空格做为分隔符。
    • 因为空格作为分隔符使用,当需要使用空格原义时,可以使用${EMPTY}变量或是 \ 来进行转义。
    • 组成Test Case的要素
      • 操作步骤(Test Steps- Action (Keyword来实现)
      • 期望值(Expected Result)- Argument(可以使用Variable
      • 测试数据(Test Data)- Argument
      • Example

***Test Cases***
My Test [Documentation] Example test
Log ${MESSAGE}

Another Test
Should Be Equal ${MESSAGE} Hello, world!

My Test/Another Test
Test Case的名字
Log/Should Be Equal -
Action(Keywords)
${Message}/Hello, world -
是期望值(可以是变量也可以是常量)

 

2. 多个Test Cases可以放在同一个文件中,称为test case file

    • Test Case File的组成

Table name

Used for

Setting table

1) Importing , and

2) Defining metadata for

Variable table

Defining
that can be used elsewhere in the test case

Test case table

from available keywords

Keyword table

from existing lower-level keywords

    • Examples:

***Settings***
Library     OperatingSystem

***Variables***
${MESSAGE}  Hello, world!

***Test Cases***
My Test  [Documentation]  Example test
    Log         ${MESSAGE}
    My Keyword  /tmp

Another Test
    Should Be Equal  ${MESSAGE}  Hello, world!

***Keywords***

My Keyword  [Arguments]  ${path}
    Directory Should Exist  ${path}


3. Test Suite - A test suite created from a directory can have similar settings as a suite created from a test case file

    • 1个或多个具有相同设置的Test Case File可以组成一个Test Suite, 多个Test Suites可以组成另一个更高层的Test Suite
    • Test Suite中的Test case file可以通过在名称中添加数字来进行排序,如01__some_tests.txt and 02__more_tests.txt
    • 每层次Test Suites中都应该包含一个初始化文件,即以__init__.txt命名的文件(从Python语法中借鉴而来)。
    • 初始化文件的内容与Test case file文件中的内容基本相同,除了不支持test case table及一部分的settings table内容。

Table name

Used for

Setting table

1) Importing , and

2) Defining metadata for

Variable table

Defining
that can be used elsewhere in the test case

Keyword table

from existing lower-level keywords

 

    • 初始化文件主要作用是把具有相同Settingstest case file聚集在一起。
    • 初如化文件中的主要内容:
      • Documentation/Metada
      • Suite Setup, Suite Teardown
      • Test Setup, Test Teardown
      • Force Tags,
      • Default Tags,Test Template,Test Timeout - Not supported
    • Examples:

***Settings***
Library     OperatingSystem
Suite Setup     Start Selenium Server
Force Tags      example


***Variables***
${MESSAGE}  Hello, world!


***Keywords***

My Keyword  [Arguments]  ${path}
    Directory Should Exist  ${path}

 

阅读(432) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~