API Testing Using Postman | Crash Course

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
automation.com in this lecture I will show you how you can download Postman and how you can install Postman in your local system okay so first of all let me start uh with an incognitive window let me start with Google and I will search for Postman so you can see the first site postman.com just click on this and just a small information okay so earlier we also had Postman as a chrome plugin which they have deprecated now so I would also recommend you to directly start Postman as a app okay not as a Chrome extension so if you can see it's a collaboration platform for API development and you can see this option called download the app so depends on your operating system okay it will automatically detect which version or which operating system you're using format automatically detected that I'm using Windows but in case if you're working with mac and Linux you can click on the respective links and you can continue so before uh downloading this part I just want to highlight to two other section one is release node which will give you clear information about the latest development which they have done in the recent uh time okay so you can see what changes they have done in the latest version and you will get the complete history so the one which we are going to use right now is 7.21.2 okay which is this one and what kind of road map they have what kind of features you can expect in future you will get everything from their roadmap so whenever here time go please go with this it will give you a high level of picture what Postman is planning for future so let's quickly start I'm using Windows 64-bit right now so I will click on Windows 64. it will download a small exe file so I will wait for the download and once it is done I will resume the recording so this downloading is done I have copy pasted from my download directory to a new folder called Postman and let me quickly install this Postman so it will take few minutes or second depends on the machine okay and it will ask you to register so let's wait for the registration window so it will start it will take few minutes it will do some Basics checks and within a few minutes you will see a welcome window or registration window okay so guys once it is up and running you will get this kind of window so it will ask you to create account and if you don't want to create account you can see here uh you can directly sign in through your email as well so right now I have created a fresh account of fresh email accounts I will create a fresh account and I will show you how how does it work so let me create uh let me enter the email so the email which I have created one for this is New Man YouTube at the rate learn hyphenovation.com or maybe we can copy directly from here okay username I will keep Mukesh Postman password I will give some password which I can remember easily okay and I will click on I agree to terms and terms of use keep Miss and then create an account okay it says username already exists that's fine so let me give let me save this username because I have multiple username right now so let me create an account okay it will send one confirmation link so that I will be verifying it says please enter your name so I will give my name is mukeshotvani what kind of role is closest to yours I will keep as a quality engineer how do you plan to use Postman I will say pay documentation debugging monitoring automation testing designing mocking AP and finally publishing the API select everything in case if you want to put some profile picture feel free to do that let me continue and now this option is completely optional but I would recommend you to give some name so right now I'm going to set up a team name so this team name I will say learn automation YouTube team okay and safe aside I will also keep this in my document click on continue and that's what you need to do you just need to put some basic things and you're good to go now it is also asking you if you have a team if you want to invite other people from your team you can do that right now I'm not going to invite so either you can enter their email address or you can copy this link and you can share with the team members the moment they will click on this link they will be joined automatically to your team we will be discussing this this topic once we move forward for the timing I will click on maybe later because later on anyways we have to do this team collaboration part so guys this is the latest UI which you will get okay and uh let me also see if we get any emails yes so this is the email you will get from the postman once you create an account so just go ahead and validate your account okay so I will click on validating so that in future we should not get any kind of issue from The Postman and once it is done it will say thank you and now you are good to go click on head to your profile and it will redirect you to your account so again I will enter the email and the password the password which one are the one which I have created just now and let's see now you can see it is let me click on Save and yes we are done perfect okay so once you log into your dashboard okay just click on this Postman icon and you can see this is your dashboard we'll talk about this dashboard okay in detail by default you can see one workspace got created for you and you can also see some couple of other details okay these are the templates APS we'll discuss about this one by one so this is how you can download and install so in the last lecture we have downloaded and installed the postman in our local system in my in case I installed in Windows so once you open this Postman you will get this welcome window or I will say Launchpad I will quickly walk you through what exactly this will uh like how this navigation will help different kind of navigations they have and from where you have to start so first of all guys if you're completely new they will also give you a couple of you know tutorials which you can directly start and you can complete this part okay and anyways don't worry about this part because I will be showing you all these things one by one through real-time examples this is again some quick guide if you want to directly start creating a request collection environment apis everything you will get directly from this LaunchPad and if you don't want to access from Launchpad you can directly continue from here okay but this is just a quick navigations they have given so you can also see we can go with the documentation you can create mock service Mock apis and finally you can also create monitors again we will be having dedicated videos for each and everything so don't worry for the time being just see what kind of UI they have what kind of navigations they have provided so that it will be very easy for us once we start working on it and in case if you want to you know customize the dark mode you can go with the dark mode I personally prefer the light mode okay or the white mode but if in case if you like the dark mode it's up to you enable Launchpad if you don't want this launch by decent every time you can disable this by default it is enabled second you can see uh you can join a team workspace right now there's no team workspace we have created so right now it's blank it says no workspace to join once you move forward we'll create a team and we'll see couple of members how we can join a team and how we can collaborate now this is very interesting guys you can see if you want some you know templates and some public apis which you want to use for your testing purposes they have given a lot of apis and the one which is happening or which is trending right now is covid-19 apis so if if you click on this code 19 apis you'll get two apis which will give you General data or Global statistics which you can hit and you will get the data apart from that you can also get the statistics based on the countries and the different parameters which you can pass okay so these are couple of apis which they have provided in case if you want and you can also see these apis and you can also click on browse more and you will get different categories of apis which you can use so it's up to you in case if you want to export this part it's up to you and completely optional for this complete tutorials I will be taking couple of apis which will help you to you know cover most of the things from the postman side so this is all about the launch pad I am going to close this Launchpad as of now and you can see now we have the two uh this is called the Builder section guys okay and you can see here I have one personal which is nothing but the workspace and another option is team so we'll talk about this Builder part and this collaboration with the teams you can also invite the team members for the collaboration now on the left hand side you can see the history right now we have not made any API calls it's blank the moment you start making some VPS call you will see the history here collections collection is nothing but you will be creating a small group of the similar or the uh I will say they will share the common nature okay so you will group them into a collection that collection will be easy to access and we can run everything as a part of collection we have a dedicated lecture on collection as well so we'll talk about this in detail so collection is kind of a folder in simple words okay but it allow more features like you can share the collection you can pass the variables you can share the collection execute them so many things we'll see one by one and right now there's no apis since we have not created any apis it's totally blank but you can click on create an API and you can continue okay so this was about the left hand side again this basic filters part okay so depends on a keyword it will do the filtration now in case if you have any existing uh collection okay let's say somebody has created that collection you want to import you can import The Collection you can also import the open APA files and other things this is the runner part when you have a set of Collections and you want to run the collections you can use the postman Runner to run the collections and these are just some quick navigations if you want to open a new tab new Runner window personal window and if you click on this new part this is what we have seen in the launch pad do you want to create a new request new collection environment documentation mock server Monitor and apis so instead of going through Launchpad if you directly want to start this from a new button these are the options available very important environment okay so right now there's no environment has set so what is environment how to set the environments we will discuss one by one for the time being let's focus on the navigation this is the quick look of the environment and this is your settings part where you can manage the different environment and the variables okay so that's all about the quick look and feel and Quick Navigation about the postman now in the next videos we'll see one by one how to work with individual request collection API smoke servers documentation and before we end the session I just want to show you this uh find section okay so in case if you want to find anything related to the response and uh you know request collections environment you can find directly from here and you can also see a small Postman console where you will see all the logs right now everything is blank because we have not started anything and these are couple of other settings so if you see this part this is single pan two pan and these are just the keyboard shortcuts we will be using them whenever it's required I hope you are familiar now in case if you have any question related to this UI feel free feel free to ask in the comment section so guys in the previous lectures we have installed the postman we have seen uh the quick UI and the starter guide how Postman works okay now let me create the first uh API call okay and then we'll see the different parameters how Postman works so right now I have taken just a very busy example which everybody can relate if you are able to understand this examples then we'll take some apis and I will show you how it works okay so first of all I'm going to make a new request so just click on this a small Arrow option and click on your request so this request name I will just write as search Google okay and if you scroll down I am going to create a collection now what is correction in simple words it's kind of uh you know folded in simple words which will group your multiple request into a single place it but it is more than a folder we will be talking about collection detail but for the for the timing just com collection is a combination of multiple requests of similar type of multiple types so I will say let's say Google apis click on this check box or the icon and click on save to Google apis so you can see the moment you click on collection this was the collection that we created the moment you click on this this was the request that we created now uh I will keep actually you can see this guys right to pan view so right now if I click on two pen view you will get this kind of view where you see the first half or the first part will be related to request and the second part will be related to response but if you click on this panel you will get left hand side as a request right hand side as a response so I will go with the first one which is uh convenient for me now you can see you can trigger multiple kind of requests but for this example I am taking only the get request and you just need to provide the EPA endpoint so let's say if I want to hit this API this is actually URL but internally this is also making a API call right so just enter google.com and click on send button you can see it is sending the request and it is giving you the response now so if you see guys this response first of all the status code is 200 okay it means the request that we have made the response is coming 200 okay means everything is fine time it is taking 661 millisecond total sizes 14.81 KB and if you want to save the response we can save and if you see the cookies these are the cookies coming from Google and these are the headers which is coming okay which includes the date expires content type server cookies and other details for the time being just navigate through these these sections how to use them we will see once we move forward so this is the response which is coming from the server side which includes status time size headers and the cookies okay along with the body now if you see the body guys it's coming in a in a different format it's actually HTML file right so if you click on preview you can see it's coming in a HTML format our main intention is not to test the web applications our main intention is to test the apis but just to create our first get request I have shown in this example so that you can relate okay so this was on the response side now if you see from the request site we have not sent any parameters alteration is blank now if you click on headers part you can see it is actually sending seven hidden headers the moment you click on hidden these are the hidden headers which is sent from the client so it is actually sending the cookies Postman token host user agent encoding and the connection part again you don't need to you know understand each and every header once you move forward I will show you which headers are important for you and what are the basic headers you need to send along with your request apart from that we don't have anything else since it's a get call we have not sent anything as part of body no pre-request script no test and no additional settings fine so as you can see right now we are able to make a basic call we are able to get the response it means everything is fine now we can continue with our other test scenarios correct now before we end this video I also want to highlight one important part called params which is nothing but parameters and you can see it's a query parameter so what is query parameter guys the moment you type anything let's say I want to type learn automation okay so this is nothing but I am sending a small query so if you just notice here it is sending actually a a query parameter which is q and it is also sending uh the keyword along with it so if you want to make the same thing here I can just make a queue queue is nothing but query and value let's say I want to search for mukeshotwani can you see it is automatically appending to the URL it means whatever query I will be sending along with parameters okay will it will be appended to the URL so apart from this if you want to send any other query parameter let's say I want to search for name and this name let's say I want to search for automation and you just click on this check box so you can see this is getting appended along with the URL so it doesn't matter how many key value pairs you have whatever key values key value pair you will add it will get appended to your URL and it will be sending as a request so right now you can see I'm able to see this one by one but let's say you have 10 parameters okay 10 query parameters that you want to send so it will be little tough for you to add one by one H and everything so also they have given one uh you know option to bulk edit you just need to give in the new line key and value okay so let's say I want to give my address as let's say Bangalore then next thing which I want to add is like my skills I'm just giving some random key value pair guys let's say selenium as you can see it is getting appended to my URL and that will be sending uh as a request so this bulk edit feature you can use and if you just go back to the old editor it will be adding as a query parameters so as of now these just are dummy key value pair so I will remove them only I will be sending this one which is actual query parameter now let me click on send request again and you can see when I click on preview it is showing okay short one is that means this API is working so guys this is just a normal web call I have made actually AP call will see in the next video this was just a quick video just to show you how exactly this request works in the next video we'll take some rest apis and we will see how to validate them guys in the previous lecture we have seen how to make a first get request and we have seen how we can get the response and how we can see the responses and validate right now we also have to see how it works with other different kind of requests let's say if I want to deal with post put delete patch then how does it work so till now we have seen only the get request right and now if you see we have multiple kind of requests but trust me guys we don't need everything the first five is the main one okay so which includes get post put patch and delete these are the five request that we are going to you know use 99 and remaining we will be using depends on the requirements so we will be focusing on the first five okay post put patch and delete so ah before we jump into the post let's also see a couple of online um rest apis which you can use again all these apis which you will find they will not persist your data so you will you can instantly make uh you know few changes but these changes will not be permanent so you can go ahead with the rest uh gorus.co.n and here you can see they have a couple of apis which you can use and you can also use this toplight.io you can also use this dummy.rest API example.com where they have multiple apis and they also have get post put and delete and the one which I'm going to use uh this one I personally use it for the demo purposes because it includes everything get post put patch and delete again whatever changes we will be making these will not be permanent this is just for the demo purpose but once you've started working with the real-time applications these changes will be stored in your server okay so if you make a post call and if you're creating some resources these resources will be permanent to the resource or the server which you're using okay so before we jump into the post let me quickly check how does it work with get so I will be using this rest request rest dot in so short Is req Res dot in so this will be the base URL okay and now you can see the end point so the end point for this particular user let's say first we'll call uh all users so this will be the end point so when I click on send request you can see we are sending one more key as a parameter that maximum two pages so page is just one of the key value we are sending so it is uh actually giving us the second page not the first two bit only the second page information it is giving so let's change it to 1 and let's see how it behaves if I say I want the first page so you can see it got updated here let me click on send and we got the first page data perfect and the rest everything is same that we discussed earlier that status time size and everything now let's talk about the post so when we talk about post we also have to send the payload right so this is the end point that we have to make and uh before we create a second post call let me save this the moment I save this it will ask me what is the request name I will say get user because this API is just giving me number of users right and now it is asking me which collection you want to use I will create a separate collection for this so I will click on create collection and the collection name I will give as a user apis fine click on this icon and save to user apis if you see here this API is here now let me create another request I can click on this plus icon or I can click on this new request and this request name I will say post call I will say create user again I will be adding this into the same collection which is user API and if you want to create subfolders you can do that I'm not creating as of now let me put in the base folder so now you can see it is create user but this is not a get call this is going to be post call so I will save this the moment you save you can see it got updated here second thing uh again I need to make this as a base URL and this will be our endpoint so I will just copy this end point which is API user fine the moment is a post call definitely you have to send some payload that payload that we have to send here is let's click on create this is the payload so this payload is actually a Json payload guys okay the moment you click on body you can see which kind of body you want to send view so as you can see we have different kind of body that we can send so as of now it is set to none so if you want to send the Json payload you can click on as of now raw and you can simply paste the payload or provide the payload that you have okay and right now you can see it is taking as a text you can change this as a Json because it's a Json data the moment you click on Json you can see one option called beautify so in case it is not properly formatted it will format now I can give any name let's say I want to provide name as a Mukesh and job I will give as an automation engineer okay now you can click on send and you will see I will get the response so name is same job is automation ID it is 976 and you can see it created at this time interval 201 so 201 will mainly come when you create a new resource okay on the server so whenever you make a post call it will always create a new resource and the response should be 201 okay time to 66 millisecond size is 527 byte and you can see how easy it is to make a post call through Postman it is just you need to provide the body right now this API does not include any authorization so I'm not sending any authorization not even additional headers because these headers are set by Postman but once we get some post request okay where we have to send some kind of additional header authorization parameters we can do that through these options as of now only body was mandatory that we have passed and now we can see our API is working fine okay so the moment you can see the small icon right small right uh I guess it's orange color icon the moment I save this that icon will go it means now this request is saved so this is just one collection where we have two apis okay so once we move forward I will show you these options one one by ones once we have at least four or five requests in this collection then we'll talk about how to deal with collections mock uh share this collection run this collection so I will again close everything and in the next video we'll talk about a different request like patch put delete guys this is going to be very quick video because in this video I will show you how you can make a delete request so in the last videos we have seen how to make a get request and we have seen how to just send a get request and how to capture the responses then we discussed about the post request where we created a user and we have also sent a small body right now we're just going to make a another request this request will be delete request so again I will be selecting this particular collection and I will click on new request and this request I will give as delete delete user and I will be selecting a user API click on safety user API now if you go back here so if you can see this is the delete uh request that we have to make so the final end point will be API user 2 so second user we are going to delete and the expected response is two not four okay so again I will be going back to postman and I will be just selecting from here to delete base URL will be this and the final end point will be okay so you can see we have one additional forward slash that I will remove from here and that's all we need to do so just click on send and you will see if you are getting 2.4 it means that particular resource has been deleted okay so again if you make multiple requests because this particular API that we're using that will not purchase the data so you can make multiple calls it will not actually delete from the server but it is giving you what kind of response you can get very quick video just select on get post to delete and you can delete any resources okay so right now we don't have any additional parameter in case if you have to pass any additional parameters for deleting that resource you can pass directly from the query parameters and you can also and in the body section so as of now we don't have any uh you know body that we need to send along with the delete request but guys the next example that I will be taking there we need to also send the body along with the request okay that is the reason I have selected this topic that I will show you the two scenarios how to send a delete request without body and how to send a delete request with body today in this video we are mainly going to talk about collection in detail so again collection is a very vast topic so I will be making different videos on collection topic so today in this video mainly I will talk about what exactly is collection why do we need why do we need it and how we can create collection and how we can execute the collection okay so in simple words what exactly is collection collection is nothing but a group of requests okay that is grouped into a folder so in simple words if I take one basic basic example let's say you have multiple files of different kind okay let's say a text file your MP3 files you have MP4 files so if you want to group them into a similar type you will create a folders right you will create a text file folder songs folder movies folder videos folder and you will group them accordingly same thing goes with Postman in collection so we'll be creating a different group and each group will be having a different type of request so we can create a collection we can share the collection with the other team members and we can execute collection okay uh so let's say if your collection having multiple requests you can directly execute as part of collection you can assign the roles you can also create the documentation you can create the mock servers monitors Etc since it's a very big topic and collection is the most important part in Postman I will be making different videos on collection in this video we'll focus on the basic features of collection so let me go back to the postman and I will show you how you can create a collection okay so this is the previously uh we created different videos how to make a get request post request and delete request right so if I want to run them I can go ahead and I can run them one by one right so I can execute this request individually and I can make or I can call this request indicily and similarly I can also call this request individually right but what if I want to run them in a single go let's say I want to run all together into a single call how can I run them this can be done with the help of collection okay so how do you create a collection so if you see right now we have this new Option the moment you click on new you can see one option called collection so it says you can save your request into collection for reuse and sharing and if you don't want to create from here you can also see one option here called create collection or new collection so when you click on this you will get this window so you can go with any of the approach it's totally up to you so let me show you one by one so let me start with this approach I will create one collection and this collection name I will give my collection okay and you can see at the collection level you can set the description you can set the authorization okay and for the authorization again we have different types so once you move forward we'll talk about the different authorizations we have you can also give a pre-request script you can also write the test at the collection level and definitely you can also deal with the variables part right since these are the different topics altogether this will be focusing on this different tabs into different video so for the timing I will give a small description to this collection that uh this collection will run all smoke apis I'm just giving a random description and I will click on create so you can see the moment I create a collection this particular option is coming where I can run this particular collection okay I can share this collection and I can also do other options as well right I can create monitors I can create mock servers and I can I can also see the change log right now it's completely blank because we have not done anything on this collection so as you can see writer's collection is empty so we can add request so if you have any existing requests then you can drag and drop for the time being let's say if I create one first request I can click on my collection and you can see this particular request has been added to my collection okay and in case if I want to make any other you know request I can go ahead and create one more request and I will say this is second request I can add to my collection this I will let's say keypad post and similarly I can go ahead and create again on your request and let's say this is third request okay I can set the description right now I'm not setting any description and I can directly save it and this I will make it as delete okay the moment I save this okay sorry let me put this as a post let me save this you can say post has been updated third request I will make as a delete request and Ctrl s so right now I can see I have three requests right so this is how I can add multiple requests to my collection and if you have gone through my previous videos we have created these right so instead of using this fake or dummy uh request I can go ahead and I can use them so what I will do I will simply delete the one which we created so that I can show you the real-time examples so I will delete the dummy one which we created okay and the one previously which we have created I can simply drag and drop okay so let's say I want this one to be part of this collection I can drop it here this is one and this is two and this is three perfect so this collection I can delete I don't need so I can go ahead and delete this yes you can see I have deleted so this is the collection that we created now we have the actual API so this is actually a calling uh uh API which will simply get me the user details this is going to create a user this is going to delete a user perfect now let me show you the different features of collection first of all you can make this as a favorite so that it will be always on top so you can quickly navigate to your favorite other mostly used collections second thing if you see we can share this collection we can assign the different roles we can rename we can edit this and you can see we can also play with the kit and GitHub so you can see we can create a fork request pull request and more changes and these things are the additional things like we can create a duplicate of this collection we can export this we can monitor the collection mock service publish documentation Etc don't worry we will be discussing about each and everything in the separate videos as of now let me run this as a collection so you can see one option called run option here the moment you click here this window will open and you can see uh different options there right let me simply run this so you can see you will get a separate window this window known as collection Runner so if you have worked with any kind of automation tool earlier right then we have you know test Suite where you can run all these uh test script into a single test suite and you can run so it is kind of same thing here in Postman it's a collection Runner which will run all your requests right now uh okay right now I have already one environment but when you do first time for you it will be no environment we will be talking about environment in the next video as you can see we have three requests iteration means how many times you want to run them as of now I will keep only the default values right now okay and I will say run my collection the moment I run my collection so you can see it is running all these requests that we have created right so it is giving me 200 2.1 and 2.4 and this is time taken and this is the length right or I will say the size so with the help of single click it is able to run my all three request right now it is you know very small collection we have only three requests but consider you have multiple requests let's say 1500 and 200 requests and if you want to run them collection can save a lot of time you can run them with different environments right and you can do with multiple iteration data and so many other things [Music] so you can see again we have a retry option simply says when you click on read write it will rerun my complete collection and it will execute everything again okay you can export the result right now it will export the result into a Json file so let me show you let me export this result let me keep on desktop okay and you can say saved test run to disk let me go back and open this the moment I open this you can see we have the collection details so collection ID collection name time stamp okay different environment IDs total number of pass and fail and the complete result okay so we'll be talking about this again but right now if you come back here you will notice one small thing okay which is not an ideal case as you can see we have executed three requests but still it is showing zero pass and zero feed and the reason is we have not added any test in our any of the request right we simply executed them so let me close this as of now and let me go back to my collection as you can see all the tests that we have written or all the requests which we have created so far it has zero test this request also having the zero test and finally this one as well so it is just a multiple request but we have not added any test so how to create a test case enforcement that is also our next topic right that is the reason we are getting 0 pass in zero field but once you start adding the test it will show the number of count which got added now apart from this if you want to again create further groups right you can also create a folders here so you can see we have an option called add folder the second folder I want to create three folders smoke and I will create let's say one more called regression okay and again I can drag and drop them so I want the first test has to be smoke scenario and the rest two scenarios I want to keep under Recreation so you can see now we have one collection inside collection we have different folders now if you again go ahead and try to run them let's run them [Music] okay this will take few seconds and yes we have now again different categories right and this is how it is now one important thing let's say if you want to change the order you can change them okay let's say you want to execute delete first you can rearrange them based on a requirement because by default trust Runner or I will say the collection Runner will run them in a same order which is coming here okay so right now I don't want to disturb the order otherwise I can change it and I can play with the order part so right now it's get post and delete and if you want to create dependency let's say first delete should run then post and then get so Haven can create the dependencies we will see okay so that's all about uh collection creation adding folders arranging them and run them in the next videos we'll talk about more in collection Runner and it's very interesting and very useful guys okay because once you move forward you also have to run this collection runner from the command prompt or I will say from the Jenkins so this is going to be very helpful today in this lecture I will show you how you can import the collection and how you can export the collection Import and Export is the very basic feature that you need in each and every test automation tool okay so let's say I have a big collection so let's say I have created 500 or let's say let's keep it number less let's say 50 scenarios or the 50 requests that I have automated now now I want to share this collection with you so that you can also import this collection and you can run it right so I can export this connection from my nna you can import it or I can do the vice versa right so import export is the very basic feature that is needed for each and every automation tool same thing we are going to do with the postman as well so in the postman in the previous lectures we have created a collection already right so now let's say I want to export this collection so I can right click here and you can see we have an option called export okay sharing is different guys export is different so we'll talk about the difference between share and the export so an export this collection it will ask me to export so right now uh we are using version 2.1 which is recommended so what it will do it will export the complete collection as a Json file okay you can see here so let's do one thing let's quickly export this and now it will ask you where do you want to export it so in the desktop I have one folder called Postman data so I'm just going to export in that particular directory so click on Save I already have existing so I will quickly replace with that and you can see my collection exported successfully now let me delete it so right now I don't have multiple systems so let's assume this is a different system and now somebody has already given me a collection now I just want to import that collection so that I can that will start working or I can directly start executing right so in that case I will click on this import option and you can see we have different options to import a collection again so right now we are focusing only on the first option which is import a file so either you can drag and drop or you can click on choose file and it will ask you from where you want to export The Collection so right now I'm going to use the same collection that we exported just now and you can see it got imported and same collection I got in my workspace again I can click on favorite so it will be always here right yeah so you can export The Collection import The Collection now what about the Running part see guys running again you can click on run and it will start test Runner and you can continue so let me also show you one interesting feature called view in web the moment you click on view and web it will automatically start a chrome session if it is not already open if it is not logged into your account it will ask you to login so since I'm already logged in in my Postman dashboard so it is directly jumping into my collection and you can see the similar structure it is able to find here it has created uh two folders in each folder I have my request let's say I want to see the first request so right now it is a get request and this is the request name right now no description set and only we are focusing only the first page so based on the parameters it will identify right now we have only one parameters it is taking param as one and you can see similarly this is our post request okay and uh here this is the body that we are sending same goes with the delete user so you can view the complete collection on the dashboard okay so if you have not created any account I would recommend you to create account and Link with the postman so the moment you click on web it will redirect you so the good thing about uh Postman dashboard here you can also see the monitors that we have okay right now we don't have but once we create monitors everything will be coming here and you will also see the change log okay uh what is going on with your Postman workspace everything will be listed down here okay the moment I click on load more if I have any other further activity it will list down here okay so that is just one part of web but we can do many things from the postman dashboard so once you move forward you will get to know more information about the postman dashboard okay that's a very quick feature about Import and Export uh so once you get your Postman collection exported you can directly run from the command prompt you know so if I show you that collection Runner so you will see one option here called run in command line can you see this so in order to run this collection from command prompt off I will say command line you just need to install a new you know package called Newman with the help of this Newman you can directly execute your test from the command prompt as well okay so this is the official Link in case you want to explore right now go ahead and explore anyways I will be covering this in the next video now another very interesting fact which I want to share about the postman is okay so in order to Showcase this what I will do let me delete or close this collection Runner uh click on file click on new Postman window I just want to show you very interesting part here yes so it opened a new window and you can see we have couple of templates given here right so what if I want to take this particular template or I will say this collection so you can see we have covid-19 apis given over here so the moment I click it so this is one complete collection okay so this collection they have already published so the moment you click on this run and Postman this collection will be added in your Postman okay so you can also see the documentation other things as well for the timing I will click on run and Postman and you will see this collection covid-19 tracker has been imported and this is the tracker so this uh particular collection have two apis one is general and one is country based so let's say if I again click on this favorite and you can see this is the API which is calling and it will give you the complete you know statistics of this covert 19. so let me just hit the send button and let's see what exactly it is giving and you can see we have a huge list right so total number of cases recovery cases death cases last update currently infected and so many other things and we have the success that means this API is working fine right now let me also run another API here I'm just looking for Country based okay so we need to just pass one parameter if you're looking for a specific country you can give this as a parameter and it will simply search for that so again if I simply click on send okay just a second it is still giving the complete details so let me uh take one country okay so right now it is taking all the countries okay so let me search for a specific entry so in that case what I will do is first of all I will go ahead and see I can see for Russia we have we have for Spain we have for Italy so let me search for USA okay like uh I just need all the information about the USA so as of now I can see we have a Country USA total cases and you can see we have country abbreviation as well so you can use uh either the full name or the abbreviation so if you come down here these are the already key value payoffs they have given so if you want to use any specific key you can do that so for the driving let's say I want to use this key and here I can give a USA okay and let me click on send button so you can see now it is not giving back all the countries information now it is only giving the total number of rows which is right now only one so it is giving me details only about the USA right now so total number of cases is 14 lakh 32 086 total new cases death new death in all the details okay so this is how you can import collection if it is not in a Json file uh you know format if it is into some a button format so I will also show you how you can generate a button uh that I will show you now it's just two click and you can also create this kind of collection where people can directly go ahead and import it okay but that's very interesting feature so if I want to show you how you can you know export your collection as well so that it should come as a button in that case click on this option or if you don't want you can directly go ahead and uh click on share collection okay you can see one option called get public link but here you can see this button right so you can also share this collection as a button so in that case you just click on generate code you will get this code and this code you can embed in your blog or in your website so your collection will come in this format okay run in Postman okay so if time permits maybe I will show you this part I will add this button in my blog so that you can directly give a try but mostly we deal with you know public link or the Json file okay but there are multiple ways it's up to you how do you want to use this collection okay so guys in this video we are mainly going to talk about how we can add the test in our request in Postman okay so till now we discussed about how to create requests how to create collection how to execute them but till now we have not seen how to add the test so what exactly is testing Postman so when you work with different automation tool right so we have to add test or we need to put some kind of assertion so that we can validate our functionalities working as expected or not so same thing goes in Postman as well so mainly we're going to add this test which is nothing but a small JavaScript code that will validate whether our API is working is expected or not okay so one request can have multiple validation so it is not only one validation we can have one request can have multiple validations like you can put like Response Code the data the time and it can be a number of things to one request okay so by default and Postman we need to write all the test or I will see the small snippet in JavaScript okay so by default uh Postman already have given uh frequently you snippet but if you want to write your own JavaScript as well you can add that and very good part about Postman it's not only the request level you can add the test you can also add the test at the collection level and the folder level as well so we'll see one by one so at this example or in this video we will be adding the test at the request level okay in order to Showcase that I will go back to postman and I will show you this collection so this is the collection that we have right so right now if you see all the requests have this test and right now it's blank so if you come down here and see but before we move to this there's also one more section called pre-request Script okay so this is totally different okay this is the test that will be executed after your request but before your request if you want to make certain you know calls or if you want to do any activity you can do under pre-request script we'll focus more about this in the next video right now we are focusing on you in the test section so these are the frequently used Snippets they have already provided so you can use that so let me show you a few snippet and once we move forward we will also deal about the environment variable Global variables and so on so if we come down here the basic um test that we need to add in each and every page the status quo right that is the first validation that we need to keep that whether our EPS is working fine or not right so if you see here we have a status code is 200 they have already given a snippet the moment you click on code snippet this will come down and now you can simply make a send request the moment you click on send you can see a test result has been added now earlier it was blank now if you click here you can see status is passed and this is the test description that we have added so how it is coming and what exactly is this PM dot tells what is this PM dot response let me show you so if you come down to their official documentation they have mentioned here that you can use pm.response object to collect all the information from the response right PM dot response here PM means Postman so you will see pm.test pm.response everywhere so PM dot response will have the complete information about the response and based on your requirement you can play with the other attributes okay and you can Define your test using pm.test function with a proper name okay so this is a function and this is the name so you can change this right now it is status code is 200. I can change it like verify status code should be 200 okay now when I send this request talking and this time you can see it has been changed earlier it was the default one now I have added it stress code should be 200 so this is the positive scenario what if I change this to let's say 4.4 but ideally uh the actual is 200 so definitely it should fail the moment I click on send and you can see it failed and now it is giving you a certain error that expected Response Code was 404 but we got 200 right as you can see here so definitely it should fail and it got failed so this is how this test works so this is the basic test that you need to add in each and every I would say request that you're making but let me also show you a couple of other snippet that you have to use frequently along with your uh you know status quo so if you come down here you can see another method or another code snippet uh the response time sometimes we need to also validate that response time should not be more than one minute or one second or it can be 500 millisecond right so here you can see again they have used the same thing only thing they have changed is the response time so PM dot response is same okay you can see here right now they are also capturing the response time and we are also checking it should be below 200 okay if it is above 200 it will fail so let me run this and it got passed again okay so you can see it is uh less than 200 millisecond it is passed what if I make it let's say one millisecond will it work or not let's see okay and you can see it failed and that is how somewhat this value is not you know realistic because we are expecting the APA response within one millisecond which is impossible right so it is taking actually 66 millisecond so what we are doing now we are actually giving one which is not realistic value so let me put minimum 200 and it should pass now you must be wondering what is PM dot expect right because we saw what is PM dot response we are able to see here also but what is this PM dot expect okay so if you come down here you can see Postman guys have mentioned you can also use chai JavaScript 3D syntax okay in your assertion so PM dot expect which we are using it is actually coming from chai okay so chai is a session library for JavaScript and you can use this in Postman as well okay so they have a couple of chain that you can use and these are the frequently used examples okay so uh we are using the same here now let me also show you uh another snippet which is very frequently used which is we need to capture the Json okay and also we need to verify okay so now in order to Showcase this let me show you the response first of all which we are getting from this API so this API which I'm hitting right I'm actually capturing a user detail and I'm getting all this user details so I'm getting this ID I'm getting email first name last name and if you see here I'm actually using a dummy Json so let me copy paste this and let me show you one interesting thing uh just a second I will say Json evaluator or looking for Json paper Okay so I will put my Json here and the moment I click on viewer so you can see right now I have a complete Json and you can see within the data I have the data right I have five records as of now so this is a data and within this data I have file nested arrays right I have one record second third and so on similarly I also have another record so let's see if I want to validate within the data okay and the first array email should be Jaws dot some add thread some domain dot in I want to weld it or let's say I want to weld it the first name should be George or the last name should be this so in that case if I want to write the expression how can I do that so let me go back to this okay and you can see what it is doing it is actually capturing the response in a Json format it is storing in a variable called Json data okay now what we are checking we are saying within this see the value and that should be 100 right so if I come down here and if I try to see if I want to verify the total should be 12. let's say total pages should be 2. so if I just write Json data dot uh total underscore pages total underscore Pages it should be equal to 2. okay and the test name I will write total number of pages okay now let me run this and you can see all the tests got passed because now we are able to see total number of pages is 2. perfect if I go with other options like say per page I will get the value but what if I need to go inside this data and then I have to go inside this arrays right so in that case first of all I have to restill data right so in that case I will just copy paste the same function and I will copy paste here and I will just say verify email just as some random name I'm giving so instead of going to Total Pages first of all I have to go till data so I will write data right now within the data I have to navigate to the first array which is 0. so I will say bracket zero now within this data or 0 I have to validate the first name first name first underscore name fine and it should be equal to George so I will just copy [Music] yeah I will hit the request again and you can see we got total four result and it is working as expected right so many things we can do at this level guys I'm just showing you a couple of things we have so many test snippet here and if you want to explore more about the different test script they have you just click on this icon called learn about uh test script it will open the complete documentation in a new window and you can see number of examples they are given okay so I would highly recommend you to watch and check their official documentation they have written you know in detail each and everything and apart from this let me also add one one test in each and every request and I will show you in the test Runner okay so I will put the basic one test status code so here we are expecting yeah two not once I will make it two not one here because it's a post call it will make a request every time to the server so it should be two not one same thing I will do for delete user for delete user right now this user when we delete right it is giving two not four right now this user does not exist so it says two not four okay so I can add a content or snippet here call do not fold so we are expecting two not four okay let's fail once test at least right so that will see the pass and fail both yeah so this is what we have done let me close everything close all the tab it is this particular request was never saved so click on Save changes now let's run this collection and this time since we have added test for each and every request you will see the test result will not be blank so just come down here and click run my collection and here we go so total number of test is six five past of unfailed so the first one is already four past second request has only one validation which is also passed this one got failed and we are getting proper message right so that is the power of test so right now we are adding test only at you know the request level but you can also add the test at collection level as well just keep this point in mind we will be adding test at collection level as well I hope you like this video uh so I will be sharing these links in the description directly if you want to navigate if you want to see feel free to navigate to this documentation and apart from this if you want to write your own conditions as well yes you can do that you can play with the JavaScript and yeah you can play with the JavaScript and you can add n number of tests and you can pass the data between different requests as well okay today in this tutorial I will be talking about what is environment and how we can use this environment in our Postman okay so let's get started with what exactly we are going to cover in this video so this is one of the most important topic in Postman okay an environment is the basic thing that you should know in order to continue with your Postman okay so we'll talk about what exactly is environment in Postman why we need it actually why we are doing all this and finally how we can use this environment variables in Postman okay so as the name suggests environment so we'll talk about environment in real time but for the time being technical definition is it's just a key value pair or I will say set of variables that we are going to use for our request okay so let's say we are working multiple requests in each and every request we are using the base URL right so now during this environment or in this environment we can set couple of key value pairs that we can use okay so we can also have multiple environment depends on our requirement so let's say I have three different environments so let's say developer or Dev QA in prod okay so I can have multiple environments and I can have multiple key Value Place in each environment and I can use it so when you talk about what is the need of it so let's take very basic example that uh let me show you this post line so we created this particular collection right in our previous tutorials so in each request if you notice this is my get request this is my post request and this is my delete request and guys if you are completely new to this channel if you haven't followed this series then we have already discussed about this so I will just use the same for the references in case if you are new please go ahead and watch my previous videos as well so if you've seen the get user I have this particular base URL right now if I just open this create user still have the same and I also have the same URL for delete user so let's assume this URL is getting changed now right so what I have to do I have to update each and every request so I have to update three requests now so right now it's only three so I can easily go ahead and update but what if I have 50 what if I have 100 request what if I have 250 request and if my base URL is getting changed I have to update each and every request that will be a very tedious task and it is not a best practice to go ahead and modify these URLs or these base URL manually right we need some kind of mechanism where if something getting changed let's say base URL I will simply go ahead and update at one place and it should be reflected in each and every request this is what we will be doing now so in this case let's say if I have I'm a developer let's say I have created let's say 50 request or let's say 10 request for the time being I've created a collection I have used environment and I have only given my URL base URL and remaining endpoints are same so when I have to run the same apis in a broad environment right then definitely I will be having a different system URL or the different base URL in that case what I will do I will simply change the environment environment will be you know a shared between all the requests so with one environment change all the requires get will get updated in simple words okay so let me show you this part so come back to the post pin and as of now on the right hand side you can see I have no environment okay so before we move ahead let me show you the official documentation as well so this is the official documentation just go back to Learning Center of Postman and you will read everything about the postman environment okay so basic usage the main usage is when you have different kind of you know environment let's say production development and QA environment you just need to maintain the standard you know set of key value pairs in the environment so that in case in which you are changing from you know one environment to another environment you don't need to change all the requests just go go back to environments make certain changes and it will be reflected in all the requests that you are making okay so let me show you how step by step so first of all you can see I have no environment because this is fresh workspace so I have not created any environment as of now and you can see a small gear icon where I can manage all the environment and you can also see a quick click the moment I click here you can see I have two things first of all I have the environment variables second thing I have the global variables so now they both are actually nothing but a key or set of variables if you see environment is also set of variables Global variables also set of variables but what is the difference we'll see in the next video but as of now we are focusing only on the collection sorry we are focusing only on the environment part so I can edit the environment from here but as of now we don't have any environment okay so let's focus on the first environment in the next video we'll talk about the global variables very interesting concept but with a minor difference so let's click on this gear icon and you can see here I can create environment and I can create Global variables as well so let's click on add in case if you have any you know environment already then you can directly import right now we don't have any environment as such so I'm going to click on ADD and you can see now I have environment name so let me give a QA and this QA environment I will put a variable call let's say base URL this is what we are going to do or let's keep a URL directly okay so this URL variable I will be using within my request now you will see two options here one is called initial value and an is another called current value so there's a small change the current value if you see this will be used and it will never be synced with your you know Postman servers and this initial value this will actually will be shared within your team okay in case if you're working with the team so right now we are not having any team as such in this series right now once we move forward I will tell you the difference so just make sure you use initial values when you when these values are shared within your team so as of now we don't have any team so I will put this current URL so just let me copy the current URL okay so this is what I want to make a common between all the requests right because if you see the end point is different for this end point is API user page one for create user I have a different endpoint and delete user you can see have a different endpoint but one thing which is common between all the requests is the URL right so I'm going to create a environment same thing QA I will put a URL and I will put the current value so when you put current value automatically this value will be copied to initial value in case if you don't want to maintain it you can just keep only current value this you can keep as blank automatically it will be considered just click on ADD so you can see right now I have QA environment and you can also see I can you know download this environment I can create copy and I can share this environment as well okay so now let's say I want to create one more environment so one option which we discussed just now I can go ahead and create a new environment or I can just create a copy of this you can see q a copy I will go ahead and click on this I will make this as a product okay and here you can see the values are gone when we are copying so let me put some different URL and I will put some prod definitely this is not the valid values just to show you this I am making these changes so that you can understand the difference when I will switch environments okay so I will simply update so now I have two environments and now let me show you how to use it so first of all select the particular request and now you just go ahead and you will see the environments that we have created let me select the queue environment because here we have the valid URL now this value we have already mentioned in our environment right so I will just remove this part and I will say curly braces okay two times I will just use the variables which I have used URL and close so you can see it is highlighted when I put Mouse over so this is the good thing about Postman it will show you the current value initial value we have not given its blank current value and what is the scope so as of now this variable having the scope till environment but once we talk about the global variables you will see this scope will change as of now we have only one scope that is environment but once you talk about global variables you will see the scope value will change for the time being just stick to environment so what I will do I will go ahead and make these changes in all the request okay so curly process URL and you can see it's updated perfect now let me also change here so just delete till here again use the same variable fine now let's make a request just to see and you can see we are actually getting the value so if you see this test result this was so this actually is failing because of the response time okay so what I can do I can make it 500. now if you just hit this request you can see we got the four test results or our past and these values are getting updated perfect now let me do a small you know change what if I put URL one okay so what you can see first of all it is trying to understand what is this URL one so when it is not able to understand it will show you that this variable is not defined in the active collection environment of global so it is actually searching in collection first of all then environment and last at global so we'll talk about the scope so it is actually trying to search in all the Scopes okay so in case it is coming in red color then it means it's not valid if it is coming into you know Green it means it's a valid variable and now you can see e-min environment clear now let me do one thing let me change it to product so now if you just see can you see the updated value it's prod 1 sorry request prod dot in and all the requests that we have updated you will see the updated values right so this is the must feature that you should have so definitely you need to have environments otherwise you know maintenance of the request would be very tough even a small changes in the base URL can create a lot of Maintenance you need to go and update but that is the power of environment just change this which environment you want and maintain your you know key value Pairs and it will be updated and in case if you want to just quickly change it let's say I'm selecting this broad environment the moment I click on this I option I can directly see the values which I have so in case if I have to update I can go ahead and update from here that's all so now if you come down here can you see new value got updated so that's a quick feature that I want to discuss about the post method when you work in real time you will get this environment and whenever you may need to make any changes go ahead and make the changes directly from here okay and in case if you want to manage direct collections or sorry environments you can manage from here perfect today in this video we are mainly going to talk about the global variables so in the last video we already discussed about what is environment how to use environment why we need it right but now when you click here you can also see one Global variable concept so what is This Global variables when to use how to use we will see this again this is very frequently as interview question so in case if you haven't seen my environment video then I would highly recommend you that what watch my environment uh you know uh video where we discussed about what is environment then only you can understand the difference okay so now if you can see it this is also a global global variables also set of variables so what is the difference between environment and Global variables so in order to explain this let me open first of all these three requests okay let's take the first request right now I have this URL variable which is already defined in the environment scope as you can see right so now what if I select no environment so as you can see now it is showing unresolved variable because now it is not able to understand what is URL because the reason we have selected no environment right the moment I click on send and if you come down here you can see it is not able to understand and it says invalid request now here comes the main part the moment you click here you can see we also have a global variable so what is global variable now as the name says globally now it is not dependent on any environment it will be available for all the requests okay so now here comes the two concept one is called local scope so the variables that you will Define within an environment will be known as local variables for the time being and the values or the key value pairs which you will mention within the globals will be known as the global variables so they will be available for all the environments and local variables will be only available for the environment for example if I create one Global variable so just click on this ioi icon click on edit and let me select one let's say keep URL and maybe I will just copy this URL first of all just a second guys okay not this one let me select QA yeah this is the base URL okay and this I want to make as a global variable so I will go here click on edit and I will keep URL mentioned here and that's all now you will see the moment I put Mouse over okay let me save this and let me select no environment the moment I put Mouse over now it is not giving unresolved because it is taking from the global variable as you can see the symbol is g means Global and you can see the scope ads as well as a global so it means when it is not able to find within the environment definitely it will check for the global variables just keep this point in the mind guys if it is no environment it will take a search for you know Global if it is present it will take it now here comes the main deal uh so before we do that let me just make it QA okay so now can you see I also have the same variable in environment same variable I have taken as a global now the question comes which will be taking or which will have the more preferences so as you can see postman has by default you know striking out this Global variable value the reason is Postman also or always give the higher preference to the local variable so as you can see environment is giving more preference so it will always take if you have the same you know key if it is different definitely there is no mismatch and it will take based on the key value but if you have the same variable name in the environment and in the global it will always take the preference for the environment which is nothing but the local variable okay so in this case uh it will work fine because it will take the URL from the environment variable and you can see scope as environment now if I select no environment this time same URL is present in the global variable and it will continue right so now the question comes like shall we go with local variables or which is nothing but environment variables or shall we go with global so guys if you have few variables or few you know key value pairs which is not dependent on any environment keep as a global variable but if you have such you know uh a key value page which can change or which will you know differ between the environments you can maintain within the environment so it is same or similar to what we have done in the programming languages right we have local variable Global variables same concept will be applicable here okay so I hope this is clear if yes then fine if no then let me know your questions in the comment section let me just give you a one last point or a quick overview local scope or local variable so this will be within environment okay so Global scope This Global scope will be you know without or independent of environment so whether you select no environment or any other environment this scope will be for all the requests last point if you have the same variable name within Global and you know environment then preference will always go for local for local arrivals environment variables that's very straightforward I hope this is clear if it's still not clear let me know your thought in the comment section I will definitely try to make another video on this because whatever we are doing right now from UI we can also set the variables you know set the environment variables Global variables within the script as well which we can mention in the test priest request a script and we can play accordingly okay guys this is very frequently Asked question in the interviews as well so make sure it is clear to everyone today in this video I will be talking about what is workflow in Postman okay so when you talk about workflow it sounds little technical but when you you know see the examples it's really very easy so before we jump into what exactly is workflow let me talk about the you know what is the problem right now or what is the requirement as of now okay so in this example this is the collection that I have and I have three requests right so I have get post and delete and when I run them you will see they will run in a proper order or whatever order they you have mentioned so right now they are running in this order right so what if I simply drag and drop yes this will change the order right so this is what we are doing through Postman and we are manually changing this order right but what if I have such requirement that I want to run a specific request once this particular request is done for example once this get request is done I want to run the delete and after this delete again I want to run let's say post or any other request so if I don't want to do from collection Runner if I don't want to do in this case I want to do it you know through a script how can I do that in that case we need a workflow workflow means how the request will propagate in simple words right so one two two to three and so on so this is nothing but a workflow so in this case if I run it will definitely execute get post delete so let me do one thing let me run it so before I run this let me also create one more request so I will go ahead and create a request this request let's say I am creating update user okay so if I just go to this update user uh let me just add anything okay some dummy because the main reason is just to show you this workflow so right now I have four requests the moment I run this and the moment I run collection Runner it will simply run in this order okay so let's run them okay so it says okay there's something issue with this environment so let me change this environment so this environment thing we discussed already in the previous video guys so in case if you haven't seen the previous video please go ahead and watch that video where we discussed about what is environment and all right so let me run this again now we have proper valid QA environment and I'm running this collection so yes it is done it should run in this order get user create user delete user and update user go ahead and yes okay it worked expected and this delete user test is failing and because of the response time okay this actually we failed uh you know forcefully in my previous video so this is not an issue forcefully we have failed it just to show you the main intention was just to show the request and it is happening right get user create delete and update now let me do this same thing or let me change this workflow using script so let's say this get user and once this get user is done I will create a user then I will update the user and then I will delete the user this is the sequence I want so I don't want delete just after post I want delete at last so what I will do first of all let me show you the official documentation so there is a actually a inbuilt function in Postman okay where you can set the next request the moment is a postman dot set next request you just need to mention which request you want to run after this particular script or request and it will automatically call it so let me just copy this okay so this is running fine I want the get user first then I want the post user now after post user I want update user so I will go back to test and we already have one test added in our previous videos so I will simply copy here and I will mention the request name what is the request name it's update User make sure that it is proper otherwise it will not be able to understand that request which exists or not so make sure you give the proper name and it's a case sensitive now we are done so once this post is done it will do this and finally let's see how it behaves you will see a strange Behavior now so let me just run this okay and let me run my collection okay so it has actually executed get user create user and update user but hold on there's a small mismatch what about the delete user why it is not executing the delete user the reason is when we started collection it was on the last right so after update user there's no request so it is not able to understand what is this delete user right so you need to also make sure that when you uh you know make this set request your all the requests are covered because if it is at last okay if you set this next request to last it will not execute the further ones so if you just see now let me just run it again [Music] okay just a second what is coming like this okay let me just select this click on run yeah so now if you expand this so we call this get user then I called post and then I called delete update user but after update user we don't have any requests it is not able to understand or it is not able to call this delete user request okay so let's do one thing let's add one more uh set next request after update user so that we can call this as well so that's actually interesting concept so again I will go to this update user I will go to test I will simply copy paste and this time I can say that I want to call delete user okay make sure it is correct and yes let's go back let's run this collection once again and now we have proper workflow which starts with get user create user update user and finally delete user and run my collection and here we go okay so now this is a small you can see it is going in infinite Loop okay so why it is happening let me show you so what we did right now once this is done again we are calling the delete user right after delete user again the next one is update user again update user is calling delete user so this particular thing is going in a loop so how we can stop this we'll see but let me run this once again and you will see it okay run my collection okay can you see update user delete user is going in a loop now because because of the order which I showed you right so this will be same until we stop this but what if I want to stop again with a script I don't want this to go in a loop right because definitely you will get this kind of situation where you can just tell the last request that I don't want to execute further so in our case ah okay this delete user is coming in a sequence and it is calling this so what I can do again I will go here and I can just go back to this I will copy this and this time I will set this to none okay it means once this is done I don't want to run the further because once the user is deleted I don't want to go in and loop and I don't want any other request to be made so now you will see it will just execute once and it will stop and let me do one thing uh let me just actually you know give the proper Response Code so that should not fail because failure doesn't look good so I will go back to my collection run it and now you will see a proper workflow get post update and final delete after delete user we are saying null so it will not execute and here we go so I hope this workflow concept is clear name is little technical but in real time if you just try to relate it when you want a specific request to execute next one is you know next to one request you can change the order directly from the script itself and if you don't want to do from the script you can anyways drag and drop from here as well another important generator that you maintain this in a you know a test you can also maintain this in a prerequis script as well so we haven't discussed this point till now but yeah you can add this next request into the pre-request script as well today in this lecture we are going to talk about a very interesting feature again from Postman called debug and locks so as you have seen in the you know all the programming languages all the different tools we have the debug functionality and we have the logs as well as we know that debugs and logs are very important for us to identify what went wrong with the API calls and you know when we are making calls if you want to see what data is going what response is coming we want to see some variables that we are sending so everything we can do here now with the help of Postman okay so um before we move further I just want to show you their official documentation okay so I will link this um in the description so whenever you have to make you know record anything on the console you just need to use a small method called log okay it's again JavaScript code so you just need to write console.log and whatever statement you want to write or whatever variables you want to see in your debugger or in the console you can directly use it okay so I will be using this it's a very small feature but it's very powerful so you can actually do the logs for the different you know informations so let's say you just want to log few things you just say console.log but if you want to categorize this log so as we know that we have different levels of log so we have around seven levels of logs right so now you can use here console.log console.info console.1 and console.ero so it depends on your JavaScript code that you will write inside the postman okay let's say you are writing some if else condition in your test and if something fails you want to report as error and something goes you know success you can maybe write into the log or the info section it's up to you how do you want to use it so as we have given the postman console logs for the following information so main thing let's say you want to see the request that you are sending right so what kind of headers you are setting what kind of variables value that you're setting and when it comes to the response okay you want to see what kind of response is coming you want to you know actually expand each and every node that is coming from the server and you can see what details are useful okay the proxy configuration certificate and all the information about the network okay which includes the host address IP address protocols everything it's going to be very easy you just need to you know use console.law console.info1 and error depends on your requirement and you will get something like this so let me show you how you can get this and they have another interesting feature that you can also get developer tool directly from Postman okay and you can just go to the network Tab and you can see all the details which is getting passed to the server and the response as well so let's see what I will do I will go back to postman and I will be using one post request the reason why I'm going to show you post request because I want to show you how this will once we create some variables how this variable will look like in the console window so again guys if you have not seen my previous video where we discussed about you know environment variables passing variables to the different requests and adding the test then I would highly recommend you to watch my previous videos they're amazing we have discussed so many things about the post mental now I will link each and every video in the description so in case if you want please go ahead and watch that it's absolutely free now when you click on Postman uh see this is the request that we created and if you come back to the body section so this was the payload which I was sending right while making this post request so let me show you first let me so this URL will be replaced with this URL the moment I click on send request okay I'm just sending name and job and the user is getting created so it's actually post call which is creating a user so when I make these requests this is getting created now I want to see how it is you know happening in the console window or what kind of request I'm sending and response I'm getting so let me open you can see this option here Postman console right and if you don't want this is just one direct icon they have given the moment you click here it will start the postman console you can clear it in case if you have the previous sessions in case you don't want to go from here you can also go directly from views and show Postman console and for all these options you also have a shortcut okay so if you can remember the shortcuts it's well and good otherwise you have the direct options okay so this will start your Postman console in case you have a huge log you can search from here in case if you have different categories of logs available you can directly filter as of now all is blanks it will not make any sense to select and then select these options okay so what I will do I will just uh make few changes in this request then I will show you first of all without making any changes let me just hit the send button and you can see it is making a post call and now one thing if you notice this URL okay here it was URL API user so it is coming fine but this value is actually getting replaced by this value which we have written in the environment variable can you see this req res Dot N so first thing that we can easily understand that the variables which you are passing is coming correctly now the moment you expand this you can see now again we have different sections here so this is the network layer okay where you will find all the network related information and now this is the request header which is getting passed via your request so it includes so many other details which we have not passed so this is the internal headers which is Postman sending for you but in case if you have some custom headers then that we will pass definitely in the upcoming videos so this headers will also includes your headers as well as of now these are the default headers which is passed by Postman now if you expand this body so this is the body that we are sending to this request and we are getting the request it's very interesting guys you are able to see each and everything now using this Postman console now this is a response header which is coming from the server after processing your request right so again these informations are you know some additional information you might not have your information right now but once you move forward let's say you are sending some requests you are expecting a token you will find all the token values and all the necessary details and that response body so it is just a header so right now you can see the content type which is expected is Json but in response body whatever response You're Expecting right so we are expecting this uh user has to be created and I'm and the main thing I want to capture the user ID so this is what I need and this is what it is able to capture fine so this is how internal it is capturing without making any changes in your request so we are not making changes it is just your opening Postman console we're able to see each and everything now once I clear this okay again if you don't clear you will see all the logs will get appended and you will see a huge log so just for double purpose I'm clearing it but in case if you don't want to clear it's up to you now I want to make few changes and that changes I want to see in the you know response and actually I want to see how it is getting passed to the server so I'm going to write a small JavaScript code okay in case if you're not familiar with JavaScript that's fine you can follow this step by step what I'm telling you and it will be same for you as well in case if you're interested in JavaScript maybe you can Google it on soon I'm coming with JavaScript tutorial so we will discuss each and everything about JavaScript as well so as of now I'm going to declare a small variable okay so I'm just going to use where and I'm going to use a small name variable and this name I will replace with my name okay let's say Mukesh Postman now I want to see or I want to pass this variable in my body okay so you can see the variable name is name so in the body I cannot directly pass as a name okay why because it is just a variable I need to set I need to tell my Postman that we have a name variable that you want to use in the body so first of all we cannot directly use it so we need to set a global variable or environment variable then we can use it fine so you can see here I can see one option called set a global variable so here I need to set a key here I need to set the value and then I can use this Global variable anywhere in my request it can be in body it can be in header it can be in any other section so what is the name name is actually the variable value that I want to pass so I will keep it here fine now what is the key key is up to you what key you want to use make sure it is unique so I will say let's see username so another interesting thing which I want to show you that the moment you click here right now you can see I have two Global variables one is URL one is variable key this we have discussed in the previous videos guys what is global variable what is environment variable what is the difference so again if you have not seen my videos I would recommend you to watch that videos they are very useful for real dance as well so right now as you can see I have two variables the one I'm going to set right now through script is this one which is username and I also want to see uh in my console so I will say console DOT log okay and in double quotes I will say name which is going to set is plus operator and I will simply just you know try to append this so that I want to see in my debugger as well again the console log so this is going to create a variable just like a normal variable in any programming language I'm just printing it and I'm setting a global variable now this I want to use it so how can I use it so first of all what you need to do you need to say two double curly braces starting and end and you just need to give that variable name that's all okay now let me send this and let me also yeah let's send okay something goes wrong okay so you can see it is value is coming name which is going to set as Mukesh Postman so this is fine it is able to capture now it should also come in this section okay so let me see what went wrong here just a second okay so let's go back and see what we are written here okay so the one mistake which we did the key which we are setting is username okay and by mistake I've just added names so let me make it username so now this value it will be replaced with the actual value and let's click on send once again okay and you can see here the key which was we which we were setting was Mukesh Postman and this is actually getting replaced here and now if you want to cross verify first of all you can see here it is getting updated right so username was Mukesh Postman early it was not there but the moment we executed the test it is actually going to set in the global variables and you will see the values so now if you come back here you can see this is the one which we have added in console.log and it is coming as it is so this is value which is coming from that where variable and now as usual I want to see the post response body so in the response body now you can see it actually replaced with the global variable fine now let me also show you one more feature uh it's not I will say feature just additional method the different kind of logs that you can write as I have shown you in the documentation you can go with you know uh different kind of logs so we have a logs.info so let me just make it info let me make it one warning warning and let me make this as error and let me just send it once again okay and you can see earlier we get only this because it was just console.log but now we are going the category that this is the info this is the warning and this is the error error is something critical that something is going wrong and we need to fix it so info and warning is fine but if it's something coming as error it means it has to be checked so once you write once you move forward you can write you know complex script and you can write offense condition and based on the result you can decide whether it's a log or just a normal log or it's an error audio warning that's all okay so I hope it is clear now this debugging is very important when something goes wrong so I hope you will like this feature and you will use this feature in your real time and if you find any difficulty or if you need any of the information on this debugging and the logs let me know in the comment section and I will be happy to assist you okay so in the next example our video I will show you how you can you utilize this prescript again effectively in different you know request at the collection level so I forgot to mention that this prequest script will always get executed before the actual request okay so before sending this particular body this prerequis script will get executed so that your data will be ready and then finally you can consume here and you can continue okay so in this lecture we are going to talk about what is pre-request script in Postman okay so now if you have seen my previous videos we have already used this test right but what about this pre-request script what does it mean because here also adding the scripting right here also we are writing everything that we need JavaScript then what is the need of prerequisite script and why do we need it okay so if you see here pre-request scripts are written in JavaScript and they are going to run before the request is sent so the moment you click here learn more about prerequisite script it will redirect you here and now as the name says it is going to execute before sending your request so it's a small JavaScript code or it's a you know lengthy or complex JavaScript code that you want to write that will do some kind of processing and it will execute before sending your request and it will give you the data so now they have already given the sample usage you know example usage when you can use this pre-requested script so it can be like uh the first one which is very common that you want to run some set of requests from a collection and that you want to run them in a sequence before running this particular request or you want to capture some data from the previous request or from the pre-request that you want to consume it right so this is the very basic example and basic usage why we need pre-requested script so I will show you one example which will makes everything clear okay and this is what called the chaining part okay so this chaining also I will show you in the next video is called Postman chaining or Postman uh you know request or APA chaining where one request will process some data it will set into a variable and another request will use the same value for the subsequent calls okay so let me show you one interesting uh PPT like this is what we are doing right now okay so we are sending a request we are getting a response and finally we are executing our test script which is nothing but your test here right so this is what the flow is right now request response and the test script which is nothing but your test so when you make the changes or when you want to use pre-requested script it will be something like this and this will be the order first of all pre-request script will execute then your request will get execute then you will get the response and finally you can execute your test script that you have right now so the only change which you will see right now is this part so before running request this pre-requested script will get executed and you will get the data okay we also have one more use case that I will show you but let's use this one first so that you will get a clear picture about pre-request script now let me just go back here yeah in the prerequest body and I'm just making some dummy calls or some basic sys out statement which is going to do some print statement that's all it is just going to print something on the console so I'm just going to use one variable called name and I will say Postman um tutorials some random variable I'm using okay and I will be using this in console.log because I want to show you the order how it runs I will say tutorial details are Plus this I will just print and maybe I can write one more thing called running pre request script from request okay and that's all I will not use this variable here it is just to do some just out here uh well let we don't need this as well we will use in for some other example so I'm just saying running pre-request descript from the request label the why I am writing a request label because in the next example I will show you the collection collection label okay now let me just uh run this this is the debugger which we have this we already discussed in the previous video how to use Postman console if you are completely new to postman console you just need to click on this icon okay Postman console and this Postman console will start so now let me just send this okay can you see this is the request that we are sending and before sending this request it is actually making this tall which is nothing but pre-requested script so this makes everything clear that before executing your request it is going to execute pre-request script fine it can be a complex JavaScript code it can be calling some other API another Runner it can be anything fine now if I want to run this particular thing or let's say I want to set some variable or some headers for each and every request let's say I want to make the same thing for this as well so if I make some changes here it will be different for this particular request if I want to run some pre-requested script for this request it will be different so if I have 10 requests that I'm sending and if I make this pre-request script for each and every request it will be TDS task correct I have to go to each and every request I have to make the changes here but let's say I have a set of you know requests that I want to make sure that all these request has to go through some set of pre-request script in that case I will go back to collection okay so this is the collection that we have right I will click on this collection added and I will click on pre-request script now if you see this script will execute before sending each and every request in the collection okay so what I will do again I will write console DOT log and I will write running pre-request script from collection okay so not only this prerequis you can also do so many things you can also set the authorization from The Collection they will test and the variables as well as of now we are focusing the pre-request script so when I update this collection it means within this collection whatever request I have for each and every request that pre-request script will be applicable okay so let me do one thing let me just clear it out fine let me run this collection and let's see how it goes so I will selecting QA environment that's fine run my collection and it executed all right so now if I see here so this is coming which is running pre-request from Postman this is saying running prerequest from a script first one then for the second one also it is saying running pre-request from Postman and this is the last one okay so we need to make a small change here guys just one thing okay let's clear it once again I will show you what went wrong it's not wrong it is just we need to see the order okay so now we have get then we have post then we have delete and delete just need to see after pose did we given any pre-request script okay yes so you see guys this is what we did in the previous videos what I was mentioning that I want to run update user update user does not exist so if I just close it and if I just make a delete user so just after executing this create user it has to run and now you will see you will get three times pre-request okay so let me just go back run my collection once again fine since we have three requests so you can see one time it is coming here second time it is coming here and third time it is coming here it means before running each and every request it is going to execute the pre request Escape From The Collection so execute it this was your request then again it executed from collection level it executed your request okay then executed third a request and this is prerequised script from collection so it is just I am doing a sales out statement right now but you can do you know many things here like you can set the content type you can set the header you can set the cookies which is same for all the requests just to make it little simpler just to make your concept clear I took this is out oh sorry console.log but it can be anything depends on your requirement because concept is more important than the examples so I hope this is clear for everyone so the the one which you have seen in the last is is what created right now so we have collection level previous script um then we have pre-request then we have requests okay and once this is done it will go back to response and if you have any collection level test then yes definitely collection level test will execute and finally your particular test script for that particular request will execute okay so if you mention collection level pre-request script will be applicable for each and every script in the same way if you mentioned collection level test that will be executed for each and every you know response that you will receive so very a good example for this can be you want to make sure that each and every request that you are you know sending it should be 200 or two not one or it can be any other error code so you can mention that same thing in the collection level uh I hope this is clear now so in case it is not clear feel free to ask me in the comment section or you can mail me at my email images.com for more details you can also check out my blog which is learn hype intermission.com today in this lecture I will talk about how you can import or how you can execute the curl command in Postman right so you must have seen when you visit so many APA documentation or when you get your official documentation from Swagger you will be getting one call command that you have to execute in order to get the request and response right so before we move ahead let me talk about what exactly is current how you I will take one basic example okay and then we will use this curl command maybe I will take a few existing call commands and I will use it in the postman right so now you often see curl which is we generally call this as a girl command so it's a free command line tool so it actually uses the URL syntax to send the data to server and get the response okay so you can transfer the data from to and from from the server so by default it comes in Windows you don't need to install separately okay I'm using Windows 10 for Windows 10 it comes by default in case you are not able to recognize these commands you can download this girl externally and you can use it so CI C URL or call it actually means client URL okay so let me show you how exactly it works then I will take few examples of call and we will import enforcement and we will execute okay so what I will do I will just open command prompt okay and I will simply type girl so it says you can use Curl hyphen hyphen help for more information okay so let's do that I will just say help and okay we have so many parameters that we can pass to the girl and it will do the processing for us right so actually it's a huge list so what I would recommend you to if you have free time if you are kind of guy who tried to explore so many options try to read all this documentation but for this example I just want to show you how basic commands work so that I can show you in the postman so the one example which I want to take which everybody can relate is the downloading part or I will say writing the output to a file so you can see right we have a hyphen o means output so what it will do it will write the output to a file so whatever name you will give it will write everything in the same file fine so let's do one thing let me clear it out so I will say CLS okay so let's do one thing let's put call command and let me hit www.google.com and let's see what exactly is going to written again I will do CLS I will do two apparel so I will get the previous command I will say hyphen o o means output and I will give this file name as download Google data dot txt extension is mandatory guys the moment I hit enter okay it is again printing let's see did we get okay it says something else remote file name has no length okay just a second now let me try once again called hyphen o and I will just mention the same okay uh yeah let's mention once again www.google.com and now after hyphen O It's a small oh guys okay so I want to save to a file so let me save this file called download Google data or let's say homepage Dot txt hit enter and you can see it is giving you the information about the curl output so it says 100 done total received average speed everything so let's go back and see this location uh so this is the users folder this is the user folder and the file name which we gave was download Google homepage.txt which is here so now move the moment you open this you will find the same source code okay which was coming on the console right now it is printing the same or not printing it is actually writing on the same file so what exactly we have did we actually sent a request okay we got the response we were capturing in a file I hope this is clear now same thing we can do in Postman so let me show you why do you need it so I have two APS right now which I want to show you so let's say uh let me show you the covet API which everybody can read Because complete world is suffering from covet 19. so as you can see we have this get API right the moment I hit this API I should get all the statistics of covid-19 patient so right now what they are doing just simply making a curl it's a get request and this is the EPA endpoint so if I want to Simply call this API I can copy this or I can double click and I can say copy now the question comes how do we call this imposement because in Postman we have a directory Quest so how do we call that so let's do one thing let's click on import and you can see here we can drag and drop Postman data or any of the below format so right now Postman supports these are the you know formats so the one which we are going to use is C URL which is curl so if you have a file you can directly drag and drop or if you have the raw text which is right now what we have and you can see right now they already have given you can paste the raw text in this comment so in case if you don't have any you know working API which you want to try out they already have given the set of apis so you can see a postman hyphen eco.com they have given in case if you don't have use their existing apis this is what they have given in the documentation so I'll just pasted the same it is just going to get um this is the base path right and this is going to make a call to this particular endpoint which is General statistics now if you come down here you will see continue button the moment is a continuous it will import everything and it says format is called it is importing as a request and this is the name perfect right now you can see I am not able to change it but once we import it is in our local system we can import it sorry we can change it actually so click on import and let's save this so while saving it will ask you what should be the request name I will say the request name should be covid-19 test or you know cases I just want to see now it will again ask you which collection do you want to use so if you have any other collection like all these collections I can do that right now I have collection name is my collection if you see and I want to save into this so you can see now this got imported now we're good to go now you can make any changes into this API and right now I'm just clicking on send and you can see it is giving me the response it is giving me total number of cases recovery cases death cases last update case with the outcomes and so many information now you can filter it out depends on what data you want right and you can continue now this was very plain API where we had not that complicated I will say you know the payload pad so for that I have another example this example also you can take this is also dummy site so whatever change is you will do here it will remain for 10 minutes after 10 minutes these data will be you know vanished or the database will be flush so you can use this for you know demo purpose but once you start working in real time you will get the same scenarios it is just I am taking sample apis in your case it will be real apis but process everything is same so another example if you see I am just taking this restful hyphen booker.herokuapp.com I will link this in the description or maybe you can just type it so here it is just a post call earlier it was a get call so here you can see they have given a curl example which I can simply use and it will generate a two conforming so let's do one thing let's copy this go back to import once again click on Raw text paste it here come back continue so again same information it is asking you confirmation like confirm you import this is the name format response sorry it is imported as request click on import now if you notice here that they had one body right so if you come down to the body section automatically Postman will import the body and all the required headers if you see the headers also there was one header called content type the moment you see here this content type is already here right so now Postman will automatically import and the body part headers part and if you have any other authentication parameters it will import automatically and you can use it right so again I will click on Save I just give some proper name I will say create token URL or API right click on my collection and this is the ready now if I hit enter or send it is going to generate a to confirming so this is what this API does the moment you make call to this API it is going to generate one token for you okay with response is 200 okay so they're given abc123 in our case it is coming this which is perfectly fine right and here they're expecting the Response Code should be 200 so let's make a test here and here I will just add one test that is a response code should be 200 so right now if you see the total number of test result is zero because earlier we did not had any test but right now I'm adding button test so in case if I'm sending once again I'm getting response it is validating and now the test is passed today in this lecture I will show you how you can run the postman collection or I will say the postman request using CLI okay so it's going to be very interesting feature and it's going to be super easy because Postman already have provided uh you know a very handy way to run your collection using CLI so we are going to use a new man so new man is nothing but a command line collection runner for Postman so what exactly it will do it will allow you to run the test directly from the cni okay so this definitely it is going to help you when you are running your test in different systems and you don't want you know Postman API or Postman application to be up and running you just start your terminal or the CLI and you can directly start executing your Postman collection so we are going to use Newman which actually will execute a complete collection that with a simple command Okay so without any further delay let's start and this is the link that you need to refer so if you come down here we just need to install us Newman in our local system and once it is done you can start executing okay so before we install this make sure you have the node.js installed in the system right so if you don't have node.js then you can download the node.js and then you can start with npm and downloading node.js is super easy you just go to node.js site just download it and double click install automatically it will set the path variable as well you don't need to set the path variable as well okay it will automatically set so in case if you want to cross verify do you have node or not so just type node space hyphen V and you will see that node version if it is giving you it means node is installed otherwise you need to download the node.js and install it okay and you can also see npm so by default when you install node LPM also will come automatically so in case if you want to cross check already we have npm installed in our system and you can see the current version at the time of recording this is 6.14.4 and the node version which I'm using is 12.16.2 at the time of recording this session so maybe you will have the latest versions or the you know older version that's fine it should work with any version because there's no compatibility which they have mentioned here so what we need to do we just need to install this new man and we are good to go so just either you can copy paste this command or you just type it so I will just copy paste Okay g means Global Newman is the module that we are installing so hit enter I already have in my system so in case if there is new updates it will automatically download the updates as well if there's no updates it should continue with my older version okay so it will take few seconds okay in the meanwhile I will show you how we can run it so basically Newman have just one command called run and you can provide the direct collection which you want to run and it will automatically run your complete collection okay so if you come down here you will see they have multiple options apart from the one which we have like you can directly give the collection and it will start but in case if you want to see the different options which they have so you just mentioned help or just say hyphen h and it will give you all the options which they have right now okay so let me show you yeah it's already installed you can see added one package from you know one contributor and the latest version is Newman 5.1.0 okay cool now what we need uh let me show you I will type Newman run hyphen h h means help section so apart from run what are the additional options that you can pass and you can see they have a huge list that you can pass along with your collection file so don't worry I will show you these exactly I will not be able to show you each and every option because it's not required and it will take lot of time so I will only show you which is required and maybe you can experiment all the other things from your side as well fine so we need now collection so that I can start showing you how it works so basically I have this collection so this is our collection that we are running from this you know complete series so it has so many variables environments and so many pre-script as well so if I show you this one you might get confused so let me show you the covid-19 tracker collection that we created earlier here actually we have only two apis okay the moment I sent this request I'm getting the code 19 you know details the total number of cases recovery cases death cases and so on in the same way I have another API which will give me country specific specifications or the sales results now I need to run this as a collection okay directly from CLI or I will say using Newman so what you need to do you just need to you know right click click on export and you can say it will ask you in which format you want so by default code like this complete collection will be coming as a Json file and it is asking us to export in v 2.1 which is recommended so go ahead with it I have created a separate folder where I can show you from scratch so this is the folder that so here we are going to store all the Json file okay so let me give this file name as a covid-19 um save this okay if I come down here you can see we have this collection file okay so just a small change that we need to do we need to make this in a Json format yeah so by default it should come with Json for me it was not coming so I just renamed this file as a Json file in your case if it is coming as Json file do not make any changes continue with that so if you want to see this file just open this in a notepad plus plus or notepad or any other editor which you have and you can see this collection has all the details about my request right now if I want to run this it's super easy you just need to open CMD just type new man run drag and drop this Json file and hit enter you will see it will start executing all your requests and you can see right now it executed two request one was get request and this was one assertion can you see this plus uh not plus actually it's a right option which is just for the validation if validation pass it will give you this check option otherwise it will fail this is another request and you can see another assertion also passed so total iteration one total two request total two scripts and two assertions totally you can see the result is okay green that's very good now let's make few changes so that you can understand how it works in real time so in my previous videos I already showed you how to create the environment variables right so let's say this URL is getting repeated in almost every request so that we already discussed that I don't want to hard code this so what if I make this as an environment variable and then I want to run it so in that case what should be the case right so let's do one thing let's create one um environment this environment I will say let's see covet okay and I will say new URL and I will make this as a current value okay and just save this and I also want to download this because I am running from CLI so definitely I need this environment as well as Json so that I can run it so just right click not right click just click on this and you can see it also got downloaded so what is here it's a covet and what should be the value it's a new URL right so guys in case if I completely new what is collection how I'm passing all this I would recommend you to watch my previous videos where we already discussed what is uh you know collection uh sorry what is environment variables how to use so I'm just doing the same thing I'm just going to replicate the same thing in this so in case if you haven't watched I will link all of them in the description you can go ahead and watch that now just to cross check whether it's working fine or not so yes it's working and the moment I put Mouse over you can see it's getting updated now here comes the main deal now if I simply download this collection now okay just export and let's export fine now let's go back and see here so this is the new one file if you can see this this was like 1070 this is the latest one so what if I simply try to execute this file and let's see how it execute okay so just execute now and here we go so you can see now it's actually failing the reason why it is failing it is not able to understand the URL so can you see this this new URL is not able to understand okay for second one it is actually we did not save the file so it's taking the default one so maybe quickly I will uh make the changes save this and then export actually we did not saved that's the reason it was not coming so let me save this it let me save this once again yeah so this time both should fail because both the request will not be able to understand what is new URL what is new or else it is failing and it is expected so here comes the main deal so we also exported our environment right so this was our environment where we actually have the value that we have entered so this was the uh environment that we downloaded but the moment you open this can you see this value is coming blank the reason is now if you go back here I have only given the current value I have not given the initial values so whenever you work with um you know whenever you work with a new man always make sure when you exporting The Collection you should have values in the initial section as well when you're working with Postman current value should work but when you export make sure you give the values in the initial value as well so I'm going to update it I will download once again and I will just override fine now let's come back here and execute once again but again it will fail because we are not telling that where is my environment variables right so just now we exported the new environment variables so let me quickly check did we get the latest one yes I hope so and yes you can see now the collection that sorry the environment that we exported right it has one key called new URL which is going to replace with this and enable status equal to true perfect now it should run so how do we know which uh you know how do we pass it so one thing that definitely you can refer their official documentation so if you come down here they have mentioned it your collection probably use environment variables right so you can just pass hyphen e and give the Json file and it will automatically pick the keys that you have mentioned and it will automatically map and it will execute okay it's very easy so I will just mention hyphen e space and I will just give the part of this environment so just drag and drop not here just a second [Music] yeah right so Newman run this is the collection that I want to run and hyphen e means environment and this is the environment I want to pass now let's execute it and yeah we're good to go so as you can see now this value is actually getting updated because this time we are passing so in case if you don't pass it will fail yeah so it's very easy this is how you can execute the complete collection with environment and it should work fine now there's another interesting question in interviews as well what about the global variables because environment we have already specified right but what about the global variables see for Global variables exactly process is same it is just you need to use hyphen G you can also export all the global variables as a Json file and you just need to specify the path okay so the last thing which I want to mention here you can also give the iteration count that how many times you want to run this okay so let's say I will add hyphen N N means number of times you want to run this I will make it two so right now it has two requests right but when I make n equal to 2 so number of requests should be double and right now you can see iteration was one this time when I run iteration should be to and you can see all the values have changed now number of iteration is 2 request is four prerequests script 4 and assertion is 4. and if you try to see this during first iteration it executed this during Second iteration it executed this so it's very interesting guys I would highly recommend you to explore this because this is how we are going to use with all the CI tools so in the next example I will show you how you can integrate with Jenkins and how you can take the maximum advantage of Newman okay so they have also given uh two important links which I have opened here it is exactly the same thing so whenever you have time please go with these links they're very interesting very important features they have given okay and you can actually do so many things with this new man today in this lecture I will show you how you can generate the HTML report from Postman so in the last lecture we already discussed right how to execute the test from the CLI so now I'm just going to show you how you can generate the HTML report from Postman so guys for this we just need to use uh you know a new module called Newman reporter HTML so in the last section we already installed the new man right which was able to which was actually helping us to run the collection from CLI so in the same way we are just going to run our collection it is just we need to mention one more attribute called hyphen R which is nothing but report and we just need to mention HTML it will generate the HTML report for us so let's go ahead and use the same so first of all guys there's no option to generate HTML report from Postman so we have to take the help of Newman that we already did in the last video so in case if you haven't watched that video I will link in the description okay just go ahead and watch how to use Newman it's very interesting so in order to run this let's say I just want to execute these two and I want the report in HTML format so I will quickly export this the moment I export I will I will replace with with whatever values we have now let me first of all clear this now let's install this particular module okay so just copy paste so install hyphen g means Global and module name is Newman reporter HTML and you can say the version is 1.0.5 now we need just one file okay which is nothing but which collection that you want to execute so this is what the collection we have right now so I will take this one which we exported just now okay few seconds back so I will just use this first of all I will say new man run maybe I will clear this here new man run averages drag and drop this collection that I want to run hyphen in case if you have any environment variable Global variables then use hyphen e followed by Json if you have Global variables use hyphen G followed by global variables as of now we don't have in this collection I will simply say R and HTML so as per the documentation we just need to mention hyphen R HTML and hit enter it should execute our complete collection and it should generate the report okay so right now you can see it's not showing anything on the console but it should have now HTML files ready now how do I find so it is going to actually put all your report under this directory can you see this C drive users users so I will go back here I'm already here guys so just go to C drives users user and now you have to search for a folder name called new man okay and you can see we got the report and the moment you open this report it's coming properly okay so this is the overall section guys which is the collection name which was covid-19 tracker total time exported now this is the main details guys how many times you executed so one iteration two requests two is test script and two assertions now it will show you individual report of each and every request that you executed so we actually had two requests so this was the first request and it is just giving you the description of that request what was the URL total number of pass test so it was only one total status code yeah so same thing for another request exactly same thing description method total number of pass fail and status code let me do one more thing let's this time I want to run two times so I will say hyphen n which is number of times let me put three iterations okay so it will take few seconds depends on what kind of apis you are running and this time we should have a new report and yes we have this one now so you can see now total number of iteration is three request is six test scripts is six assertion six because we executed Thrice and these are the requests right so it's very easy and now you can use the same thing in your CLI as well today in this lecture I will be talking about how you can generate very interactive HTML report in Postman okay now you must be wondering why I'm covering this topic again because the same video I have covered yesterday and we already discussed how we can generate the HTML report in Postman using Newman right then why I'm covering the same topic because now we have one additional report in Postman okay which is little interactive as compared to this old report so we will be using a different report called HTML extra so that will be little interactive it will give more information about your collection about your test and we'll get more information about the iteration pass fail script test and so on okay so before I move to that video or process I just want to show you how does your or how that report will look like okay so depends on the requirement you can use either this report which I'm going to cover now or the one which we already covered here so in case if you're new to this channel then hit the like button share with your friends subscribe to this Channel and I would highly recommend you to watch this series I have tried to cover almost every single thing from Postman and couple of more videos are coming on Postman so this series will definitely help you a lot okay so let's search for another report called HTML extra okay just search for Newman HTML extra and you will get their official link so if you see it's uh yeah so if you see the example it looks something like this you can also change the theme and you can see we have different filters so I will show you this now but it's very interactive report and when it comes to implementation it's quite easy just like how we did for the older report in a similar way we just need to install this as small package and you're good to go okay so you just need to install this package and you need to run your collection super easy just two clicks and your report will be ready okay so let me show you this so let me start with CMD and let me use this command npim install hyphen g g for Global and this is the package that you need installed okay so Newman hyphen reporter hyphen HTML extra hit enter and it will install this package in your particular local system now in case if you don't have Newman you need to install Newman as well and in my case I have Newman and I have this HTML extra also installed in this system so it will not install again it's already there so it may simply check and if some update it will download otherwise otherwise it will say that this module or package is already installed okay so let it install in the meanwhile let's quickly go back to our Postman and let's execute or let's see which collection we want to run okay so in my previous series we already discussed so many collections so let me just run one collection because this is going to be same whether you run one collection or multiple collection okay so let me export this collection and we'll see so just right click not writers click on these three dots and you will see one option called export and now it will ask you which option you want so let's select the last one which is recommended this one is already deprecated so it will give you this particular collection in a form of Json file so let's continue now it will ask you the location so location I already have one folder called Postman tutorials in case you don't have just create a new folder or any other folder and just save this and it will give you this message your collection is exported successfully let me just check here and this is our Postman collection already here in case if it is not coming as a Json file for you don't worry you can just rename to dot Json file and it will be ready for you in case it is coming just like it is coming for me we are good to go in case if you want to cross check just open this open a notepad and you will see how many requests you are running okay what type of request what kind of headers and all the details you will get here cool so our collection is ready and let me quickly check yeah so this is already installed in my system so the version which I am using at the time of recording is 1.17.3 but in your case if you are just watching this video at later stage you might get a different version that's not an issue just continue with that and now when it comes to uh how do we use it it's very straightforward we just need to use one small hyphen R which is for reporting and you need to use one keyword called HTML extra okay so let's do that let me do CLS okay let me just type new man which is new man is a module that we installed then I need to say run then I need to provide the collection which we want to run in our case we want to run this collection right finally I want reportings I will put hyphen r and we need to say HTML extra right so our HTML extra hit enter it will take few seconds depends on what kind of collection you have for me it's just two requests it will execute quickly and right now you can see I am not getting anything on the console or command prompt but by default this is our path right C drive users user so let's go to this here which is already opened here see users user now here you need to search a new folder called Newman in case if you have this it's fine if you don't have it will create a new folder for you called Newman okay and this is just now generated report for us so just right click uh just double click on file and you will get the report looks amazing right so now if you just click on the dark section you will see a dark report this is just two theme options they have uh you can go with light or dark I prefer dark so first section you can see its summary in the summary one it will show you how many iteration you have which is one iteration in our case total number of assertion is stored zero failure zero Scripts zero skipped test then you will get the file information which is nothing but your collection information then you will get some other information like how much time it took what kind of data it received every response time and this is the summary in summary it will include request pre-request total number of scripts assertions and skipped number of test cases in our case it was a basic collection so it just executed two requests and two a session okay now if you just come back here total request on top you can see we have one iteration right in case if you have multiple iteration you will see multiple iteration will be listed here and for each iteration you can see what request you have sent okay so this is iteration one and this was the first request that we made so it is showing that we are calling this particular URL this was the method which was get and Response Code total time and size per second and very good thing about it will also show you the headers part okay so these are the headers which is uh getting from the request and this is the response headers so it is giving you information about each and every request that you are sending and this is your response body okay and you can copy to clipboard and you can continue right so this is just one test or one request this is another request so if you just open this part you will see another API which we called right this was for Country based number of iteration was one two requests is the second request method was get total uh time and all then request header response header and again response body so it's very informative and in case if you have multiple iteration if you remember our previous example we did three iterations you will get all the three iterations in our case right now we have only one okay so this is for field test cases in case if you have right now we don't have said says there's no field this is test cases and this is for skipped one so right now we don't have any script test so it is also blank okay so again nothing too cold here it is just you need to use hyphen r with HTML extra and in case if you have some environment variables which you have already used in your collection you just need to export that as a collection and you can pass it that we already covered in this video okay so in case if you want to know how we can run collection with environment then watch out this video where we already discussed about how to run Postman from command line using Newman it covers everything today in this video we will be talking about how we can execute Postman collection or the postman request using Jenkins okay so before we start I would highly recommend you to watch my previous videos where we already discussed about what is Jenkins how to install Jenkins okay and what is the advantages of using Jenkins why Jenkins called as the CI server in case you are already familiar that's fine you can go ahead with this video in case if you're new to Jenkins then you can watch this video I will put this video in the description okay here I have discussed about how to install Jenkins everything in Windows and if you are completely new to postpan and so have a dedicated playlist on Postman where you'll get everything from scratch till the end okay so I hope you are familiar with these two things which is Jenkins and Postman so right now we are just going to execute our Postman collection from Jenkins okay so it's going to be very easy so if you go with Jenkins or if you go with the postman documentation okay just come down to the section called using Newman CLI and you can see with the help of Newman we can integrate our test with Jenkins with driver CI even with Docker as well so we will be covering all of them so we already discussed this part in our last video where we executed our collection using Newman command line right now we are going to talk about Jenkins so what we need to do it is just once the Jenkins is fully configured you just need to run the same collection which we are running from CMD okay so let me show you this image just open this image in a new tab so right now in case you were working with Mac or Linux you need to say execute shell right now I'm using Windows system so I have to say execute batch command and I just need to provide the Json file which we are running it's going to be very easy just uh you need to create a job give this build command and you're done so let me show you so you can go ahead to Jenkins and create a new job now we don't need to create Maven project it is just one freestyle project is enough so I will say Postman uh test Okay click freestyle click on OK it will take few seconds and it will create a project for you so you just need to go to straightforward to build section and here you will see we have build steps just select Windows batch command and you can just add Newman run and that collection so before you execute this make sure Newman should be installed in that system where you are running this job okay so right now I don't have any slave any node connected so this test definitely will run on my local system and my local system I already have Newman installed okay so in case if you want to see the moment I say new man you can see it is asking few more options it means Newman is installed in case if I want to check let me see which version of Newman I have so I have 5.1.0 fine so I will just come down here I will say Newman space hyphen run and now I need to provide the Json file which is nothing but our collection that we want to run so if I show you my Postman this is the collection that we have created right so if I click on export this collection I already have exported this collection of a previous video so let me just replace it so that will have the latest uh collection so this is the one which we exported just now and if you open this collection it has all the test information okay that we are running forward followed by all the assertions and iteration as well so let me just go back to Jenkins and now I need to provide the path right so I will just come down here and first of all I need the path so I will just right click and I will also press shift from my keyboard and then I will right click then I will get this option called copy s path okay now I will go back to Jenkins and you can see I don't need this double quotes and now we are good to go so either you can give two forward slash or one backward slash it should be able to pick this and it should run it then there's a small thing which you need to keep in mind that in case if your path has some spaces okay try to avoid this spaces otherwise it might create issue for you so that's what we need to do just click on Save and your job is ready just click on build now and you will see it will start building your project and yeah here we go so it was very fast because this collection had only two get requests so one get request was General statistics for Coronavirus at uh including today's date and the second API which we called had Corona cases country wise okay so these are the two apis we call and you can see both are perfectly fine and it is able to run my collection or the postman collection from Jenkins quite easy now let me also show you one another way so the movement so right now we clicked on export we got the Json file and we executed right now let's say if I click on share collection and if I get a public link which is this right so if I want to run this collection using this public link how can I do that let's go back to Jenkins once again so in case if you want you can create one more test or you can just go ahead and edit the same job and you can add our mobile list step and you can continue okay so let me create one more so just now we created Postman test which is this right and now let me create one more so I will go back to you Jenkins I will say Postman test to Freestyle project click on OK and come back to build section add build step again guys if you're working on Mac or Linux or Unix you need to click on shell right now I'm working on Windows I am just selecting Windows batch command and then I will mention new man run and this time I have to Simply provide that public link okay which is this one so either you provide the Json or you provide this shareable link so now automatically Jenkins will run this Postman collection okay so in this case let me just build it now yeah and it will be yeah it's running fine again with the help of Newman we are able to run it so Newman is very powerful when it comes to running the collection either from CLI or from Jenkins or from Docker even from any other CI tool as well right now this is what I have one more interesting thing which I want to show you like I always recommend whenever you have different categories of test is always to create a separate View so you can see right now everything is coming under all view which I personally don't like so you can click on this plus option where it will create a view for you and you can customize this view accordingly okay the moment I click on ADD option it will ask me give me the view name so here I will say API test or if you want to be more precise you can say Postman API test depends on your requirement and I will be selecting this as a list view I want to display all the jobs as a list click on OK and now it will ask you that within this view what are the jobs you want to show so I will say I want to select Postman test and Postman test 2. and click on OK so now you can see there's one separate section got added here called EPA test and within this you will get all the jobs that we have configured and in case if you want to customize this view you can just click on edit View and you can continue okay right now right now these are the columns which is coming which is status whether name and last duration and so on so I let's say I do not want this weather okay I can delete this and I also don't want this favorites option so these two columns I have deleted now let me click on OK so right now only you can see the status name last column last failure and this is build option so in case if you don't want uh any other column you can simply go ahead and customize from there today in this video we are going to talk about a very quick issue that people are facing with Jenkins okay so in the last lecture that I published few days back where I discussed about how to run the test from Postman sorry how to run the test from Jenkins okay using Newman and now a couple of people are facing few weird issues okay so the one which is very weird issue which people are facing that they are able to get this console which is obviously is not in a readable format right so you can see the couple of English word which is coming fine but when it comes to the formatting right you can see some special characters are coming so if I show you my couple of other logs if you talk about uh yeah so you can see the standard report should look like this okay so here you can see I have a tabular format has some special characters and so on so it looks good but when you see the recent job which I executed so people are getting this kind of encoding issue so this is going to be very quick you just need to add a small parameter and you can fix this issue in few seconds okay so this is what my gen case is up and running so before I fix this issue let me run this test again so that you can get the same issue so I just executed the same job and it is running now and it executed so this looks fine okay but when it comes to table of format this table is coming in this format so what you need to do just first of all stop the Jenkins so this is my Jenkins up and running I will press Ctrl C and it should stop yeah now this is the command that we were running to start Jenkins now you just need to add a small key and value so you just need to say hyphen d okay uh hyphen D and say file dot encoding let me just give some space here so it's file dot encoding equal to UTF all in capital letters hyphen 8. and there's some additional space let me remove it here so just say Java space hyphen D file dot encoding equal to UTF hyphen 8 space this is your regular command Okay hyphen charge against bar and the port number the moment you hit enter it will start the Jenkins but this time it will start the Jenkins with this utf-8 file encoding it will take few seconds to get started so the meanwhile I will skip this part as you can see now it's Jenkins is fully up and running so now I can go back to Jenkins okay and yeah so before I execute let me clarify one thing if you open the old job okay so this is the job which I executed just now okay and uh okay it will take some time to load because just now I restarted the Jenkins right so taking some time to load okay no problem so let's just launch it again yeah and Let me refresh login it's selenium underscore 50. it's logged in so now let me go back to again APA test which we executed just now which is this three minutes ago Postman test and let me open the recent executed job still the same even though I restarted it is still giving me the old um I will say the reporting or the old special characters so again when you restart the system these changes will be applicable for the new jobs okay older jobs will still remain same okay so in order to get the correct formatting on the console again you need to build the job then these changes will be reflected okay so now I executed the test it should come in a proper format now here we go okay that was very quick solution so make sure you just include this small property which I added just now hyphen D file dot encoding equal to UTF hyphenate I will just give you this command in the description so you don't have to worry about it just copy paste and change the port number based on your uh you know system port and a good triple today in this lecture we will be talking about how we can integrate your Postman test with GitHub okay so this is what we have done so far this was our collection and if you see right now we have two requests and this is our collection right so in the last lectures we already exported this uh collection and this was our collection and we were running this collection from our Jenkins job right so if you go back here and if you see my Jenkins what I was doing I was giving a hard coded path that go to this directory and run this collection okay that's obviously it's not a good approach because what if somebody else wants to run this collection they cannot run because right now this collection decides on my system so first of all we need to make this collection uh shareable it means now we need to upload our unitos push this collection on a GitHub so that all the team members can start using it and whenever they have to run it they can just clone from uh you know GitHub and they can run or in our Jenkins job we will configure in such a way that whenever somebody wants to run they simply run the Jenkins job Jenkins job will automatically get the collection from GitHub and it should run okay so let's make the changes so we will divide this video into two part first part we will see how we can push our collection to the GitHub and the second part we will integrate Jenkins with GitHub okay it's going to be a very interesting video plus it's going to be super easy because in order to integrate with GitHub you just need to run few commands and you can push on the good Hub and in general you just need to make few changes in the configuration and you can easily execute this okay so step number one definitely you need a GitHub account in case you don't have GitHub account you need to sign up for the GitHub and you will get your username password so please log in with your username password and you will get your home page right now I'm on the trending page but if you go to your home page you will get your GitHub feed okay so right now these are some repositives which are on trending I was just looking for some trending um you know GitHub repositories and find couple of very interesting repositories in case if you are interested please go ahead and watch the trending repositories right away now second thing you need to create a repository right then only you can push your collection into this repository so right now I'm going to create under my uh name or my username but in case we have created some organization within that organization also you can create a repository for the timing I'm just creating repository under my users I will say this is my Postman uh Repository or let me make it Postman test scenarios okay I want to make it public okay and let's click on create Repository the moment you click on create repository it's completely blank now and you can see now they have given three options first you can you know directly start from the command line and using this or you can push from existing repository using command line or you can directly import the code from another repository so we are going to follow this one clear so this is our GitHub URL or I will say repository URL so I'm just going to clone this or I will just copy this for the time being and I will just store this somewhere here okay now we can do the cloning with either https or using SSH I would highly recommend if you just want to give this as a public repository and you just want to give you know read access you can go with https but whenever you have to do some re-dried operation I would highly recommend you to do with SSH options okay I will show you both the ways but yeah recommended way is using SSH so let's do that this is our collection right away and we need to push this collection onto this GitHub repository so we need to follow these steps now before we execute this step definitely you need get right then only you can run all the get commands so for that let me just show you in case if you don't have git you just need to download a git sem and you can start using this command in case if you are completely new to git I already have few videos on git which I will share in the description please go ahead and watch that videos that covers basics of it that we are going to use now those are completely new to get don't worry I will show you how to download and how to install and how to use this command so quickly go to Google and search for git SCM you will get their official homepage get hyphen.com yeah so it will automatically detect your operating system for me it's showing Windows as of now the moment you click on Windows okay it will start downloading and this is just like a normal software you need to double click and you need to click on next next next install you don't need to set any path automatically git will take care of how to set the path how to you know change the environment variable everything it will take care and within few seconds you can start working with Git okay I already have this kit so I will click on pause or maybe cancel yeah so once the git is installed you just need to search for git and you will get these options okay you will get get bash get CMD and get ey so right now you can see get cm is deprecated so they highly recommend to use get bash okay good part about git is once you install git either you can continue with get bash or you can continue with normal CMD as well it's up to you okay whether you use git bash or our normal command prompt it should work in both the ways now apart from this if you're working on Mac you can go with the terminal it works exactly in the same way right so let's go ahead with any of the terminal I will continue with this which looks familiar to everyone now let me go back to yeah let me close this and guys those who have not gone through the previous videos how to set up Jenkins and how we executed the test these uh this is the video that we discussed already so in case if you're new to this Channel or new to this video I would highly recommend you to watch this series where we discussed everything about the collection how to install Jenkins how we can execute the postman from Jenkins and everything so this video is the continuous of the series I will give this link in the descriptions in case if you want to watch the previous videos feel free to watch now let's get back to again get first thing that we need we need to initialize the git repository okay so I will simply say okay first of all we need to go to this particular directory where our collection is present Services CD and now we are at this particular directory now let me run a First Command which is git in it so I will say get init means initialize the moment you say get in it it will create a empty git repository into this directory okay so if you go back to that directory you will see this git option okay and if you open this you will find all the git information okay so once you move forward and you read about the you know different kind of heads branching all things will be created here now just a small note here it's a hidden file okay so in case if you're not able to see this you can go to view section and make sure you check this option by default sometime it is unchecked so you will not see that git config okay but the moment you click on hidden item you'll find dot get and you will find all the configs okay so I personally uncheck all this so that I can see what what hidden files are coming and so that we can explore more okay make sure you check them even if you don't check it's fine your program or your git will work but yeah here you can find some additional information our repository is initialized now they are asking us to read add some readme file we don't need because we already have our collection right so what I will do I will just type git status just to check that what is the status of of untracked file as of now so you can see right now we have untracked file which is this one covet tracker which is nothing but our collection so in order to add as you can say they are mentioning that in order to track the changes you can say get add to track let's go ahead and do git add and start if you want to give a specific file name okay in our case this is covid-19 tracker but in case if you want to add multiple files you can give star and hit enter it will drive all the files now if you want to cross check just type again get status and right now you can see this particular file has been dragged now what about next next is simply get and finally add the origin and finally push okay so let's do the commit so I will say get commit hyphen m means message and what should be a message I will say this is my first collection hit enter and you can see the commit is done again put get status okay since it's already committed it says nothing to commit working tree clean okay now finally we need to add the origin right and this is what we need to add so this is our GitHub repository right so we are simply saying add origin this hit enter and in case if you want to see whether it's got added or not just type get remote and you can see this origin has been added now we're good to go finally we need to say git push hyphen U origin master and so by default when we don't create any branch so by default the branch name is master branch in case if you have multiple branches you can change the branch name right now it's a blank repository so we have only one branch called Master Branch so we are posting this collection to the master Branch okay the moment you say hit enter it will push this collection to the GitHub and you can see when you're doing this first time since we have clone using https okay so if you just see here this is https so it is asking me username password I will quickly enter my username and click on login come back here and it should push my changes and yes you can see it says New Branch master and it has pushed all our collection so if I go back to this you can see our collection is ready here that is super easy just few commands and definitely you will get these commands when you create a new repository for the safer side I will also give you these commands in the description of this video so that you can directly copy paste okay now let us say you want to run this collection from Jenkins now how we can do just click on code anyways we have used this https right click on this go to your Jenkins this was our job so what I will do I will create a copy okay so that at least we have we will have two jobs I will say Postman test and I will say this is GitHub GitHub HTTP because next we will do with SSH okay so Postman test GitHub HTTP and I will copy this from This Job And if you don't want to copy that's fine you just click on OK something is wrong let's create a new one it's a postman test GitHub http click on freestyle click on OK yeah yes so come down here select the git and here you can give the Repository so this is the Repository URL I just copy paste it here and now you can see this is my credential okay so let's use without credential okay because for cloning we don't need any credentials yeah definitely when you push you need a credentials so for cloning you don't need so it is going to clone this particular Repository and the moment I come down here and if I say windows batch command I will say Newman run and by default we will get this uh collection into my current working directory or where this particular repositive will be cloned so I just need to look for this particular collection right so I will only say new man run and this collection click on Save and click on build now okay so let's wait so first it is cloning yeah I guess cloning is almost done so now it is running our collection and here we go now this Jenkins job is not dependent on any particular location it is directly fetching from GitHub and it is running our collection right now if you in case if you want to see where it is downloading so you can see right now it is going actually to this particular folder okay if you want to see just go to this folder and you will see where Jenkins job is downloading my collection so by default all the jobs that we have created right it goes to Jenkins workspace so this is the job that we created now so if you just open this here we have the collection so when I say that I am running Newman run so it runs into this particular directory and in this directory we already have this collection so it simply runs okay that is the power of this Jenkins it's simply clones everything into the same directory we are running this command and we are able to run it perfect now the next part is using SSH now I can do the same thing uh you know from assesses in the same repository but yeah on the safer side let me do from the Fresh repository okay so that you can understand the clear difference so again I will go back I will create a new repository this time and again I will say Postman apis Okay click on new Repository and this time I will click on SSH okay so let's clone this copy this and I will just store it here and we already used uh this command prompt right now let's use get bash so that will cover both now guys there's a small change that you need to do when you go with SSH okay so first of all you need to create a SSH key and that SSH key you need to add into your GitHub account then only this connection will be established so if you remember just now we post using https right so it was asking username password so every time I don't want to pass username password so I just want to push my code directly from my system without entering my username password again so you just need to set up a connection from your local system to the GitHub using SSH key it's going to be very super easy you just need to execute one command public private key will be created you need to just copy paste this public key from your local system to GitHub okay so what is the command in case if you're completely new to SSH key and if you don't have SSS key at all this is going to be from the scratch so don't worry so how to create SSH key just type SSH hyphen Keygen okay hit enter so it is going to create a public and private key pair for you so it is going to save in this particular file Okay C drive users folder again user dot SSH file which is mainly for SSH all the public and private key will be stored into this directory okay so hit enter that is asking for the passphrase okay don't give anything if you want to have passphrase you can give it one prefer hit enter again it is asking hit enter and you can see it created public key and private key for you in the same working repository okay so you can find all the keys that public and private key into this folder so let's go ahead and check yeah this is our users folder and if you see just now this got created and now we have public key and private key so the moment you open public key you will get something related SSH hyphen RSA okay and this is the complete public key what you need to do just copy this and switch back to GitHub go to your profile go to your setting and here you will find one option called SSH and gpg key so you can see I have multiple Keys added and it will also show you the one which you have used last time so I am using this key currently now I have deleted that just to show you so I have a fresh keynote okay so I will click on new SSH key and you can see generally key begins with SSH RSA SSH Ed the one which we have is this is rsf just copy paste here title I can say uh Postman key click on ADD SSH key okay it is asking for the password again just quickly enter the password and yeah this is it right now it says never used because yeah just now we created we will be using it now then you will see it will change and all these keys are enacter now if I want I can delete them only the one which is currently getting used was this but now this will also get deactivated and I will be using this SSH key okay perfect let's come back here as usual I will be doing the same thing I will go back to our repository which is Postman API yeah first of all um just to show you oh all right yes this was our uh earlier repository right now let me create a fresh folder so that I can show you again from the scratch so I will copy this collection I will create a new folder and I will say Postman okay get Ripple and I will paste it here so that new settings that I am going to do I will be doing into this repository into this folder so we'll just copy this I will go to get Bash and now first of all we need to switch back to the directory right so I will set CD and I will just paste it now here when you're working with Git bash make sure you give forward slash okay so let's keep forward slash okay so now you can see right now we're in the same directory okay so we are under desktop under this Ripper now first thing that you need to do again as usual first of all we need a initialize we need to initialize the get repository the moment you say get init you will see that get init is done and we got dot kit files okay so these are the files already available in our directory now the next thing that you need to do you need to just add the file commit the changes add the remote and finally push the changes so same thing what we did just now first of all I will get add Star right now we have only one file so if you want to see just say get status this file is that we need to add this is untracked file so I will say get add just type Co and tab it will show you all the files right now we have only one file hit enter again cross check using git status and you can see early it was in red color it means it was untracked now this is dragged file and it got added to the index now we need to say commits I will say get commit hyphen amp and I will say changes via SSH double quotes hit enter and finally you can see this is the commit message that we added one file changed and this is the file that we have committed perfect so we just need to copy it properly and just right click paste and you can see it says git remote add origin and this is our GitHub repository okay hit enter and it has already added the remote now finally just say push so get pushed hyphen U origin master so already we copied so I will just paste it okay so now this is only one thing or I will say the one type one time activity it says the authenticity of this host okay which is github.com cannot be established do you so this is the rsf key that we have added right it's simply asking do you want to connect simply say yes okay so now what it will do if you just try to read this it says permanently added github.com to the list of known host okay so one thing that you need to notice here earlier we had only these two files right now we have a known host file as well and it has added this particular host which is github.com to the known host it means now whenever you will make any changes from this system to github.com it will easily accept without any issue okay you make any changes now you it will never ask you username pass but you don't need to play with SSH key it is one time activity since it is added on the known host you can keep changing or you can keep pushing the changes from the system perfect if you want to cross check this is uh this was our GitHub repository rate just refresh it and this time if I go back to my settings go to SSH and jpg key and can you see now this key is also acted active now this was inactive when we saw last name and right now it added on this state and this is active perfect now in order to make the changes here same thing uh let me clone this job not clone I will just say copy and this time I will say I want to copy from this and new zip new job should be SSH okay this is the copy feature from Jenkins that you don't need to write everything from scratchy just say um copy from the previous job it will copy everything okay this will be same right because this is the same collection that we are running now instead of giving using https now you can give uh yeah yeah SSH okay so click on code copy this SSH mention it here again for credentials you don't need to worry because this Jenkins will run this collection or they run this job in my system it will clone in my system and since I already have SSH keys in case if I want to make any changes directly from Jenkins as well I can do that since for cloning we don't need any credentials you can continue okay and click on Save click on build now and you will see it will start executing so it has cloned everything it is running now same new man and yes perfectly fine so you can see how easy it is to integrate your Postman collection on GitHub and how you can integrate with Jenkins super easy it is just you need to understand if you come out these commands are already available when you create a blank Repository today in this video we are going to talk about again a very frequent last question should we use Postman or should we use some predefined libraries like in Java we have a rest assured we also have karate we have catalon or you know any other library that you want to use with your programming language let's say if you are working with python then you have a request module right and if you go with JavaScript background again we have a different Library so the no question is should we use only Postman or should we use all these libraries that is available so now let me talk about some of the I will say pros and cons okay then you will get to know that you know why we should go for this or uh to be more precise I will say when to go for Postman and when to go with this Library which is available in the market so now if you have been using Postman then you must be familiar with the postman UI right so Postman is quite easy to use it's like a tool that is available that you need to install just like a exe file so it's very easy to use okay you will get a proper UI where you will get drop downs like which you know which kind of method you want to call get post put battery you can simply put the URL you can give a payload authentications all the header informations you can simply directly fill and you can start doing the API testing right quite easy to use even a fresher or even a non-technical guy can start using Postman right and if you also say Postman have very good features like you can store all these you know your key value pairs in environment you can have multiple environments and you can run them as a collection as well right you can also create some sort of dependency between the test you can also have some test all these features are completely fine okay but what if you have true end-to-end testing okay then here comes the main part so okay so let's say you have one application which includes some sort of web automation then API automation then again you have to test some DB connections you need to verify and finally your test will be completed right in that case Postman will not be that way that useful for you right because postman has a different I will it's a different tool right you will have all the apis in terms of collection that you need to run separately so if you still want to do it like you have to use some kind of CI tool or you have to use some kind of different tools which will integrate all your tests right first it will run your web test then it will run your Postman collection then it will go with the further database testing and then you will be getting your final result but Postman have some I will say restrictions okay so let me point out that but again uh this is my observation if you have a different observations or if you have different opinion I'm just sharing my experience so in case if you have felt the same let me know in the comment section but if you have different opinion that also completely fine still let me know in the comment section now I'm not sure whether you know about this but postmen have two versions okay one is paid and one is community the one which you have seen so far it's Community one right all the features are free but when you go for a you know Enterprise or when it's a large number of tests then the postman also have the different pricings right so if you go to the home page they have listed all the pricing so if I'm not wrong they have free team business and Enterprise so they have different pricings for different requirement now let me talk about something uh related to what I have observed so far there's no framework support right so basically in Postman you can create multiple requests environments collection and they're done but there's no framework right what if I have to create some sort of utility that is not supported so basically I want to say the code duplication right so let's say I want to reuse something that is not possible as of now now if you talk about the reporting so definitely we have a new man right so that will give you the HTML report and you can use something called extra reporter in Postman which will give you again a very good report but what if I want to use some extent report earlier report or some other report which we have downloaded that's not supported as of now it can be done but you have to do a lot of work around for that right now again one more scenario let's say you have a complete test feed okay some data is coming from the web that you want to consume in your API and once you've done the same response you validate in the DB now when it comes to this part Postman will not be the good fit for you because when you go with these libraries let's say rest assured or any of the libraries you have end-to-end control for that so you can get the request you know get the response you can use this response for any other you know integration or if you want to violate against DB you can do that that's not available right now with Postman now when we work with end-to-end automation then we have the different type of data right so sometimes we have Excel file CSV file Json file XML file but right now if you if you have used Postman then we have something called Data variables right so you can basically take the data from CSV format or in the Json format and you can use it but what if you have the different format in that case rest assured or other libraries will be the perfect fit now most important part in automation is like parallel execution right so let's say if you have hundreds of API let's say thousands of API and what if you want to test them in parallel mode so again when you go with the rest assured or these libraries you can achieve parallel more easily but when it comes to postman we don't have much support of panel execution right so you will see some uh if you have a bigger test Suite it will take longer time as compared to these libraries So based on these points you have to decide when to go for Postman and when to go for rest assured again a very important point which I have noticed like Postman uses JavaScript right so let's say your team is well versed with Java or maybe they are very good in Python and if you want to play with a postman then you need only JavaScript so if a team is not comfortable with JavaScript then yes it will be a little challenge for you know few other resources first they have to learn JavaScript and then they can test why so I'm not saying that they have to be expert in JavaScript but yes if they have to write certain assertions then it would be good if they know certain uh you know some concepts of JavaScript so that they can verify the responses in a more better way so what's the conclusion now say guys there's no conclusion as such you have to see uh what kind of project you have so in simple word if you have a small project or medium project even for the larger product if you have independent apis okay and you don't want to achieve parallel execution you don't have big a larger payload plus you don't have any third verification you can go with postpan but if you have to do end-to-one testing and you need to play with the responses you want to pass the responses to different apis different I will say web test or you want to weld it against the DB go with these libraries again this is just my points but you need to decide which tool will be perfect for you so that's all from my side guys in case uh you want to add any point feel free to add in the comment section and in case if you're new to this channel then make sure you subscribe this channel share with your friends and I will see you in the next video have a nice day bye
Info
Channel: Mukesh otwani
Views: 49,270
Rating: undefined out of 5
Keywords: api testing, api testing using postman, api testing interview questions, rest api testing, postman tutorial
Id: BBQrv8RAG0Y
Channel Id: undefined
Length: 207min 51sec (12471 seconds)
Published: Mon Jul 24 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.