• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

性能七postman接口文件制成jmeter能用的文件

武飞扬头像
演$员
帮助1


(做个笔记,自己以后忘了方便查找,后续会更新 手动转移相关操作)

一、使用工具包实现文件转化

将postman脚本导出后一般都是json文件,而jmeter文件一般都是jmx格式

1.工具安装

目标:将json文件转化成jmx文件
依赖:对系统无依赖,但需要安装了java、maven
检查是否安装了java、maven

java -version
mvn -v

未安装的同学可以参考我的另一篇文章先完成安装:
https://blog.csdn.net/weixin_45072910/article/details/123505554?spm=1001.2014.3001.5502
1.下载postman2jmx工具包
可以直接去GitHub上下载:https://github.com/Loadium/postman2jmx
也可以直接用我现在用的包
链接:https://pan.百度.com/s/1WV41pfdDha2oyzHzttNxHQ
提取码:x2e6


2.安装postman2jmx工具包
下载后随意找一个地方存放,解压,再进入postman2jmx目录

unzip postman2jmx-master.zip
cd postman2jmx/target/Postman2Jmx

3.打包postman2jmx,制作可执行的jar包
下载后随意找一个地方存放,解压,再进入postman2jmx目录

[root@localhost postman2jmx]# mvn package
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for loadium:postman2jmx:jar:0.2.5
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 162, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------< loadium:postman2jmx >-------------------------
[INFO] Building postman2jmx 0.2.5
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/3.0.2/maven-resources-plugin-3.0.2.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/3.0.2/maven-resources-plugin-3.0.2.pom (7.1 kB at 5.0 kB/s)
......省略......
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-archiver/2.1/plexus-archiver-2.1.jar (184 kB at 26 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar (226 kB at 28 kB/s)
[INFO] Building jar: /data/postman2jmx/target/Postman2Jmx/Postman2Jmx.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  08:34 min
[INFO] Finished at: 2022-03-29T03:02:23-07:00

完成打包后,可以看到jar包

[root@localhost Postman2Jmx]# ll
total 92
drwxr-xr-x. 3 root root    17 Mar 29 02:59 jmeter
drwxr-xr-x. 2 root root  8192 Mar 29 03:02 lib
-rw-r--r--. 1 root root 79991 Mar 29 03:02 Postman2Jmx.jar

2.工具使用方法

1.打包流程
在打jar包的路径下(包含Postman2Jmx.jar),执行以下格式命令即可完成Postman-JSON格式文件向JMX格式文件的转化:

java -jar Postman2Jmx.jar JSON_FILE/trace.postman_collection.json JMX_FILE/trace.jmx

打包成功:

[root@localhost Postman2Jmx]# java -jar Postman2Jmx.jar JSON_FILE/trace.postman_collection.json JMX_FILE/trace.jmx
[22-Mar-29 03:06:09:216] [INFO] [Postman2Jmx:28] - Trying to parse postman collection file: JSON_FILE/trace.postman_collection.json
[22-Mar-29 03:06:09:439] [INFO] [Postman2Jmx:31] - Successfully parsed postman collection file: JSON_FILE/trace.postman_collection.json, Total parsed item count: 3
[22-Mar-29 03:06:09:439] [INFO] [Postman2Jmx:33] - Trying to build jmx file: JMX_FILE/trace.jmx
[22-Mar-29 03:06:09:477] [WARN] [JMeterUtils:703] - Exception 'null' occurred when fetching int property:'jmeterengine.threadstop.wait', defaulting to: 5000
[22-Mar-29 03:06:09:477] [WARN] [JMeterUtils:703] - Exception 'null' occurred when fetching int property:'jmeterthread.rampup.granularity', defaulting to: 1000
[22-Mar-29 03:06:09:493] [WARN] [JMeterUtils:703] - Exception 'null' occurred when fetching int property:'httpsampler.max_bytes_to_store_per_request', defaulting to: 0
[22-Mar-29 03:06:09:493] [WARN] [JMeterUtils:703] - Exception 'null' occurred when fetching int property:'httpsampler.max_buffer_size', defaulting to: 66560
[22-Mar-29 03:06:09:493] [WARN] [JMeterUtils:730] - Exception 'null' occurred when fetching boolean property:'httpsampler.ignore_failed_embedded_resources', defaulting to: false
[22-Mar-29 03:06:09:494] [WARN] [JMeterUtils:730] - Exception 'null' occurred when fetching boolean property:'httpsampler.embedded_resources_use_md5', defaulting to: false
[22-Mar-29 03:06:09:494] [WARN] [JMeterUtils:794] - Exception 'null' occurred when fetching String property:'httpsampler.user_defined_methods', defaulting to:
[22-Mar-29 03:06:09:498] [WARN] [JMeterUtils:703] - Exception 'null' occurred when fetching int property:'httpsampler.max_redirects', defaulting to: 20
[22-Mar-29 03:06:09:498] [WARN] [JMeterUtils:703] - Exception 'null' occurred when fetching int property:'httpsampler.max_frame_depth', defaulting to: 5
[22-Mar-29 03:06:09:498] [WARN] [JMeterUtils:812] - Exception 'null' occurred when fetching String property:'HTTPResponse.parsers'
[22-Mar-29 03:06:09:498] [WARN] [JMeterUtils:730] - Exception 'null' occurred when fetching boolean property:'httpsampler.redirect.removeslashdotdot', defaulting to: true
[22-Mar-29 03:06:09:499] [WARN] [JMeterUtils:730] - Exception 'null' occurred when fetching boolean property:'httpsampler.separate.container', defaulting to: true
[22-Mar-29 03:06:09:511] [WARN] [JMeterUtils:730] - Exception 'null' occurred when fetching boolean property:'CookieManager.delete_null_cookies', defaulting to: true
[22-Mar-29 03:06:09:512] [WARN] [JMeterUtils:730] - Exception 'null' occurred when fetching boolean property:'CookieManager.allow_variable_cookies', defaulting to: true
[22-Mar-29 03:06:09:512] [WARN] [JMeterUtils:794] - Exception 'null' occurred when fetching String property:'CookieManager.name.prefix', defaulting to: COOKIE_
[22-Mar-29 03:06:09:512] [WARN] [JMeterUtils:730] - Exception 'null' occurred when fetching boolean property:'CookieManager.save.cookies', defaulting to: false
[22-Mar-29 03:06:09:512] [WARN] [JMeterUtils:730] - Exception 'null' occurred when fetching boolean property:'CookieManager.check.cookies', defaulting to: true
[22-Mar-29 03:06:09:513] [INFO] [CookieManager:87] - Settings: Delete null: true Check: true Allow variable: true Save: false Prefix: COOKIE_
[22-Mar-29 03:06:09:719] [INFO] [SaveService:163] - Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
[22-Mar-29 03:06:09:752] [WARN] [JMeterUtils:794] - Exception 'null' occurred when fetching String property:'saveservice_properties', defaulting to: /bin/saveservice.properties
[22-Mar-29 03:06:09:758] [WARN] [JMeterUtils:794] - Exception 'null' occurred when fetching String property:'saveservice_properties', defaulting to: /bin/saveservice.properties
[22-Mar-29 03:06:09:760] [INFO] [SaveService:233] - Using SaveService properties file encoding UTF-8
[22-Mar-29 03:06:09:764] [INFO] [SaveService:227] - Using SaveService properties version 4.0
[22-Mar-29 03:06:09:811] [INFO] [Postman2Jmx:36] - Successfully build jmx file: JMX_FILE/trace.jmx

2.使用Jmeter打开生成的jmx文件

学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgfjegg
系列文章
更多 icon
同类精品
更多 icon
继续加载