Use of Postman

Source: Internet
Author: User

postman function (https://www.getpostman.com/features)

    • Primarily used to simulate network request packets
    • Quick Create request
    • Replay, manage requests
    • Quickly set up a network proxy

Installation:

    •   Directly click on the logo in the top left corner of Google Chrome: And then click on Google Web Store
    • Again out of the search box in the page directly search "Postman", add on it.

Use:

    •   Postman the use of simple and clear, in the Address bar to enter the interface you want to test, set parameters, directly submitted on it. Support various access methods: Post,get,delete,put and so on.

Manage requests

    •   Postman has a collection option in the left box, which allows you to save your test operations, form a system, and even export these configurations for large-scale testing, which is followed by an introduction
    • Late in use, only need to find the corresponding request name in this collections, you can directly use the request

Environment variables

    •   Select "Manage environments--add" to set the environment information in the page, for example, add an environment variable: key--url, value--http://www.baidu.com
    • The use of environment variables is very simple, as I added above, directly using {{URL}}, used Angularjs must be familiar with this usage!
    • We can enter {{URL}} directly in the URL, then send, will find that we directly on the URL to enter http://www.baidu.com on the no difference
    • Multiple different environment variables can be set to switch

Postman combined with Newman

  • Newman
    • Official note: Postman ' s command-line companion lets do amazing things! With Newman, you can integrate Postman collections with your build system. Or You can run the automated tests for your API through a cron job.
    • Overview: Integrated Postman API Test command-line execution tool
    • Home: Https://www.npmjs.com/package/newman
    • Based on node. JS, can be installed in Linux/windows/mac
    • installation command:
      NPM Install-g Newman
    • Verify that the installation is successful
    • Newman-v

      The version number appears, the installation succeeds

    • Run as, execute Postman exported collection file
    • Newman-c *.json.postman_collection
  • Newman command-line operations
    • Executes the specified collection file
    • Newman-c *.json.postman_collection
    • Collection files and environment files for the execution of pointers
    • Newman-c *.json.postman_collection-e *.postman_environment
    • Execute the collection saved to the server
    • Newman-u Https://www.getpostman.com/collections/cb208e7e64056f5294e5
    • Loop through collection Files 5 times
    • Newman-u Https://www.getpostman.com/collections/cb208e7e64056f5294e5-n 5
    • Detailed Newman command usage
    •   Usage:newman [Options] Options:-H,--help output usage information-v,--version  Output the version number-c,--collection [file] Specify a Postman collection as a JSON [file]-U, --url [url] Specify a Postman collection as a [url]-F,--folder [Folder-name] Run a single Folde R from a collection. To be used with-c or-u-E,--environment [file] Specify a Postman environment as a JSON [file]-E,--export               Environment [file] Specify an output file to dump the Postman environment before exiting [file]-D,--data [file] Specify a data file to use either JSON or CSV-G,--global [file] Specify a Postman globals file [File]-G,--exportglobals [file] Specify an output file to dump Globals before exiting [file]-y,--delay [num BER] Specify a delay (in ms) between Requests-r,--requesttimeout [number] Specify a request timeout (in Ms For Requests-r,--avoidredirects prevents Newman from automatically following redirects-s,--stoponerr Or Stops the runner with code=1 if a test case fails-j,--nosummary doesn ' t show the S                   Ummary for each iteration-n,--number [number] Define the number of iterations to Run-c,--nocolor                       Disable colored output-k,--insecure Disable strict ssl-l,--tls Use Tlsv1-n,--encoding [Encoding-type] Specify a encoding for the response. Supported values is Ascii,utf8,utf16le,ucs2,base64,binary,hex-x,--exitcode Continue running tests E Ven after a failure, but exit with Code=1. Incompatible with--stoponerror-o,--outputfile [file] Path to file where output should is written [file]- O,--outputfileverbose [file] Path to file where full request and responses should is logged [file]-T,--testreportfi Le [file] Path to file where results should is written as JUnit XML [file]-I,--import [file] Import a Postman backup F                    Ile, and save collections, environments, and Globals [file] (incompatible with any option except pretty)-P,--pretty               Enable Pretty-print while saving imported collections, environments, and globals-h,--html [file]     Export a HTML report to a specified file [file]-W,--whitescreen Black text for white screen -L,--recurselimit [limit] does not run recursive resolution more than [limit] times. Default = 10. Using 0 would prevent any Varialbe resolution Newman are a command-line collection runner for Postman.    Must specify a collection file or a collection URL to run Newman a collection file or URL is mandatory Examples: Newman-c postman_collection newman-u postman_collection-e postman_environment newman-c postman_collection-f SAM Ple_folder for more documentation, issues and examples HeaD over to Https://github.com/postmanlabs/newman 
  • Jenkins Integration
    • Since Newman supports command line operation, it is easy to integrate Jenkins. Add command line to the job of Jenkins, with the following content:
    • Newman-c *.json.postman_collection--exitcode 1

Use of Postman

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.