YApi接口文档神器

学习链接:

https://www.cnblogs.com/testertry/p/11281470.html

https://segmentfault.com/a/1190000020220258

 

个人实战:

1、接口-接口列表-【添加分类】,添加接口,编辑,填写接口路径

 

 

2、【添加期望】,填入期望名称、参数过滤

 

 

3、高级mock-脚本

 

 

mock脚本

if(params.page.pageNum == 3 || params.page.pageNum == 4){
    mockJson = "html"
    httpCode = 504
}else if(params.page.pageNum == 2){
    mockJson = {
        code:400
        ,message:"查询数据失败"
    }
    httpCode = 200
}else{
    mockJson = {
        code:200
        ,payload:{
            data:[{phone:"1300830484",reg_number:"830584",customer_id:"830484"}]
            ,pageIndex:params.page.pageNum
            ,pageSize:params.page.pageSize
            ,total:100000
        }
    }
}

 

posted @ 2020-09-21 23:08  优雅de宇  阅读(1328)  评论(0编辑  收藏  举报