接口测试

什么是接口?

硬件接口:硬件接口指的是硬件提供给外界的一种实体。主要作用是内部数据分离出外部的沟通方法。目的是:通过外部来改变内部的数据。
如:USB接口,投影仪接口。

软件接口:软件接口指的是软件提供给外界的一种服务。主要作用是内部数据分离出外部的沟通方法。目的是:通过外部来改变内部的数据。
如:微信的提现和充值的操作,调用银行对外开放的接口(支付,提现),这些接口有权限控制(token,key,appkey)

本质:其实就是一个方法。方法有参数和返回值。

一般返回一个JSON(就是一种数据格式,类似于字典)。

{error_code:0,msg:"提现成功",result:[]}

接口测试

主要的测试对象是接口,主要测试系统之间能否正常的交互数据、异常场景以及权限控制。

接口测试策略(怎么测)

1、正例
是指根据业务逻辑、输入参数、输出值的描述,对正常输入情况下所得的输出值是否正确的测试,也就是测试对外提供的接口服务是否正常工作。
2、反例
1.鉴权码参数(token)异常:(空、错误的、过期的鉴权码)
2.其他常规参数异常:(整型、字符串、日期)
长度:6-8
类型:数字、字母、中文、特殊符号、空格
格式:年月日、年月日时分秒、(/,-,:)、手机号码、邮箱
3、错误码(根据业务定)异常覆盖

注意参数类型:
1.常规(整型,字符串,日期)
2.传json格式或者xml格式的参数
3.传加密之后的参数
4.传文件(常规文件、二进制文件)

接口测试流程

1、从开发得到接口API文档,熟悉接口业务以及接口地址、是否需要鉴权、入参、出参等信息
2、编写接口测试计划、设计接口测试方案以及用例
3、使用工具执行接口测试
4、编写接口测试报告

接口测试工具

jmeter(http)、postman(http)、soupui(webservice、http)、fiddler
postman下载路径:https://www.getpostman.com/apps

微信公众号接口

1.进入https://developers.weixin.qq.com/doc/offiaccount/Getting_Started/Overview.html
登录微信号获取 appID 和 appsecret

2.用postman获取 access_token

https请求方式: GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET

接口请求方式

  • get
  • post
  • put
  • delete

区别:
get是在地址栏以?方式传参,多个参数之间用&分隔。
post是通过表单传参。
get不安全,post安全。

https://www.baidu.com/s?wd=海贼王

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0

响应码

  • 2xx 成功
  • 3xx 重定向
  • 4xx 请求的资源找不到
  • 5xx 服务器错误

断言

//断言返回的Json包含有access_token的键
pm.test("Body matches string", function () {
    pm.expect(pm.response.text()).to.include("access_token");
});

全局变量

1、设置全局变量

//处理token
var jsn=JSON.parse(responseBody)
console.log(jsn.access_token)

//把access_token设置到全局变量中
pm.globals.set("access_token", jsn.access_token);

2、查看全局变量

3、如图设置成功

4、使用全局变量

控制台

打开控制台:
view → Show Postman Console

//获得响应头的一个值
var ct= postman.getResponseHeader("Content-Type");
console.log(ct) 

//获得响应体的cookie的一个值
var ck = postman.getResponseCookie("csrf_token");
console.log(ck)

//获得响应主体
var response = responseBody;
console.log(response)

//在响应体中通过正则表达式匹配内容
var token = (responseBody.match(new RegExp('"access_token":"(.+?)"')))[1];
console.log(token) 

//把响应体转换成一个json对象
var js = JSON.parse(responseBody);
console.log(js.access_token)

//把响应体的XML格式转换成一个json对象
var jsob = xml2Json(responseBody); 
console.log(jsob.access_token)

//手动生成一个时间戳
var times = Date.now();
pm.globals.set("times",times);

//手动生成一个guid
const guid = 'xxxxxxxx-xxxx'
.replace(/x/g, () => (Math.floor(Math.random() * 16)).toString(16))
.replace(/y/g, () => (Math.floor(Math.random() * 4 + 8)).toString(16));
pm.globals.set("guid",guid);

//手动生成一个随机数
const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
pm.globals.set("randomint",randomInt(1000000000,9999999999));

pm.test("Your test name",function(){
    var jsonData = pm.response.json();
    pm.expect(jsonData.tag.name).to.eql("湖南"+globals["randomit"]);
});

