Web services supported by POSTMAN:
Type of webservices
·
SOAP
·
REST
Installation of POSTMAN
·
Install as google plug in
·
Download as application
Use below URL for sample test rest API requests : https://reqres.in/
Tips:
·
JSON beautifier is used to check the data format
·
Testing rest services using POSTMAN
POSTMAN IDE:
·
Workspace: stores all collections
·
Collections: collections of requests
·
Test suits : contains tests or test cases
HTTP request Methods
·
Create a record- POST
·
Retrieve/verify data – GET
·
Update data – PUT
·
Delete data – DELETE
URL : domain + URI (also call as endpoints)
Steps to write
test cases
·
Get the request run and manually work
·
Understand/parse the request body
·
Write test
Working with get requests steps:
·
Take sample Get request with parameters
·
Go to tests section
·
Use the existing snippet as beginner
·
Write modern code use ES6 javascript code
·
Status code, json body value check
Working with post request steps
·
Let date=date.now() console.log(date)
·
Under pre-req set the prereq actions or steps
·
Set global variables
(pm.globals.set(“currentdate”,date)
·
To use environment variable use double curly
brackets in request body ex. “currentdate”:{{currentDate}}
API Architecture
API calls Collection include mainly three things:
1.
HTTP headers
2.
HTTP Request
(POST,GET,PUT,DELETE )
3.
Status Code/ Response Code
Apart from this your application collection include many
things if it required to test in you application.
1. HTTP
headers - HTTP headers are always
depended on your application, Mainly two:
·
Authorization - A token included with requests
to identify the requester. This header has to be included in all requests other
than the login request.
·
Content-Type - A standard MIME type describes
the format of object data.Content –type in most of the requests and responses
will be application/json.
2. HTTP Request -
There are mainly four request, which we used frequently: DATA =
·
POST - Create Or Update data
·
PUT - Update data
·
GET - Retrieve data
·
DELETE – Delete data
3. Status
Code/Response Code - There are many status/response code, from them we can
verify the response.
1.
200 - OK, The request was successful.
2.
201 - Created, The request was successful and
data was created.
3.
204 - No Content, The response is empty.
4.
400 - Bad Request, The request could not be
understood or was missing required parameters.
5.
401 – Unauthorized, Authentication failed or
user does not have permissions for the requested operation.
6.
403 - Forbidden, Access denied.
7.
404 - Not Found, Data was not found.
8.
405 - Method Not Allowed, Requested method is
not supported for the specified resource.
9.
500 - Internal Server Error.
10.
503 - Service Unavailable, The service is
temporary unavailable.
Postman tips
·
Postman console for debugging- if any error
occurred during test snippets, you can verify it using postman console window
·
Postman code generator- below save button, there
is link as Code
·
To generate delay between requests- on request
> Test tab – set Timeout(()=>{},10000) (10000 means 10 sec)
·
To skip the test in postman request- Go to Test
and lets say you have 5 validation out of which need to skip one, you need to
write pm.test.skip(“Testname”,function(){pm.expect(response.origin).to.eql(100);});
·
Conditional skip – const
islocal=pm.environment.get(‘environment’)==’local’; (islocal?pm.test.skip:
pm.test(“Testname”,function(){pm.expect(response.origin).to.eql(100);});
Cheers,
TJ
Gambling and Gaming in North Kansas City, MO
ReplyDelete› › 남양주 출장안마 North Kansas City, MO Casinos. 동두천 출장안마 Gambling and Gaming in North Kansas City, Missouri. Casinos. Casinos. 1.3/2. 1.3/4. 이천 출장안마 1.2/5. 1.3/6. 1.3/7. 1.3/8. 1.3/10. 1.3/11. 대전광역 출장마사지 1.3/12. 1.3/13. 1.3/14. 1.3/15. 1.3/16. 1.3/17. 1.3/18. 1.3/19. 제천 출장안마 1.3/20. 1.3/21. 1.3/22. 1.3/21. 1.3/22. 1.3/23. 1.3/24. 1.3/25. 1.3/
joya shoes 578p4xolwh382 joyaskodanmark,joyaskonorge,joyaskorstockholm,joyacipo,zapatosjoya,joyaschoenen,scarpejoya,chaussuresjoya,joyaschuhewien,joyaschuhedeutschland joya shoes 654q7vzoxd915
ReplyDelete