zoukankan      html  css  js  c++  java
  • 3. HttpRunner运行测试用例

    以多种方式运行测试用例

    执⾏单个测试⽤例

    > hrun filepath/testcase.yml
    

    执⾏多个测试⽤例

    > hrun testcase1.yml testcase2.yml
    

    执⾏整个文件夹下的用例

    > hrun folder_path
    

    运行测试脚本

    基于之前生成的json、yaml文件,通过命令行终端cd到用例所在目录,执行hrun + 用例名称即可运行测试脚本。

    > hrun index.yml
    INFO     HttpRunner version: 2.5.7
    INFO     Start to run testcase: testcase description
    /index
    INFO     GET http://localhost.charlesproxy.com:8000/index
    INFO     status_code: 200, response_time(ms): 42.89 ms, response_length: 32 bytes
    
    .
    
    ----------------------------------------------------------------------
    Ran 1 test in 0.048s
    
    OK
    INFO     Start to render Html report ...
    INFO     Generated Html report: D:api-auto-testhrun_demo
    eports2020-10-29_17_55_03.html
    Sentry is attempting to send 0 pending error messages
    Waiting up to 2 seconds
    Press Ctrl-Break to quit
    

    在console中可以看到请求的概要信息, 包括请求的地址、状态码、运行的用例数量、生成的测试报告路径...信息, 如需要在控制台查看请求具体信息, 可在运行时加上--log-level debug参数。


    查看测试报告

    执行完测试用例会在当前目录创建一个reports文件夹,里面会有一个按时间戳生成的html格式报告文件,我们打开看一哈
    test_report

    点开测试步骤detail列的log-1可以查看请求的具体信息

    请求数据(Request)
    请求信息

    响应数据(Response)
    响应数据

    断言校验字段(Validate):
    校验信息

  • 相关阅读:
    微信小程序 生命周期
    ftp uploadFileAction(重要)
    java FTP 上传下载删除文件
    httpsession
    db2 blob EMPTY_BLOB()
    java blob
    java session getCreationTime()
    eclipse 查看源代码
    java file类
    Vue.js 和 MVVM 小细节
  • 原文地址:https://www.cnblogs.com/kyle-/p/13898116.html
Copyright © 2011-2022 走看看