Skip to main content

Even the most boring times in life are limited.

Project description

Meteor tears

LICENSE python version

Meteor tears 一款基于python-request通过Json格式文件管理用例的接口测试工具

用例编写(Json文件管理)

key value example
url 请求接口路由 /admin/compaign/export
method 请求方式 GET
params url地址参数 ?channelId=123importId=456
data 请求数据 {"name": "SEMAUTO", "categoryId": $arguments, "enabled": 1}
file 上传文件数据 {file=operate_excel.save_excel(file=os.path.join(parameters.make_directory('Data', 0), 'excel\compaign_template.xlsx'),data_index=0,excel_key='落地页编号',excel_name='compaign_template_副本.xlsx')}
json Json类型请求 {"name": "SEMAUTO", "categoryId": $arguments, "enabled": 1}
headers 请求头 {'Authorization': 'eyJ0eXAiOiJK', 'Content-Type': 'application/json'}
assert 结果断言 {"username": "NULL", "password": "123456", "auth_code": ['len': 4]}
responseType 验证断言结果的数据类型 {'Response': ['username':'str']}
description 用例描述 "新增渠道"
jsonDiff 返回结果自动对比 {"code":0,"message":"操作成功","data":""}

Mysql执行语句编写讲解

- ChannelBudget:
    action: SELECT
    execSQL:
      - table: shopping
      - columns: ['id']
      - params: id='1'
      - desc: ORDER BY id DESC LIMIT 1
    except:
      - is_table: 0
      - message: You have an error in your SQL syntax
key value Sample
action sql执行操作类 SELECT/DELETE/INSERT/UPDATE等
table 数据库表 channel_budget
columns 列名 ['channel_id'] 列表类型,支持多个值
params 检索条件 id='1'
desc 排序 ORDER BY ID DESC LIMIT 1

接口录制V1.0.0

File -》Save -》  (a) All sessions  以saz格式文件保存所有会话 
                 (b) Selected Sessions 保存选择的会话
                            1. in ArchiveZIP :保存为saz文件
                            2. in ArchiveZIP :保存为saz文件
                            3. as Text (Headers only) :仅保存头部
                 (c) Request 保存请求
                            1. Entir Request:保存整个请求信息(headers和body)
                            2. Request Body:只保存请求body部分
                 (d) Response 保存请求返回
                            1. Request Body:只保存请求body部分
                            2. Response Body:只保存返回body部分
                            3. Response Body:只保存返回body部分

返回Response结构体乱码
        点击decode 

接口回放

  1. File -》Load Archive 导入saz文件
  2. Ctr + A 选择全部接口
  3. 点击Replay按钮, 批量请求

修改CustomRules文件

  1. 找到OnBeforeResponse方法
  2. 添加如下代码
        oSession.utilDecodeResponse();
        var now = new Date();
        var ts = now.getTime();
        var filename =  'F:/MeteorTears/WorkFlow/' + ts + '_' + oSession.id + '.yaml';
        var curDate = new Date();
        var logContent = "Request url: " + oSession.url + "\r\nRequest header: " + oSession.oRequest.headers +  "\r\nRequest body: " + oSession.GetRequestBodyAsString() + "\r\nResponse code: " + oSession.responseCode + "\r\nResponse body: " + oSession.GetResponseBodyAsString() + "\r\n";
        var sw : System.IO.StreamWriter;
        if (System.IO.File.Exists(filename)){
            sw = System.IO.File.AppendText(filename);
            sw.Write(logContent);
        }
        else{
            sw = System.IO.File.CreateText(filename);
            sw.Write(logContent);
        }
        sw.Close();
        sw.Dispose();
  1. C:\Users\56464\Documents\Fiddler2\Scripts\目录下最好先备份原文件,并命名CustomRulesBack.js
  2. 录制的原始接口信息会保存在/WorkFlow/目录下
  3. 录制完的接口为JSON格式文件, load_fiddler_files.py分析并生成新的迭代对象, create_workFlow_obj.py将生成新的Json格式用例文件,

欢迎交流 QQ: 546464268(Null)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MeteorTears-1.0.1.tar.gz (209.4 kB view details)

Uploaded Source

File details

Details for the file MeteorTears-1.0.1.tar.gz.

File metadata

  • Download URL: MeteorTears-1.0.1.tar.gz
  • Upload date:
  • Size: 209.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

File hashes

Hashes for MeteorTears-1.0.1.tar.gz
Algorithm Hash digest
SHA256 574c14badabfd8f1f23e6d8606663738bcc93a1cced63bdb6a2c5a048cdbf4ee
MD5 aefbc49ab5fce484b897ae50cb861e93
BLAKE2b-256 9f5786fbfc4fb7fbe8dedcbbfed0e379cad01ed2e2f6614e44d787da489e83f3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page