Preface: A similar HTTP request tool was introduced in the front: Advanced Rest Client Debugging restful This article introduces a more powerful tool like postman. Developing APIs are hard, Postman makes it easy. A powerful GUI platform to make your APIs development faster & easier, from building API requests through testing, docu Mentation and sharing. The literal meaning can be seen, is a tool for API development testing. Make development faster and easier, support HTTP request access testing, document configuration, environment export sharing. Postman provides a powerful Web API and debugging of HTTP requests that can send any type of HTTP request (GET, POST, PUT, DELETE ...) and can be shipped with any number of parameters and Headers. Not only that, it also provides import and export of test data and environment configuration data, and paid Post Cloud users can also create their own team Library for teamwork-friendly testing and to share their test collections and use-case data with the team.
I. Download and installation
two. Simple use of Postman
three. Configuring Local environment Variables
Four. Configuring Global environment Variables
Five. Configure Pre-request Script, Tests
Six. Test favorites and use case data sharing
I. Download and installation
No hard, go to the official website or Baidu, a lot of resources. Official address: https://www.getpostman.com Baidu first article: http://www.pc6.com/softview/SoftView_423615.html
two. Simple use of PostmanDownload and install, open the interface, try to launch an HTTP request, in fact, is also very simple, as follows to visit Baidu as an example.
three. Configuring Local environment VariablesIn the top right corner, click-manage Environment to manage your environment. The configuration section allows you to quantify some of the frequently used values, and when it comes to variables, it's a lot easier to believe, you know. 1. Reduce duplication of operations, the same environment, the same value 10 places to use, I change the measure can be unified to get rid of 2. Environment Fast switch, different environment, debugging the same interface, only the domain name is different, switch environment variable to reach fast switch access address or other related parameters. For example, I have each environment has {{domain}} This same variable, but different environment values, I switch the environment to seamlessly switch the corresponding domain name value, this project more, more environment of the situation switch is very helpful, otherwise very annoying back and forth hand input for a while to change.
Four. Configuring Global environment VariablesThe same as the configuration of local variables, the entrance is also in the upper-right corner, the global variables in any environment can be effective, such as I configured the "01,02,03,04" four environment, the configuration of the global variables are valid, not because of the switch environment and failure.
Five. Configure Pre-request Script, TestsPre-request script supports the dynamic preparation of test data in an embedded script and the design of test cases based on business requirements. JavaScript scripts, can be scripted access, that can solve a lot of questions, you know, a lot of things can be added logic processing, such as verification, MD5 encryption.
var date = new Date ();
var create_date = date.getfullyear () + '-' + (Date.getmonth () +1) + '-' + date.getdate ();
Postman.setglobalvariable ("Create_date", create_date);
Postman.setglobalvariable ("City", "Cities");//Set global variable The value of city is "urban"
postman.setglobalvariable ("City_code", "one");
Postman.setglobalvariable ("District", "block");
Postman.setglobalvariable ("district_id", "a");
var sign =
' city= ' +postman.getglobalvariable (' city ') +
' &city_code= ' +postman.getglobalvariable (' city_ Code ') +
' &district= ' +postman.getglobalvariable (' district ') +
' &district_id= ' + Postman.getglobalvariable (' district_id ')
//postman.setglobalvariable ("sign", sign.tostring ());
Postman.setglobalvariable ("Sign", CRYPTOJS.MD5 (sign). ToString ());
Six. Test favorites and use case data sharingI have written a lot of use cases and interfaces, save him, to facilitate the use of other members of the team, or backup themselves.
Not finished ...
Reference article: http://blog.csdn.net/water_0815/article/details/53346190 This article address: http://blog.csdn.net/ty_hf/article/details/78571086