欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Postman測試報告的生成方法

 更新時間:2022年01月14日 09:18:55   作者:特昂糖  
做完測試后,都會編寫一份測試報告,測試報告中最主要的就是呈現(xiàn)出測試結(jié)果,哪些用例通過了,哪些用例沒有通過。像postman這么強(qiáng)大的功能也可以自動生成報告,供我們測試同學(xué)進(jìn)行查看,顯得更加有B格

我們使用工具newman就可以生成測試報告(自動化測試的結(jié)果)

Newman是一款基于nodejs開發(fā)的可以運行postman腳本的工具,使用Newman,可以直接從命令運行和測試postman集合。

使用newman的前提是需要安裝node.js,通過node.js來安裝newman的工具

安裝newman的命令:

npm install -g newman --registry=https://registry.npm.taobao.org

1.安裝node.js

  下載地址:https://nodejs.org/en/download/下載適合自己電腦的版本,這里我們使用Windows平臺

  安裝:只需雙擊即可完成安裝,在這里建議不要將路徑放到C盤,這是一種安裝軟件的共識。并且在安裝的過程中,安裝向?qū)б呀?jīng)幫我們完成了環(huán)境變量的注冊,我們可以通過環(huán)境變量來查看

  驗證是否配置成功:控制臺輸入npm,如果顯示以下數(shù)據(jù)則表示安裝并且配置成功

C:\Users\特昂糖>npm
npm <command>
Usage:
npm install        install all the dependencies in your project
npm install <foo>  add the <foo> dependency to your project
npm test           run this project's tests
npm run <foo>      run the script named <foo>
npm <command> -h   quick help on <command>
npm -l             display usage info for all commands
npm help <term>    search for help on <term> (in a browser)
npm help npm       more involved overview (in a browser)
All commands:
    access, adduser, audit, bin, bugs, cache, ci, completion,
    config, dedupe, deprecate, diff, dist-tag, docs, doctor,
    edit, exec, explain, explore, find-dupes, fund, get, help,
    hook, init, install, install-ci-test, install-test, link,
    ll, login, logout, ls, org, outdated, owner, pack, ping,
    pkg, prefix, profile, prune, publish, rebuild, repo,
    restart, root, run-script, search, set, set-script,
    shrinkwrap, star, stars, start, stop, team, test, token,
    uninstall, unpublish, unstar, update, version, view, whoami
Specify configs in the ini-formatted file:
    C:\Users\特昂糖\.npmrc
or on the command line via: npm <command> --key=value
More configuration info: npm help config
Configuration fields: npm help 7 config
npm@8.1.2 D:\Ruanjian\node_modules\npm   #這里顯示的是軟件所在本地磁盤路徑

2.安裝newman

  node.js配置成功后我們就可以安裝newman了,安裝newman的命令為:npm install -g newman --registry=https://registry.npm.taobao.org

C:\Users\特昂糖>npm install -g newman --registry=https://registry.npm.taobao.org
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

added 128 packages in 13s
npm notice
npm notice New minor version of npm available! 8.1.2 -> 8.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.3.0
npm notice Run npm install -g npm@8.3.0 to update!
npm notice

  驗證是否安裝成功:

C:\特昂糖>newman
Usage: newman [options] [command]
Options:
  -v, --version               output the version number
  -h, --help                  display help for command
Commands:
  run [options] <collection>  Initiate a Postman Collection run from a given URL or path
To get available options for a command:
  newman <command> -h

3.控制臺生成測試報告

首先在postman中導(dǎo)出測試數(shù)據(jù)

這里以我的為例,下載地址:http://xiazai.jb51.net/202201/yuanma/postman_collection_jb51.rar

控制臺進(jìn)入導(dǎo)出文件所在本地磁盤路徑
生成測試報告

newman run ?+導(dǎo)出的測試數(shù)據(jù)文件名稱

4.生成HTML的測試報告    

安裝HTML套件

newman 支持四種格式報告文件:cli,json,html,junit
生成 html 報告時需要安裝html套件,命令行中執(zhí)行:
  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格式的測試報告
    默認(rèn)生成的測試報告保存在當(dāng)前目錄下,如果文件名前加上路徑,則保存在指定的目錄下

  例:輸出json和html文件報告

生成html測試報告

輸出命令:
       newman run 風(fēng)暴平臺.postman_collection.json -r html

5.輸出htmlextra報告

安裝htmlextra套件

npm install -g newman-reporter-htmlextra

運行htmlextra套件 

newman run 風(fēng)暴平臺.postman_collection.json -r htmlextra

結(jié)果展示

到此這篇關(guān)于Postman測試報告的生成的文章就介紹到這了,更多相關(guān)Postman測試報告內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Postman全局注冊方法及對返回數(shù)據(jù)可視化處理

    Postman全局注冊方法及對返回數(shù)據(jù)可視化處理

    這篇文章主要為大家介紹了Postman全局注冊方法及對返回數(shù)據(jù)可視化處理詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-02-02
  • 詳解IDEA Git Reset 選項說明

    詳解IDEA Git Reset 選項說明

    這篇文章主要介紹了詳解IDEA Git Reset 選項說明,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-08-08
  • 日歷控件和天氣使用分享

    日歷控件和天氣使用分享

    本文給大家分享的2個簡單而且實用的小功能代碼,分別是日歷控件和天氣預(yù)報接口,推薦給大家,需要的小伙伴快來參考下吧
    2015-03-03
  • Chrome 調(diào)試技巧(小結(jié))

    Chrome 調(diào)試技巧(小結(jié))

    這篇文章主要介紹了Chrome 調(diào)試技巧(小結(jié)),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-09-09
  • 日常收集整理的Git常用命令

    日常收集整理的Git常用命令

    Git 是一個很強(qiáng)大的分布式版本控制系統(tǒng)。它不但適用于管理大型開源軟件的源代碼,管理私人的文檔和源代碼也有很多優(yōu)勢。下面腳本之家小編給大家?guī)砹薌it 常用命令,感興趣的朋友一起看看吧
    2017-10-10
  • vscode中setting.json配置文件配置詳解

    vscode中setting.json配置文件配置詳解

    這篇文章主要給大家介紹了關(guān)于vscode中setting.json配置文件配置的相關(guān)資料,VSCode中的setting.json文件用于存儲用戶自定義的配置設(shè)置,文中給出了詳細(xì)的代碼示例,需要的朋友可以參考下
    2023-09-09
  • 快速解決eclipse中注釋的代碼依然會執(zhí)行的問題

    快速解決eclipse中注釋的代碼依然會執(zhí)行的問題

    下面小編就為大家?guī)硪黄焖俳鉀Qeclipse中注釋的代碼依然會執(zhí)行的問題。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-12-12
  • 詳解git merge命令應(yīng)用的三種情景

    詳解git merge命令應(yīng)用的三種情景

    這篇文章主要介紹了詳解git merge命令應(yīng)用的三種情景,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-08-08
  • Web 開發(fā)常用工具 大家自己查找下載

    Web 開發(fā)常用工具 大家自己查找下載

    看到了Web通信分析工具 這篇文章,除了burpsuite其他我日常都經(jīng)常使用。于似乎我整理了一下我自己用的其他的WEB開發(fā)工具。
    2009-06-06
  • 詳解VSCode打開多個項目文件夾的解決方法

    詳解VSCode打開多個項目文件夾的解決方法

    這篇文章主要介紹了詳解VSCode打開多個項目文件夾的解決方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-04-04

最新評論