zoukankan      html  css  js  c++  java
  • postman+newman基于postman的接口自动化

    一、 安装 node.js

    1.官网下载安装包:Node.js 官方网站下载:https://nodejs.org/en/

    2.windows下cmd操作:node -v 和 npm -v 分别查看node和npm的版本号

    3.在node.js安装目录下新建两个文件夹 node_global和node_cache,更改全局安装 及 缓存路径
    在cmd命令下执行如下两个命令:
    npm config set prefix "D:soft odejs ode_global"
    npm config set cache "D:soft odejs ode_cache"
    4.执行成功。然后在环境变量 -> 系统变量中新建一个变量名为 “NODE_PATH”, 值为“D:soft odejs ode_modules”

    5,最后编辑用户变量里的Path,将相应npm的路径改为:D:Program Files odejs ode_global,如下:

    6, 在cmd命令下执行 npm install webpack -g 然后安装成功后可以看到自定义的两个文件夹已生效

    webpack 也已安装成功,执行 npm webpack -v 可以看到所安装webpack的版本号
     
    二,安装newman

    1. 管理员运行 cmd ,输入 npm install –g newman 安装成功

    2. 验证 newman –version

    3. 安装 html 套件,输入 npm install -g newman-reporter-html

      输出报告时使用的命令:
        -r html,json,junit         指定生成html,json,xml形式的测试报告
        --reporter-json-export jsonReport.json          生成json格式的测试报告
        --reporter-junit-export xmlReport.xml            生成xml格式的测试报告
        --reporter-html-export htmlReport.html          生成html格式的测试报告

    备注:默认生成的测试报告保存在当前目录下,如果文件名前加上路径,则保存在指定的目录下

    4.  安装 htmlextra 套件,输入 npm install -g newman-reporter-htmlextra

    三:newman+postman基于postman接口自动化-newman运行及测试报告输出

    1.从postman 导出的json文件

    2.cmd命令下运行从postman 导出的json文件

    进入到json文件目录下

    然后输入命令:newman run sally.postman_collection.json

    3.  输出json和html文件报告

     输入命令:newman run sally.postman_collection.json -r html,json --reporter-json-export jsonReport.json --reporter-html-export htmlReport.html

    4.生成比较高级的html报告

     输入命令:newman run sally.postman_collection.json -r htmlextra --reporter-html-export htmlReport.html

     

     Html 文件打开样式

     

    加油
  • 相关阅读:
    枚举 + 进制转换 --- hdu 4937 Lucky Number
    扫描线 + 线段树 : 求矩形面积的并 ---- hnu : 12884 Area Coverage
    暴力枚举 + 24点 --- hnu : Cracking the Safe
    dp or 贪心 --- hdu : Road Trip
    数论
    模拟 --- hdu 12878 : Fun With Fractions
    图论 --- spfa + 链式向前星 : 判断是否存在正权回路 poj 1860 : Currency Exchange
    图论 --- spfa + 链式向前星 (模板题) dlut 1218 : 奇奇与变形金刚
    图论 --- 最小生成树 + 剪枝 + 路径合并
    图论 ---- spfa + 链式向前星 ---- poj 3268 : Silver Cow Party
  • 原文地址:https://www.cnblogs.com/huahuacheng/p/14191051.html
Copyright © 2011-2022 走看看