正则表达式
正则表达式官网
https://www.runoob.com/regexp/regexp-syntax.html
- 主要使用 (.+?)进行匹配
代码头(.+?)代码尾
```sql
“topic_id”:”(.+?)”
“topic_id”:”中间件内容” (.+?)会匹配中间内容
![image.png](https://cdn.nlark.com/yuque/0/2022/png/22358770/1641264056446-ee4b0339-c160-42b7-a27a-45faa7ea300d.png#clientId=u0fddd623-72a3-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=306&id=u2604f7e3&margin=%5Bobject%20Object%5D&name=image.png&originHeight=554&originWidth=1188&originalType=binary&ratio=1&rotation=0&showTitle=false&size=35454&status=done&style=none&taskId=u0e1a430c-0d4d-4c65-86b0-70cec3a4be6&title=&width=656)
要进行正则提取的代码头或代码尾里面有 [ ] { }时,要进行转义,因为他们是正则表达式里面的特殊符号,用反斜杠 \ 转义。
```sql
比如:
"hasnot_read_messages":\[\{"id":"(.+?)", 其中 [ { 转义为符号
正则表达式提取器
添加好正则提取器之后,下游接口引用变量,用 ${变量名} 的方式引用
json断言
- 断言返回的success
- 添加一个json断言
3.在Assert JSON Path exists 后面写要断言的字段的json路径,然后勾上下面的选项,在方框里面填入预期结果
- 断言失败会爆红, 断言成功没有提示
5.预期结果也可以是上游的变量
响应断言
- 添加响应断言
对状态码断言
对响应文本断言
针对响应返回数据的断言
断言持续时间
断言持续时间,用来判断接口的请求到响应的时间是否超过我们设置的时间,超过时间则失败
添加断言持续时间
练习
获取access_token
请求方式:GET(HTTPS)
请求URL:https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=ID&corpsecret=SECRET
参数说明:
参数 |
值 |
说明 |
corpid |
wwfa4857134c5d5eec |
企业ID |
corpsecret |
mLGKGon5pX0pu4LvEbqxD5JHzGGmsGPEAlEW_nUB6Us |
应用的凭证密钥 |
会议室管理
https://work.weixin.qq.com/api/doc/90000/90135/93619
会议室的名字不能重复
函数助手
random 随机数
点击生成,就能自动把函数公式复制下来,然后再在接口中引用就可以了,引用一次之后就会生成变量,之后直接引用变量就可以了
randomString 随机字符串
postman内置变量
随机唯一性字符串
这些是唯一性很强的字符串,对于一些有唯一限制的内容可以使用这些值来填充。
Variable Name |
Description |
Examples |
$guid |
uuid-v4 风格的 guid,随机性非常强 |
“611c2e81-2ccb-42d8-9ddc-2d0bfa65c1b4” |
|
|
“3a721b7f-7dc9-4c45-9777-516942b98e0d” |
|
|
“22eca807-006b-47df-9511-e92e37f5071a” |
$timestamp |
时间戳 |
1562757107 , 1562757108 , 1562757109 |
$randomUUID |
随机 36 位的 UUID |
“6929bb52-3ab2-448a-9796-d6480ecad36b” |
|
|
“53151b27-034f-45a0-9f0a-d7b6075b67d0” |
随机文字、字符串、颜色(码)
Variable Name |
Decription |
Examples |
$randomAlphaNumeric |
1位随机字符或数字 |
6 , “y” , “z” |
$randomBoolean |
随机布尔值 (true/false) |
true , false , false , true |
$randomInt |
1~1000 之间的随机整数 |
802 , 494 , 200 |
$randomColor |
随机颜色单词 |
“red” , “fuchsia” , “grey” |
$randomHexColor |
随机颜色码 |
“#47594a” , “#431e48” , “#106f21” |
$randomAbbreviation |
随机缩写 |
SQL , PCI , JSON |
随机网络标识和 IP 地址
Variable Name |
Decription |
Examples |
$randomIP |
随机的 IPv4 地址 |
241.102.234.100 , 216.7.27.38 |
$randomIPV6 |
随机 IPv6 地址 |
dbe2:7ae6:119b:c161:1560:6dda:3a9b:90a9 |
|
|
c482:23a4:ce4c:a668:7736:6cc5:b0b6:cc37 |
|
|
c791:18d1:fbba:87d8:d929:22aa:5a0a:ac3d |
$randomMACAddress |
随机 MAC(物理)地址 |
33:d4:68:5f:b4:c7 , 1f:6e:db:3d:ed:fa |
$randomPassword |
由字母和数字组成的 15 位随机密码 |
t9iXe7COoDKv8k3 , QAzNFQtvR9cg2rq |
$randomLocale |
随机两位字母组成的语言代码 (ISO 639-1) |
“ny” , “sr” , “si” |
$randomUserAgent |
随机用户代理 |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.9.8; rv:15.6) Gecko/20100101 Firefox/15.6.6 |
|
|
Opera/10.27 (Windows NT 5.3; U; AB Presto/2.9.177 Version/10.00) |
|
|
Mozilla/5.0 (Windows NT 6.2; rv:13.5) Gecko/20100101 Firefox/13.5.6 |
$randomProtocol |
随机协议类型 |
“http” , “https” |
$randomSemver |
由数字组成的随机版本号 |
7.0.5 , 2.5.8 , 6.4.9 |
随机姓名(英文)
Variable Name |
Decription |
Examples |
$randomFirstName |
随机的名字(英文) |
Ethan , Chandler , Megane |
$randomLastName |
随机姓氏(英文) |
Schaden , Schneider , Willms |
$randomFullName |
随机全名(名字 姓氏) |
Connie Runolfsdottir , Sylvan Fay , Jonathon Kunze |
$randomNamePrefix |
随机称呼 |
Dr. , Ms. , Mr. |
$randomNameSuffix |
随机姓名后缀 |
I , MD , DDS |
职业
Variable Name |
Decription |
Examples |
$randomJobArea |
随机工作范围 |
Mobility , Intranet , Configuration |
$randomJobDescriptor |
随机职业等级 |
Forward , Corporate , Senior |
$randomJobTitle |
随机工作标题 |
International Creative Liaison , |
|
|
Product Factors Officer , |
|
|
Future Interactions Executive |
$randomJobType |
随机工作类型 |
Supervisor , Manager , Coordinator |
随机电话号码、区域、地址
Variable Name |
Decription |
Examples |
$randomPhoneNumber |
随机 10 位数字电话号码 |
700-008-5275 , 494-261-3424 , 662-302-7817 |
$randomPhoneNumberExt |
随机扩展号码(包含区号) |
27-199-983-3864 , 99-841-448-2775 |
$randomCity |
随机城市名称 |
Spinkahaven , Korbinburgh , Lefflerport |
$randomStreetName |
随机街道名称 |
Kuhic Island , General Street , Kendrick Springs |
$randomStreetAddress |
随机街道地址 |
5742 Harvey Streets , 47906 Wilmer Orchard |
$randomCountry |
随机国家名称 |
Lao People’s Democratic Republic , Kazakhstan , Austria |
$randomCountryCode |
随机两位字符的国家编码 (ISO 3166-1 alpha-2) |
CV , MD , TD |
$randomLatitude |
随机纬度 |
55.2099 , 27.3644 , -84.7514 |
$randomLongitude |
随机精度 |
40.6609 , 171.7139 , -159.9757 |
随机图片
随机金融类数据
Variable Name |
Decription |
Examples |
$randomBankAccount |
随机的8位数字银行帐号 |
09454073 , 65653440 , 75728757 |
$randomBankAccountName |
随机的银行帐户名称(e.g. savings account, checking account) |
Home Loan Account , Checking Account , Auto Loan Account |
$randomCreditCardMask |
随机屏蔽的信用卡号 |
3622 , 5815 , 6257 |
$randomBankAccountBic |
随机银行识别码 (Bank Identifier Code) |
EZIAUGJ1 , KXCUTVJ1 , DIVIPLL1 |
$randomBankAccountIban |
随机 15-31位的国际银行帐号 (International Bank Account Number) |
MU20ZPUN3039684000618086155TKZ |
|
|
BR7580569810060080800805730W2 |
|
|
XK241602002200395017 |
$randomTransactionType |
随机交易类型 (e.g. invoice, payment, deposit) |
invoice , payment , deposit |
$randomCurrencyCode |
随机的 3 位字母的货币代码 (ISO-4217) |
CDF , ZMK , GNF |
$randomCurrencyName |
随机货币名称 |
CFP Franc , Cordoba Oro , Pound Sterling |
$randomCurrencySymbol |
随机货币标志 |
$ , £ |
$randomBitcoin |
随机比特币地址 |
3VB8JGT7Y4Z63U68KGGKDXMLLH5 |
|
|
1GY5TL5NEX3D1EA0TCWPLGVPQF5EAF |
|
|
14IIEXV2AKZAHSCY2KNYP213VRLD |
随机商业数据
Variable Name |
Decription |
Examples |
$randomCompanyName |
随机公司名称 |
Johns - Kassulke , Grady LLC |
$randomCompanySuffix |
随机公司后缀(e.g. Inc, LLC, Group) |
Inc , LLC , Group |
$randomBs |
随机商业用语 |
killer leverage schemas , |
|
|
bricks-and-clicks deploy markets , |
|
|
world-class unleash platforms |
$randomBsAdjective |
随机商业形容词用语 |
viral , 24/7 , 24/365 |
$randomBsBuzz |
随机商业流行词 |
repurpose , harness , transition |
$randomBsNoun |
随机商业名词 |
e-services , markets , interfaces |
随机警句(标语)
Variable Name |
Decription |
Examples |
$randomCatchPhrase |
随机名言警句 |
Future-proofed heuristic open architecture , |
|
|
Quality-focused executive toolset , |
|
|
Grass-roots real-time definition |
$randomCatchPhraseAdjective |
随机流行语形容词 |
Self-enabling , Business-focused , Down-sized |
$randomCatchPhraseDescriptor |
随机流行描述符号 |
bandwidth-monitored , needs-based , homogeneous |
$randomCatchPhraseNoun |
随机生成给一个流行名词 |
secured line , superstructure , installation |
随机数据库相关数据
Variable Name |
Decription |
Examples |
$randomDatabaseColumn |
随机数据库列名 |
updatedAt , token , group |
$randomDatabaseType |
随机数据库类型 |
tinyint , text |
$randomDatabaseCollation |
随机数据库排序规则 |
cp1250_bin , utf8_general_ci , cp1250_general_ci |
$randomDatabaseEngine |
随机数据库引擎 |
MyISAM , InnoDB , Memory |
随机日期
Variable Name |
Decription |
Examples |
$randomDateFuture |
随机未来时间 |
Tue Mar 17 2020 13:11:50 GMT+0530 (India Standard Time) , |
|
|
Fri Sep 20 2019 23:51:18 GMT+0530 (India Standard Time) , |
|
|
Thu Nov 07 2019 19:20:06 GMT+0530 (India Standard Time) |
$randomDatePast |
随机过去时间 |
Sat Mar 02 2019 09:09:26 GMT+0530 (India Standard Time) , |
|
|
Sat Feb 02 2019 00:12:17 GMT+0530 (India Standard Time) , |
|
|
Thu Jun 13 2019 03:08:43 GMT+0530 (India Standard Time) |
$randomDateRecent |
随机近期时间 |
Tue Jul 09 2019 23:12:37 GMT+0530 (India Standard Time) , |
|
|
Wed Jul 10 2019 15:27:11 GMT+0530 (India Standard Time) , |
|
|
Wed Jul 10 2019 01:28:31 GMT+0530 (India Standard Time) |
$randomWeekday |
随机星期几 |
Thursday , Friday , Monday |
$randomMonth |
随机月份 |
February , May , January |
随机域名、电子邮件和用户名
Variable Name |
Decription |
Examples |
$randomDomainName |
随机完整域名 |
gracie.biz , armando.biz , trevor.info |
$randomDomainSuffix |
随机顶级域名 |
org , net , com |
$randomDomainWord |
随机不合法域名 |
gwen , jaden , donnell |
$randomEmail |
随机电子邮箱地址 |
Pablo62@gmail.com , Ruthe42@hotmail.com , Iva.Kovacek61@hotmail.com |
$randomExampleEmail |
随机电子邮箱地址,域名为example |
Talon28@example.com , Quinten_Kerluke45@example.net , Casey81@example.net |
$randomUserName |
随机用户名 |
Jarrell.Gutkowski , Lottie.Smitham24 , Alia99 |
$randomUrl |
随机 URL 地址 |
https://anais.net , https://tristin.net , http://jakob.name |
随机文件名和目录
Variable Name |
Decription |
Examples |
$randomFileName |
随机文件名 (包括不常用的扩展名) |
neural_sri_lanka_rupee_gloves.gdoc , |
|
|
plastic_awesome_garden.tif , |
|
|
incredible_ivory_agent.lzh |
$randomFileType |
随机文件类型 (包括不常用的文件类型) |
model , application , video |
$randomFileExt |
随机文件扩展名 (包括不常见的文件扩展名) |
war , book , fsc |
$randomCommonFileName |
随机文件名 |
well_modulated.mpg4 , |
|
|
rustic_plastic_tuna.gif , |
|
|
checking_account_end_to_end_robust.wav |
$randomCommonFileType |
随机常见文件类型 |
application , audio |
$randomCommonFileExt |
随机常见文件扩展名 |
m2v , wav , png |
$randomFilePath |
随机文件路径 |
/home/programming_chicken.cpio , |
|
|
/usr/obj/fresh_bandwidth_monitored_beauty.onetoc , |
|
|
/dev/css_rustic.pm |
$randomDirectoryPath |
随机目录路径 |
/usr/bin , /root , /usr/local/bin |
$randomMimeType |
随机 MIME 类型(header 中的 content-type 会用到) |
audio/vnd.vmx.cvsd , |
|
|
application/vnd.groove-identity-message , |
|
|
application/vnd.oasis.opendocument.graphics-template |
随机物料(库存、商品等)
Variable Name |
Decription |
Examples |
$randomPrice |
随机生成 100.00 ~ 999.00 之间的价格 |
531.55 , 488.76 , 511.56 |
$randomProduct |
随机商品 |
Towels , Pizza , Pants |
$randomProductAdjective |
随机商品形容词 |
Unbranded , Incredible , Tasty |
$randomProductMaterial |
随机商品材料 |
Steel , Plastic , Frozen |
$randomProductName |
随机商品名称 |
Handmade Concrete Tuna , Refined Rubber Hat |
$randomDepartment |
随机商业分类 |
Tools , Movies , Electronics |
基于英语语法的随机数据
Variable Name |
Decription |
Examples |
$randomNoun |
随机名词 |
matrix , bus , bandwidth |
$randomVerb |
随机动词 |
parse , quantify , navigate |
$randomIngverb |
随机带 “-ing” 的动词 |
synthesizing , navigating , backing up |
$randomAdjective |
随机形容词 |
auxiliary , multi-byte , back-end |
$randomWord |
随机单词 |
withdrawal , infrastructures , IB |
$randomWords |
一些随机单词构成的字符串 |
Samoa Synergistic sticky copying Grocery , |
|
|
Corporate Springs , |
|
|
Christmas Island Ghana Quality |
$randomPhrase |
随机短语 |
You can’t program the monitor without navigating the mobile XML program! , |
|
|
overriding the capacitor won’t do anything, we need to compress the optical SMS transmitter! , |
|
|
I’ll generate the virtual AI program, that should microchip the RAM monitor! |
随机的文本内容
Variable Name |
Decription |
Examples |
$randomLoremWord |
随机单词 |
est |
$randomLoremWords |
随机单词构成的短语 |
vel repellat nobis |
$randomLoremSentence |
随机单词构成的句子 |
Molestias consequuntur nisi non quod. |
$randomLoremSentences |
随机 2~6 条句子构成的段落 |
Et sint voluptas similique iure amet perspiciatis vero sequi atque. Ut porro sit et hic. Neque aspernatur vitae fugiat ut dolore et veritatis. Ab iusto ex delectus animi. Voluptates nisi iusto. Impedit quod quae voluptate qui. |
$randomLoremParagraph |
随机单词构成的一段话 |
Ab aliquid odio iste quo voluptas voluptatem dignissimos velit. Recusandae facilis qui commodi ea magnam enim nostrum quia quis. Nihil est suscipit assumenda ut voluptatem sed. Esse ab voluptas odit qui molestiae. Rem est nesciunt est quis ipsam expedita consequuntur. |
$randomLoremParagraphs |
随机单词构成的 3 个段落 |
Voluptatem rem magnam aliquam ab id aut quaerat. Placeat provident possimus voluptatibus dicta velit non aut quasi. Mollitia et aliquam expedita sunt dolores nam consequuntur. Nam dolorum delectus ipsam repudiandae et ipsam ut voluptatum totam. Nobis labore labore recusandae ipsam quo. |
|
|
Voluptatem occaecati omnis debitis eum libero. Veniam et cum unde. Nisi facere repudiandae error aperiam expedita optio quae consequatur qui. Vel ut sit aliquid omnis. Est placeat ducimus. Libero voluptatem eius occaecati ad sint voluptatibus laborum provident iure. |
|
|
Autem est sequi ut tenetur omnis enim. Fuga nisi dolor expedita. Ea dolore ut et a nostrum quae ut reprehenderit iste. Numquam optio magnam omnis architecto non. Est cumque laboriosam quibusdam eos voluptatibus velit omnis. Voluptatem officiis nulla omnis ratione excepturi. |
$randomLoremText |
随机单词构成的文本 |
Quisquam asperiores exercitationem ut ipsum. Aut eius nesciunt. Et reiciendis aut alias eaque. Nihil amet laboriosam pariatur eligendi. Sunt ullam ut sint natus ducimus. Voluptas harum aspernatur soluta rem nam. |
$randomLoremSlug |
随机单词构成的 URL 部分 |
eos-aperiam-accusamus , beatae-id-molestiae , qui-est-repellat |
$randomLoremLines |
由随机单词构成的 1~5 行数据(用回车符分隔) |
Ducimus in ut mollitia.\nA itaque non.\nHarum temporibus nihil voluptas.\nIste in sed et |