分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

接口自动化测试系列之PHPUnit-GET请求接口测试方法

发布时间:2023-09-06 01:23责任编辑:胡小海关键词:PHPGET

接口演示demo说明


接口的具体说明在这里,大家自己看下,里面说的非常详细了,这里我们就不废话了,地址如下:

https://www.juhe.cn/docs/api/id/65.html

get请求接口测试


650) this.width=650;" src="http://p1.pstatp.com/large/437b0003f044dc040d49" style="margin:1em auto;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;" alt="437b0003f044dc040d49" />

如果想把结果格式化输出,可以用该语句print_r(json_decode($ret));替换echo语言即可

PS:中文乱码暂时不用管,对我们没有影响

上面的这个写法其实不太好,更好的写法还是用php的内部方法去调用执行,具体如下

get请求接口测试-加强通用版


650) this.width=650;" src="http://p3.pstatp.com/large/437a00041bc7df174ca2" style="margin:1em auto;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;" alt="437a00041bc7df174ca2" />

其中curl_setopt的用法以及参数描述如下:

http://php.net/manual/zh/function.curl-setopt.php

执行结果如下:

650) this.width=650;" src="http://p3.pstatp.com/large/437900041aff5d375b14" style="margin:1em auto;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-size:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;" alt="437900041aff5d375b14" />


本文出自 “小强性能自动化测试品牌” 博客,请务必保留此出处http://xqtesting.blog.51cto.com/4626073/1980163

接口自动化测试系列之PHPUnit-GET请求接口测试方法

原文地址:http://xqtesting.blog.51cto.com/4626073/1980163

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved