diff --git a/ajax/mocking.md b/ajax/mocking.md index e69de29..b056ecf 100644 --- a/ajax/mocking.md +++ b/ajax/mocking.md @@ -0,0 +1,91 @@ +# Mocking AJAX Requests with Postman + +## Download + +Go to [the download page](https://www.getpostman.com/apps) and choose your platform. + +## Set Up + +1. Start a new collection + + ![](https://i.imgur.com/wCKq7VK.png) + +1. Give it a name and click Create + + ![](https://i.imgur.com/tg672TB.png) + +1. Close the side panel + + ![](https://i.imgur.com/GmQORB4.png) + +1. Add a request + + ![](https://i.imgur.com/boIlxGl.png) + +1. Click the arrow next to Save and choose Save As + + ![](https://i.imgur.com/KwJaQoE.png) + +1. Give it a name + + ![](https://i.imgur.com/O2kwqie.png) + +1. Choose your recently created collection + + ![](https://i.imgur.com/AoIh5No.png) + +1. Click Save + + ![](https://i.imgur.com/iGA5OXS.png) + +1. Expand your collection by clicking on it + + ![](https://i.imgur.com/prPSDsz.png) + +1. Click on Tests + + ![](https://i.imgur.com/3ItpvBp.png) + +1. There are snippets on the right with suggestions for various tests + + ![](https://i.imgur.com/GXGBVrs.png) + +1. Write a test + + ![](https://i.imgur.com/wxzWMPN.png) + +1. Run the request by clicking Send + + ![](https://i.imgur.com/ctgy0jn.png) + +1. View the response below + + ![](https://i.imgur.com/zlmYB4r.png) + +1. Click on Test Results + + ![](https://i.imgur.com/WhJCPQi.png) + +1. Check whether or not your test passed + + ![](https://i.imgur.com/oaetWbS.png) + +1. Do this for several other requests + + ![](https://i.imgur.com/ubPLxWU.png) + +1. Click Runner at the top + + ![](https://i.imgur.com/kcqrkbT.png) + +1. Click the collection you want to test + + ![](https://i.imgur.com/s8hKDg8.png) + +1. Click Run + + ![](https://i.imgur.com/COXnV7s.png) + +1. Check your results + + ![](https://i.imgur.com/okVdT5Z.png)