• httpRunner自动化测试用例使用笔记


    框架大概为配置文件config,环境文件.env,函数方法debugtalk,启动main-debug,api文档yaml格式,用例文档yaml格式,启动命令python3 main-debug.py hrun testcase_paths

    config放一些全局变量,基本不会变的变量

    api里的格式大概为:

    用例里面:

    用例结果判断

     

    comparator

    Description

    A(check), B(expect)

    examples

    eq, ==

    value is equal

    A == B

    9 eq 9

    lt

    less than

    A < B

    7 lt 8

    le

    less than or equals

    A <= B

    7 le 8, 8 le 8

    gt

    greater than

    A > B

    8 gt 7

    ge

    greater than or equals

    A >= B

    8 ge 7, 8 ge 8

    ne

    not equals

    A != B

    6 ne 9

    str_eq

    string equals

    str(A) == str(B)

    123 str_eq '123'

    len_eq, count_eq

    length or count equals

    len(A) == B

    'abc' len_eq 3, [1,2] len_eq 2

    len_gt, count_gt

    length greater than

    len(A) > B

    'abc' len_gt 2, [1,2,3] len_gt 2

    len_ge, count_ge

    length greater than or equals

    len(A) >= B

    'abc' len_ge 3, [1,2,3] len_gt 3

    len_lt, count_lt

    length less than

    len(A) < B

    'abc' len_lt 4, [1,2,3] len_lt 4

    len_le, count_le

    length less than or equals

    len(A) <= B

    'abc' len_le 3, [1,2,3] len_le 3

    contains

    contains

    [1, 2] contains 1

    'abc' contains 'a', [1,2,3] len_lt 4

    contained_by

    contained by

    A in B

    'a' contained_by 'abc', 1 contained_by [1,2]

    type_match

    A is instance of B

    isinstance(A, B)

    123 type_match 'int'

    regex_match

    regex matches

    re.match(B, A)

    'abcdef' regex 'aw+d'

    startswith

    starts with

    A.startswith(B) is True

    'abc' startswith 'ab'

    endswith

    ends with

    A.endswith(B) is True

    'abc' endswith 'bc'

    contains_subset

    Contains subset

    {a:1, b:2} contains {a:1}

     
  • 相关阅读:
    centos npm run build 报错
    python base64
    Emacs 常用命令
    linux 删除文件腾出空间 遇到的问题
    网速查看工具
    linux 查看当前文件夹下的文件大小
    Docker 私有仓库push
    Harbor:Http: server gave HTTP response to HTTPS client & Get https://192.168.2.119/v2/
    docker 私有仓库搭建
    linux 修改时间
  • 原文地址:https://www.cnblogs.com/chenne69163/p/12191349.html
Copyright © 2020-2023  润新知