//在tests中获取全局变量的值
//1.{{}}不行
//2.pm.globals.get("variable_key");  OK
//3.globals.time  OK
//4.globals["times"]  OK

随机数

//手动生成一个时间戳
//var times = Date.now();
//手动生成一个时间戳
var times = Date.now();
pm.globals.set("times",times);

//手动生成一个guid
// const guid = 'xxxxxxxx-xxxx'
// .replace(/x/g, () => (Math.floor(Math.random() * 16)).toString(16))
// .replace(/y/g, () => (Math.floor(Math.random() * 4 + 8)).toString(16));
// pm.globals.set("guid",guid);

//手动生成一个随机数
// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
// pm.globals.set("randomint",randomInt(1000000000,9999999999));

//随机获取数组中的值
// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
// const getRandomValue = list => list[randomInt(0, list.length - 1)];
// const charsInName = ['王','李','张'];
// pm.globals.set("randomValue",getRandomValue(charsInName));

//获得顺序值
// var s = postman.getGlobalVariable("num");
// s = parseInt(s) + 1;
// postman.setGlobalVariable("num",s);

//获得一个随机手机号码
// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
// environment.randomMobile = `18${randomInt(100000000, 999999999)}`;
// postman.setGlobalVariable("mobile",environment.randomMobile);

Backup.postman_dump.json

