mm-api-test

MAGICMIND http API 测试工具

Usage no npm install needed!

<script type="module">
  import mmApiTest from 'https://cdn.skypack.dev/mm-api-test';
</script>

README

APITEST

仿真本地登录,保存用户信息,并调用相关测试函数 使用方法:

Todo

  • 实现并行任务处理
  • 使用request组件实现HTTP请求,替换当前的实现
  • 实现预执行任务
  • 实现执行方式为瀑布流方式,使得多个任务间可以传递结果数据

Example

Usage: apitest [host] [port] <testcase ...>
 USING mm-api-test Tools to Execute Standard HTTP JSON API TestCase
 Options:

 -h, --help                  output usage information
 -V, --version               output the version number
 -h, --host [value]          Api Server Host,default=localhost
 -p, --port [n]              Api Server Port,default=8000
 -r, --pre-testcase [value]  pre execute testcase for run Test,eg:prelogin Case
 -t, --tasks [n]             parallel execute Testcase tasks count,using for Performance Test

Example

//测试用例
 var debug=require('debug')('Test-01');
 module.exports={
  //测试用例名称
  name:'START TEST CASE',
  case_steps:[
    {
      //测试步骤名称
      step_name:'测试用例01',
      url:'/test/test01',
      post_body:{
        abc:'test-abc',
      },
      //检测错误,有错误返回错误描述,正确返回null
      checkError:function(resp_code,resp_body){
        if(resp_code != 200) return '错误返回码';
        debug('OK');
      }
    },
  ]
};