当前位置:网站首页>Analysis of postman core functions - parameterization and test report
Analysis of postman core functions - parameterization and test report
2022-07-05 18:56:00 【Little brother said test】
1. Parametric processing
A parameterized : For an interface , There are a large number of test data that need to be verified in batch , Changing request parameters one by one is too time-consuming and labor-consuming , It is more efficient to use parameterized batch data processing , The general implementation is through document parameterization .
create a file Format CSV
The first line of information in the file It needs to match the parameter variable
Batch execution
Parameterized assertion
Add assertion data
// Set a variable assert
assert = pm.variables.get("assert");
// break said message word paragraph value by success
pm.test("message The field values for success", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.message).to.eql(assert);
});
2. Postman Generate test reports
Postman Use runner
Runtime , The generated report can only be in Postman Inside view , It's not very convenient . So you can generate a HTML
The report , Open it through the browser
Postman Need generation HTML
Reports need to use newman
, With the help of newman Tool generation .
2.1 install newman
newman It's using node.js
Development , Specially for postman A tool plug-in for generating test reports . We need to install node.js、newman、newman plug-in unit :newman-reporter-html
download node.js:https://nodejs.org/en/ Proposed installation 15 perhaps 16 edition
npm install -g cnpm --
registry=https://registry.npm.taobao.org install newman: open cmd, Input npm install -g newman
install
newman-reporter-html
open cmd, Inputnpm install -g newman-reporter-html
2.2newman The command runs the use case
newman run Use case set .json -e Environmental documents .json -d Data files .json -r html --repoter-html-export report.html
newman run Use case set .json
The meaning of running a use case set
-e Environmental documents .json Specify the running environment
-d Data files .json Specify the data to run
-r html Generate html The report
--reporter-html-export report.html Appoint html Report name is report.html
You need to export the script before execution / Data files / Environment files such as :
newman run token.postman_collection.json -d logindata.txt -e pinter project .postman_environment.json -n 3 -r html --reporter-html-export .\
After execution, the directory generates a report file
Finally, thank everyone who reads my article carefully , Watching the rise and attention of fans all the way , Reciprocity is always necessary , Although it's not very valuable , If you can use it, you can take it
These materials , For those engaged in 【 software test 】 For our friends, it should be the most comprehensive and complete war preparation warehouse , This warehouse also accompanied me through the most difficult journey , I hope it can help you ! Everything should be done as soon as possible , Especially in the technology industry , We must improve our technical skills . I hope that's helpful …….
边栏推荐
猜你喜欢
自动化测试的好处
技术分享 | 常见接口协议解析
RedHat7.4配置yum软件仓库(RHEL7.4)
Find in MySQL_ in_ Detailed explanation of set() function usage
面试官:Redis 过期删除策略和内存淘汰策略有什么区别?
The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
进程间通信(IPC):共享内存
集合处理的利器
2022最新中高级Android面试题目,【原理+实战+视频+源码】
@Extension, @spi annotation principle
随机推荐
sample_rate(采樣率),sample(采樣),duration(時長)是什麼關系
【HCIA-cloud】【1】云计算的定义、什么是云计算、云计算的架构与技术说明、华为云计算产品、华为内存DDR配置工具说明
进程间通信(IPC):共享内存
The easycvr authorization expiration page cannot be logged in. How to solve it?
2022 latest Android interview written examination, an Android programmer's interview experience
Lombok @builder annotation
怎么自动安装pythn三方库
Tupu software digital twin smart wind power system
彻底理解为什么网络 I/O 会被阻塞?
Various pits of vs2017 QT
c期末复习
AI Open2022|基于异质信息网络的推荐系统综述:概念,方法,应用与资源
XML basic knowledge concept
5. 数据访问 - EntityFramework集成
C language makes it easy to add, delete, modify and check the linked list "suggested collection"
How to choose the most formal and safe external futures platform?
The origin of PTS, DTS and duration of audio and video packages
视频自监督学习综述
AI open2022 | overview of recommendation systems based on heterogeneous information networks: concepts, methods, applications and resources
Simple query cost estimation