{
	"version": 1,
	"collections": [
		{
			"id": "a7523639-3233-4e32-b451-3374888c5ca9",
			"name": "微信公众号接口",
			"description": "微信公众平台是运营者通过公众号为微信用户提供资讯和服务的平台,而公众平台开发接口则是提供服务的基础,开发者在公众平台网站中创建公众号、获取接口权限后,可以通过阅读本接口文档来帮助开发。\r\n\r\n为了识别用户,每个用户针对每个公众号会产生一个安全的OpenID,如果需要在多公众号、移动应用之间做用户共通,则需前往微信开放平台,将这些公众号和应用绑定到一个开放平台账号下,绑定后,一个用户虽然对多个公众号和应用有多个不同的OpenID,但他对所有这些同一开放平台账号下的公众号和应用,只有一个UnionID,可以在用户管理-获取用户基本信息(UnionID机制)文档了解详情。",
			"auth": null,
			"events": null,
			"variables": [],
			"order": [],
			"folders_order": [
				"9d84930b-ff55-4619-8ad2-1dd8420c40b9",
			"b0509bdf-e690-4094-81b0-a852f28d9f4d",
			"7da442f5-d917-4aae-8f5e-a19ca67323f9"
		],
		"protocolProfileBehavior": {},
		"folders": [
			{
				"id": "9d84930b-ff55-4619-8ad2-1dd8420c40b9",
				"name": "开始开发",
				"description": null,
				"auth": null,
				"events": null,
				"collection": "a7523639-3233-4e32-b451-3374888c5ca9",
				"folder": null,
				"order": [
					"3d0d52f4-12fb-42bd-9b6a-dbf48b1b478c"
				],
				"folders_order": [],
				"protocolProfileBehavior": {},
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"folderId": "9d84930b-ff55-4619-8ad2-1dd8420c40b9"
			},
			{
				"id": "b0509bdf-e690-4094-81b0-a852f28d9f4d",
				"name": "消息管理",
				"description": null,
				"auth": null,
				"events": null,
				"collection": "a7523639-3233-4e32-b451-3374888c5ca9",
				"folder": null,
				"order": [],
				"folders_order": [],
				"protocolProfileBehavior": {},
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"folderId": "b0509bdf-e690-4094-81b0-a852f28d9f4d"
			},
			{
				"id": "f07acfaa-e774-4e5a-99c2-d549e703ac4a",
				"name": "用户标签管理",
				"description": null,
				"auth": null,
				"events": null,
				"collection": "a7523639-3233-4e32-b451-3374888c5ca9",
				"folder": "7da442f5-d917-4aae-8f5e-a19ca67323f9",
				"order": [
					"73dec90a-4695-4bdc-89d2-15b95ed10bf5",
					"f21db7d4-5671-4cae-82ba-d6d317f35f40",
					"0ce6e8e6-280a-4ed8-aec1-37b9f288c4c7",
					"d72f613a-d5d8-455a-acf8-731e5fdf03ae"
				],
				"folders_order": [],
				"protocolProfileBehavior": {},
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"folderId": "f07acfaa-e774-4e5a-99c2-d549e703ac4a"
			},
			{
				"id": "7da442f5-d917-4aae-8f5e-a19ca67323f9",
				"name": "用户管理",
				"description": null,
				"auth": null,
				"events": null,
				"collection": "a7523639-3233-4e32-b451-3374888c5ca9",
				"folder": null,
				"order": [],
				"folders_order": [
					"f07acfaa-e774-4e5a-99c2-d549e703ac4a"
				],
				"protocolProfileBehavior": {},
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"folderId": "7da442f5-d917-4aae-8f5e-a19ca67323f9"
			}
		],
		"requests": [
			{
				"id": "0ce6e8e6-280a-4ed8-aec1-37b9f288c4c7",
				"name": "编辑标签",
				"url": "https://{{ip}}/cgi-bin/tags/update?access_token={{access_token}}",
				"description": null,
				"data": [],
				"dataOptions": {
					"raw": {
						"language": "json"
					}
				},
				"dataMode": "raw",
				"headerData": [
					{
						"key": "Content-Type",
						"name": "Content-Type",
						"value": "application/json",
						"description": "",
						"type": "text"
					}
				],
				"method": "POST",
				"pathVariableData": [],
				"queryParams": [
					{
						"key": "access_token",
						"value": "{{access_token}}",
						"equals": true,
						"description": "",
						"enabled": true
					}
				],
				"auth": null,
				"events": [
					{
						"listen": "test",
						"script": {
							"id": "781c1322-5ffc-4151-b4a2-7d6e22327174",
							"exec": [
								"pm.test(\"Your test name\", function () {",
								"    var jsonData = pm.response.json();",
								"    pm.expect(jsonData.errcode).to.eql(0);",
								"});",
								"//确定下一个请求",
								"postman.setNextRequest(\"删除标签\")"
							],
							"type": "text/javascript"
						}
					}
				],
				"folder": "f07acfaa-e774-4e5a-99c2-d549e703ac4a",
				"preRequestScript": null,
				"tests": "pm.test(\"Your test name\", function () {\n    var jsonData = pm.response.json();\n    pm.expect(jsonData.errcode).to.eql(0);\n});\n//确定下一个请求\npostman.setNextRequest(\"删除标签\")",
				"currentHelper": null,
				"helperAttributes": null,
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"rawModeData": "{\"tag\":{\"id\":{{tag_id}},\"name\":\"广东{{times}}\"}}",
				"headers": "Content-Type: application/json\n",
				"pathVariables": {}
			},
			{
				"id": "3d0d52f4-12fb-42bd-9b6a-dbf48b1b478c",
				"name": "获得access_token",
				"url": "https://{{ip}}/cgi-bin/token?grant_type=client_credential&appid=wx6b11b3efd1cdc290&secret=106a9c6157c4db5f6029918738f9529d",
				"description": null,
				"data": null,
				"dataOptions": null,
				"dataMode": null,
				"headerData": [],
				"method": "GET",
				"pathVariableData": [],
				"queryParams": [
					{
						"key": "grant_type",
						"value": "client_credential",
						"equals": true,
						"description": "",
						"enabled": true
					},
					{
						"key": "appid",
						"value": "wx6b11b3efd1cdc290",
						"equals": true,
						"description": "",
						"enabled": true
					},
					{
						"key": "secret",
						"value": "106a9c6157c4db5f6029918738f9529d",
						"equals": true,
						"description": "",
						"enabled": true
					}
				],
				"auth": null,
				"events": [
					{
						"listen": "test",
						"script": {
							"id": "9e8abc94-b5f9-40ed-8e50-6afb4a3939a4",
							"exec": [
								"//断言返回的Json包含有access_token的键",
								"pm.test(\"Body matches string\", function () {",
								"    pm.expect(pm.response.text()).to.include(\"access_token\");",
								"});",
								"//处理token",
								"//var jsn = JSON.parse(responseBody)",
								"//console.log(jsn.access_token)",
								"var access_token = (responseBody.match(new RegExp('\"access_token\":\"(.+?)\"')))[1];",
								"//把access_token设置到全局变量中。",
								"pm.globals.set(\"access_token\",access_token);",
								"//确定下一个请求",
								"postman.setNextRequest(\"增加标签\")",
								"",
								"//获得响应头的一个值",
								"    //var ct = postman.getResponseHeader(\"Content-Type\");",
								"    //console.log(ct)",
								"//获得响应的cookie的一个值",
								"    //var ck = postman.getResponseCookie(\"csrf_token\");",
								"    //console.log(ck)",
								"//获得响应主体",
								"    //var response = responseBody;",
								"    //console.log(response)",
								"//在响应主体中通过正则表达式匹配内容",
								"    //var token = (responseBody.match(new RegExp('\"access_token\":\"(.+?)\"')))[1];",
								"    //console.log(token)",
								"//把响应体转换成一个json对象",
								"    //var js =JSON.parse(responseBody);",
								"    //console.log(js.access_token)",
								"//把响应体的XML格式转换成一个json对象",
								"    //var jsob = xml2Json(responseBody);",
								"    //console.log(jsob.access_token)"
							],
							"type": "text/javascript"
						}
					}
				],
				"folder": "9d84930b-ff55-4619-8ad2-1dd8420c40b9",
				"preRequestScript": null,
				"tests": "//断言返回的Json包含有access_token的键\npm.test(\"Body matches string\", function () {\n    pm.expect(pm.response.text()).to.include(\"access_token\");\n});\n//处理token\n//var jsn = JSON.parse(responseBody)\n//console.log(jsn.access_token)\nvar access_token = (responseBody.match(new RegExp('\"access_token\":\"(.+?)\"')))[1];\n//把access_token设置到全局变量中。\npm.globals.set(\"access_token\",access_token);\n//确定下一个请求\npostman.setNextRequest(\"增加标签\")\n\n//获得响应头的一个值\n    //var ct = postman.getResponseHeader(\"Content-Type\");\n    //console.log(ct)\n//获得响应的cookie的一个值\n    //var ck = postman.getResponseCookie(\"csrf_token\");\n    //console.log(ck)\n//获得响应主体\n    //var response = responseBody;\n    //console.log(response)\n//在响应主体中通过正则表达式匹配内容\n    //var token = (responseBody.match(new RegExp('\"access_token\":\"(.+?)\"')))[1];\n    //console.log(token)\n//把响应体转换成一个json对象\n    //var js =JSON.parse(responseBody);\n    //console.log(js.access_token)\n//把响应体的XML格式转换成一个json对象\n    //var jsob = xml2Json(responseBody);\n    //console.log(jsob.access_token)",
				"currentHelper": null,
				"helperAttributes": null,
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"headers": "",
				"pathVariables": {}
			},
			{
				"id": "73dec90a-4695-4bdc-89d2-15b95ed10bf5",
				"name": "增加标签",
				"url": "https://{{ip}}/cgi-bin/tags/create?access_token={{access_token}}",
				"description": null,
				"data": [],
				"dataOptions": {
					"raw": {
						"language": "json"
					}
				},
				"dataMode": "raw",
				"headerData": [
					{
						"key": "Content-Type",
						"name": "Content-Type",
						"type": "text",
						"value": "application/json"
					}
				],
				"method": "POST",
				"pathVariableData": [],
				"queryParams": [
					{
						"key": "access_token",
						"value": "{{access_token}}",
						"equals": true,
						"description": "",
						"enabled": true
					}
				],
				"auth": null,
				"events": [
					{
						"listen": "test",
						"script": {
							"id": "b908bc9f-c3f0-41af-be09-eb06903792e7",
							"exec": [
								"pm.test(\"Your test name\", function () {",
								"    var jsonData = pm.response.json();",
								"    pm.expect(jsonData.tag.name).to.eql(\"湖南\"+globals[\"times\"]);",
								"});",
								"",
								"//获得标签的id",
								"var js = JSON.parse(responseBody)",
								"pm.globals.set(\"tag_id\",js.tag.id);",
								"//确定下一个请求",
								"postman.setNextRequest(\"获取公众号已创建的标签\")",
								"",
								"//在tests中获取全局变量的值",
								"//1.{{}}不行",
								"//2.pm.globals.get(\"variable_key\");   OK",
								"//3.globals.times   OK",
								"//4.globals[\"times\"]   OK"
							],
							"type": "text/javascript"
						}
					},
					{
						"listen": "prerequest",
						"script": {
							"id": "d63d8d9f-adc9-48a6-bf94-285879af105e",
							"exec": [
								"//手动生成一个时间戳\r",
								"var times = Date.now();\r",
								"pm.globals.set(\"times\",times);\r",
								"\r",
								"//手动生成一个guid\r",
								"// const guid = 'xxxxxxxx-xxxx'\r",
								"// .replace(/x/g, () => (Math.floor(Math.random() * 16)).toString(16))\r",
								"// .replace(/y/g, () => (Math.floor(Math.random() * 4 + 8)).toString(16));\r",
								"// pm.globals.set(\"guid\",guid);\r",
								"\r",
								"//手动生成一个随机数\r",
								"// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\r",
								"// pm.globals.set(\"randomint\",randomInt(1000000000,9999999999));\r",
								"\r",
								"//随机获取数组中的值\r",
								"// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\r",
								"// const getRandomValue = list => list[randomInt(0, list.length - 1)];\r",
								"// const charsInName = ['王','李','张'];\r",
								"// pm.globals.set(\"randomValue\",getRandomValue(charsInName));\r",
								"\r",
								"//获得顺序值\r",
								"// var s = postman.getGlobalVariable(\"num\");\r",
								"// s = parseInt(s) + 1;\r",
								"// postman.setGlobalVariable(\"num\",s);\r",
								"\r",
								"//获得一个随机手机号码\r",
								"// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\r",
								"// environment.randomMobile = `18${randomInt(100000000, 999999999)}`;\r",
								"// postman.setGlobalVariable(\"mobile\",environment.randomMobile);\r",
								"\r",
								"\r",
								""
							],
							"type": "text/javascript"
						}
					}
				],
				"folder": "f07acfaa-e774-4e5a-99c2-d549e703ac4a",
				"preRequestScript": "//手动生成一个时间戳\r\nvar times = Date.now();\r\npm.globals.set(\"times\",times);\r\n\r\n//手动生成一个guid\r\n// const guid = 'xxxxxxxx-xxxx'\r\n// .replace(/x/g, () => (Math.floor(Math.random() * 16)).toString(16))\r\n// .replace(/y/g, () => (Math.floor(Math.random() * 4 + 8)).toString(16));\r\n// pm.globals.set(\"guid\",guid);\r\n\r\n//手动生成一个随机数\r\n// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\r\n// pm.globals.set(\"randomint\",randomInt(1000000000,9999999999));\r\n\r\n//随机获取数组中的值\r\n// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\r\n// const getRandomValue = list => list[randomInt(0, list.length - 1)];\r\n// const charsInName = ['王','李','张'];\r\n// pm.globals.set(\"randomValue\",getRandomValue(charsInName));\r\n\r\n//获得顺序值\r\n// var s = postman.getGlobalVariable(\"num\");\r\n// s = parseInt(s) + 1;\r\n// postman.setGlobalVariable(\"num\",s);\r\n\r\n//获得一个随机手机号码\r\n// const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\r\n// environment.randomMobile = `18${randomInt(100000000, 999999999)}`;\r\n// postman.setGlobalVariable(\"mobile\",environment.randomMobile);\r\n\r\n\r\n",
				"tests": "pm.test(\"Your test name\", function () {\n    var jsonData = pm.response.json();\n    pm.expect(jsonData.tag.name).to.eql(\"湖南\"+globals[\"times\"]);\n});\n\n//获得标签的id\nvar js = JSON.parse(responseBody)\npm.globals.set(\"tag_id\",js.tag.id);\n//确定下一个请求\npostman.setNextRequest(\"获取公众号已创建的标签\")\n\n//在tests中获取全局变量的值\n//1.{{}}不行\n//2.pm.globals.get(\"variable_key\");   OK\n//3.globals.times   OK\n//4.globals[\"times\"]   OK",
				"currentHelper": null,
				"helperAttributes": null,
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"rawModeData": "{\"tag\":{\"name\":\"湖南{{times}}\"}}",
				"headers": "Content-Type: application/json\n",
				"pathVariables": {}
			},
			{
				"id": "d72f613a-d5d8-455a-acf8-731e5fdf03ae",
				"name": "删除标签",
				"url": "https://{{ip}}/cgi-bin/tags/delete?access_token={{access_token}}",
				"description": null,
				"data": [],
				"dataOptions": {
					"raw": {
						"language": "json"
					}
				},
				"dataMode": "raw",
				"headerData": [
					{
						"key": "Content-Type",
						"name": "Content-Type",
						"value": "application/json",
						"type": "text"
					}
				],
				"method": "POST",
				"pathVariableData": [],
				"queryParams": [
					{
						"key": "access_token",
						"value": "{{access_token}}",
						"equals": true,
						"description": "",
						"enabled": true
					}
				],
				"auth": null,
				"events": [
					{
						"listen": "test",
						"script": {
							"id": "7dd8ee3e-c7c1-4e4d-9c3d-02b13ddf6bc8",
							"exec": [
								"//断言返回的json包含有errcode为0",
								"pm.test(\"Your test name\", function () {",
								"    var jsonData = pm.response.json();",
								"    pm.expect(jsonData.errcode).to.eql(0);",
								"});",
								"//确定下一个请求",
								"postman.setNextRequest(\"null\")"
							],
							"type": "text/javascript"
						}
					}
				],
				"folder": "f07acfaa-e774-4e5a-99c2-d549e703ac4a",
				"preRequestScript": null,
				"tests": "//断言返回的json包含有errcode为0\npm.test(\"Your test name\", function () {\n    var jsonData = pm.response.json();\n    pm.expect(jsonData.errcode).to.eql(0);\n});\n//确定下一个请求\npostman.setNextRequest(\"null\")",
				"currentHelper": null,
				"helperAttributes": null,
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"rawModeData": "{\"tag\":{\"id\":{{tag_id}}}}",
				"headers": "Content-Type: application/json\n",
				"pathVariables": {}
			},
			{
				"id": "f21db7d4-5671-4cae-82ba-d6d317f35f40",
				"name": "获取公众号已创建的标签",
				"url": "https://{{ip}}/cgi-bin/tags/get?access_token={{access_token}}",
				"description": null,
				"data": [],
				"dataOptions": {
					"raw": {
						"language": "json"
					}
				},
				"dataMode": "raw",
				"headerData": [
					{
						"key": "Content-Type",
						"name": "Content-Type",
						"value": "application/json",
						"type": "text"
					}
				],
				"method": "GET",
				"pathVariableData": [],
				"queryParams": [
					{
						"key": "access_token",
						"value": "{{access_token}}",
						"equals": true,
						"description": "",
						"enabled": true
					}
				],
				"auth": null,
				"events": [
					{
						"listen": "test",
						"script": {
							"id": "7dd8ee3e-c7c1-4e4d-9c3d-02b13ddf6bc8",
							"exec": [
								"pm.test(\"Body matches string\", function () {",
								"    pm.expect(pm.response.text()).to.include(\"湖南\"+globals[\"times\"]);",
								"});",
								"//确定下一个请求",
								"postman.setNextRequest(\"编辑标签\")"
							],
							"type": "text/javascript"
						}
					}
				],
				"folder": "f07acfaa-e774-4e5a-99c2-d549e703ac4a",
				"protocolProfileBehavior": {
					"disableBodyPruning": true
				},
				"preRequestScript": null,
				"tests": "pm.test(\"Body matches string\", function () {\n    pm.expect(pm.response.text()).to.include(\"湖南\"+globals[\"times\"]);\n});\n//确定下一个请求\npostman.setNextRequest(\"编辑标签\")",
				"currentHelper": null,
				"helperAttributes": null,
				"collectionId": "a7523639-3233-4e32-b451-3374888c5ca9",
				"rawModeData": "",
				"headers": "Content-Type: application/json\n",
				"pathVariables": {}
			}
		]
	}
],
"environments": [
	{
		"id": "0dc0c9bb-405b-4a24-bd00-adc01cb8f17a",
		"name": "线上环境",
		"values": [
			{
				"key": "ip",
				"value": "api.weixin.qq.com",
				"enabled": true
			}
		]
	},
	{
		"id": "3d3e0409-01a7-4097-b150-3b4ef800502b",
		"name": "测试环境",
		"values": [
			{
				"key": "ip",
				"value": "192.168.1.123",
				"enabled": true
			}
		]
	},
	{
		"id": "9393cde9-11af-47ac-99d1-92db7e2505bf",
		"name": "开发环境",
		"values": [
			{
				"key": "ip",
				"value": "192.168.1.222",
				"enabled": true
			}
		]
	},
	{
		"id": "43975f36-8571-4e63-adf7-eb259e4b42a9",
		"name": "My Workspace - globals",
		"values": [
			{
				"key": "access_token",
				"value": "",
				"enabled": true
			},
			{
				"key": "times",
				"value": "",
				"enabled": true
			},
			{
				"key": "tag_id",
				"value": "",
				"enabled": true
			}
		]
	}
],
"headerPresets": [],
"globals": []

}

posted @ 2019-12-04 10:25  心脏鼓点  阅读(1348)  评论(0编辑  收藏  举报