Thanks Raghav, your videos are unvaluable for me, I really, really, really appretiate them. God bless you with more health, wisdom and generosity! AMEN!
Thanks Raghav for making things easy for us..just a minor correction i noticed Raghav needs to be printed in response you need to use Name in upper case starting letter.
Am enjoying the tutorials thanks. Maybe at the beginning of each one, put the reason why we use these features? e.g Why do we want to test and add "Hello World" in the text editor? For example, if I'm in Salesforce and importing fields from this file, why would I add extra text?
on windows press windows button + right or left arrow, One screen will be split and then in other section you can select the other screen. To undo you can select maximize button
Hi, I'm getting ERROR while printing log for the Global Environment variable. TypeError: Cannot read property 'get' of undefined let a = console.log(pm.gloabls.get("Env")); console.log(a); Can you please help here? I've tried to find it on web but not giving satisfactory answer.
Hi Dhrumil, Most probably the variables is not getting referenced. Check that you have saved the project and try again. Also check the spelling etc, there should be no trailing spaces. You can also debug as shown here - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ne1RsYcgkSY.html
@@RaghavPal Hi Thanks for replying back. Something Interesting: If you defined Global variable and trying to run with suppose "QA" Environment and trying to print global variable then I'm facing such issue. I'm suspecting Environment issue with defined Global environment variables. But If I'm selecting "No Env" then it works properly. Do you think this is a potential problem/Issue?
Hi Raghav, I am really a fan of your video and love the face that how you go step by step to show ( i.e. how certain actions) just one request if you could please go on a little more slower pace so that its easier to follow along ...thanks a lot for all the effort you put into these videos.
Hi, Pre-request script, as the name suggest will get executed before running the request or before the request hits the server. So it can by used to provide any dynamic values in the request headers/body etc. And anything you want to do programmatically before running the request.
when u set the global and environment variable , the current value gets changed which you can see by clicking on eye symbol . The initial value remains the same.
Yes, the current value is what will be referred in the test request. The initial value is what gets shared with the team, when you share your collection
Hi Raghav, I have set collection variable and user {{url}} in the endpoint but I am getting 'getaddrinfo enotfound' error while sending the request. Could you plz help me on that.
HI Suvro, pls check if the {{url}} is getting resolved. You can check this using postman console - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ne1RsYcgkSY.html Also check this discussion - community.postman.com/t/postman-monitor-error-getaddrinfo-enotfound/3149/12
Hey Raghav, I have been following your tutorials and its been easy so far except for 2:35 I didn't quite understand why we used LET command, if you can please shed some light. Thank you.
Can you let me know the code to sum two variables which were stored as Value1 and Value2 in test section of GET request as I would want to pass on the Sum value on to POST request. Cheers.
Hi Subhash, in general we get the values extracted from response and store them in variables and then you can use these variables in next request and do the calculations as needed, can check some examples online
Can you explain let urlVar portion please? If the variables are stored in urlVar can you tell me the location where it is stored? Also why did you add a + in the console.log(); line.
Hi Renu, let me first inform on +, it is used for concatenation that is joining, so on the console we can see the complete information. On variables, this will help Priority : priority is as follows: - local - data - environment - collection - global - Global - pm.globals.set() - pm.globals.get() - Env - pm.environment.set() - pm.environment.get() pm.variables is for local variables for e.g. pm.variables.set("variable_key", "variable_value"); Local variables are temporary values you set in your request scripts. Also //access a variable at any scope including local pm.variables.get("variable_key"); //access a global variable pm.globals.get("variable_key"); //access a collection variable pm.collectionVariables.get("variable_key"); //access an environment variable pm.environment.get("variable_key");
Hi Prachi, The diff is as follows: 1. Scope- Environment variables can be accessed with the corresponding environments. Global variables can be accessed broadly regardless of the selected environment. 2. Priority : priority is as follows: - local - data - environment - collection - global So in case a global variables shares same name with an environment variables, at runtime value will be referenced from env variable 3. Getting & Setting variables through scripts - Global - pm.globals.set() - pm.globals.get() - Env - pm.environment.set() - pm.environment.get() learning.getpostman.com/docs/postman/environments_and_globals/intro_to_environments_and_globals/ pm.variables is for local variables for e.g. pm.variables.set("variable_key", "variable_value"); Local variables are temporary values you set in your request scripts. Also //access a variable at any scope including local pm.variables.get("variable_key"); //access a global variable pm.globals.get("variable_key"); //access a collection variable pm.collectionVariables.get("variable_key"); //access an environment variable pm.environment.get("variable_key");
Hi Rahul, I have 2 doubts, 1) Do we need to know JavaScript for Postman Automation Testing? If Yes, Basic javascript like that we use (java for selenium) or we need to know in depth of java script? Do Postman Rest API has lots of coding? 2) my friend got interview to test API like, They given the website and they going to add a editor to their existing website. So they asked to do Rest API Testing. I dont understand the clear picture of her interview. She has 0 knowledge when she got interview.so we couldn't discuss about more. What will be the overall picture. any idea?
Hi Akalya, 1) Basic knowledge of JS will be good for starting. You should be ready to learn more if required. 2) APIs work at the backend of your UI. So when you send some request by clicking something on the UI, its an API request at the backend that goes to server, The server sends the response, which is formatted and shown on the UI. So basically when you do API testing, You will send the request with diff parameters combination and assert the response. You can also do performance testing of the api to check response time
Hi Senali, there can be several use-cases like sometimes we may need to capture value from a response and store it in a variable and use it in a later request. Sometimes we need to generate some random value everytime.. etc
Hi, Raghav One question.. I have multiple GET requests in one folder and some of the GET requests have pre-request scripts and test scripts. Now, the question is, when I run only one GET request and open console at the same time, I see that all the pre-request scripts of all GET requests ran and test scripts of all GET requests as well. How do I run an individual request without other GET requests tagging along?
Hi Raghav, thanks for the amazing tutorial. Whats the best way to learn Java script? Do you have tutorial for this? How good we need to be at coding to use Postman effectively?
Hi Priyanka To set the value for an API request parameter through a test script in Postman, you can follow these steps: 1. Create a new Postman collection. 2. In the collection, create a new request. 3. In the request, set the parameter that you want to set the value for. 4. Create a new test script for the request. 5. In the test script, set the value of the parameter. 6. Save the collection and the test script. Here is an example of a test script that sets the value of the name parameter to Robert Downey Jr.: Code snippet function testSetParam() { var request = this.request; request.url = request.url + "?name=" + "Robert Downey Jr."; } This test script will set the value of the name parameter to Robert Downey Jr.. To run the test script, you can right-click on the request and select "Run". Here are some additional things to keep in mind: * The test script will be run when the request is sent. * The test script will be run in the context of the request. * The test script can access the request object. I hope this helps
It shows syntax error in this line:- Let urlVar = pm.variables.get("URL"); but what you taught in this lecture i've using the same code here but it has syntax error
HI Raghav. I am trying to set variable value in collection: pm.variables.set("resource", "maps"); console.log(pm.variables.get("resource")); In Postman console, I am getting maps but i am opening collection then Variables but i am not getting variable with value. please suggest me
Hi Shwetha, ideally this should not be allowed, but I know you can create global variables with same name. When you refer the variable created last will be referred. Now logically speaking, if you have the variable with same name & value, when you call or refer the variable, it will anyways not matter which variable is getting called as you will get the same value,
Hello Raghav. In the video, at 1:49, in the console, Hello World... is printed without quotes. However, for me, it printed in the console with quotes, as "Hello World." Am I doing something wrong here? Also, is the code in the Tests tab JSON or JS? Also, in pm.variables.get or set, does pm stand for postman?
Hi, brilliant videos thankyou. You set name variable using pm.variables.set but name was a global variable? I'm getting errors and wondering if it is because I'm trying to set it at script level when name is not defined at script level. Should it be pm.globals.set in your video? I'm not sure how this worked for you without errors?
Hi Steve, Here is the script for setting variables - Global - pm.globals.set() - pm.globals.get() - Env - pm.environment.set() - pm.environment.get() - Step/Request - pm.variables.set - pm.variables.get
Hello Raghav, This is really wonderful explaination about API passing values. But i have one requirement in project. How I can Pass Global Environement Variable from One Post Call Response to Another Post Call Request Body? It wont take Parameter i have to send via Request Payload in .NET Zero Architecture. Urgent Suggestion and Help Needed!
Can you show us how to pass a variable in a test. I have a test pm.test("mode", function () { pm.expect(pm.response.text()).to.include('"mode":"AIR"'); }); Instead of AIR I want to pass a global variable. How can I do that? Thanks
@@RaghavPal I tried that it did not work, but no problem. I got it figured. Here is the solution - bodyData = JSON.parse(responseBody) var modeV1 = bodyData.features[0].properties.mode console.log(modeV1) pm.test("mode_ver", function () { pm.expect(pm.response.text()).to.include('"mode":"'+modeV1+'"') }); The variable is local at the moment and I will be setting it as a global variable, I think it would work now.
Thank you for the video Could you please give a real example for the purpose of using global and collection variables? what is the actual purpose of setting and getting variables... and I don't understand when we should use the get and set whether at collection or global level. Thank you
Hi Huda, we can use variables whenever there are places where we need to use dynamic data i.e. data can change based on scenarios. Now if the data needs to be changed at a global level we can use global variables
Hi Olive, pm.variables is for local variables for e.g. pm.variables.set("variable_key", "variable_value"); Local variables are temporary values you set in your request scripts. Also //access a variable at any scope including local pm.variables.get("variable_key"); //access a global variable pm.globals.get("variable_key"); //access a collection variable pm.collectionVariables.get("variable_key"); //access an environment variable pm.environment.get("variable_key");
Hi Sindiya, Getting & Setting variables through scripts - Global - pm.globals.set() - pm.globals.get() - Env - pm.environment.set() - pm.environment.get() learning.getpostman.com/docs/postman/environments_and_globals/intro_to_environments_and_globals/ pm.variables is for local variables for e.g. pm.variables.set("variable_key", "variable_value"); Local variables are temporary values you set in your request scripts. Also //access a variable at any scope including local pm.variables.get("variable_key"); //access a global variable pm.globals.get("variable_key"); //access a collection variable pm.collectionVariables.get("variable_key"); //access an environment variable pm.environment.get("variable_key");
Hi Alok, pm.variables is for local variables for e.g. pm.variables.set("variable_key", "variable_value"); Local variables are temporary values you set in your request scripts. Also //access a variable at any scope including local pm.variables.get("variable_key"); //access a global variable pm.globals.get("variable_key"); //access a collection variable pm.collectionVariables.get("variable_key"); //access an environment variable pm.environment.get("variable_key");
Hi Fachrizal, you can use *typeof()* function. This will help you stackoverflow.com/questions/48776821/postman-how-to-check-the-data-type-of-each-value-in-a-response stackoverflow.com/questions/42973515/how-to-check-the-field-data-type-only-using-postman/42992446 community.postman.com/t/check-datatype-of-a-response-body/13804
Hi ragav, For this test scripting which you used is ? And which one we need to learn for these scripting.. and for automation.kindly let us know. -Does this set property updates the variable value to the collection level?? Or only within the no of test it updates? Thanks in advance
Hi Judy, 1. Scope- Environment variables can be accessed with the corresponding environments. Global variables can be accessed broadly regardless of the selected environment. 2. Priority : priority is as follows: - local - data - environment - collection - global So in case a global variables shares same name with an environment variables, at runtime value will be referenced from env variable 3. Getting & Setting variables through scripts - Global - pm.globals.set() - pm.globals.get() - Env - pm.environment.set() - pm.environment.get() learning.getpostman.com/docs/postman/environments_and_globals/intro_to_environments_and_globals/
@@RaghavPal Thanks Raghav for your reply. All of your tutorials have been of great help and blessing to me. I do have one more question on the Priority, what do you mean data variable. is the data got from a data file?
Rag - I'm getting a "Syntax error: unexpected identifier" error here and I'm not seeing what it is. Can you help? console.log("Hello World..."); Let urlVar = pm.variables.get("url"); console.log ("Value for url variable is:" +urlVar);
great video. Thumbs up !!! do you also have an explanation on how it looks like when I let say do get an auth token back from login and wanna have thisvalue of the auth token set to an env variable, so I can use it.
Hi Raghav, how to update environment variable value from body variables? for e.g: I am hitting update my profile API in which I am updating my name in body, and in response body, it's only showing me a message "Updated profile successfully".
Hi Raghav just curious to know if this is beginner tutorial do u have anything like an intermediate and expert video also for postman. Just asking as i already checked jmeter series of videos (Beginner-Intermediate-Expert)
Hi Sviatoslav, Pre-request scripts will run before the test and tests scripts run after the test execution. So you can see it like in case you need to do any setup before running the test you can put those scripts in pre-request scripts
@@RaghavPal Hi Raghav. Thanks for the update. Could you please give an example of such case? I am trying to figure out how I would manage that and what would be the purpose. Thanks.
Hi Raghav, Thank you for your help. I have one question. I have set the Global variable value in the script. In the quick look, it shows the updated variable value. I am facing a "Reference error: variable not defined" error when trying to print in the console log. this is my script pm.globals.set("name1", "tony"); let globalVar= pm.globals.get(name1); console.log("changed value: "+globalVar); Please, can you help me? Thanks
Hi Abhishek, You need basic knowledge and as you work you can explore more if required in your scenario. Can check JS tutorials here - automationstepbystep.com/
Hi Aayush, Variables can be created at the following locations Global Collection Environment Data Local Can find more here - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-5aMqyXZRvxg.html
Hi Mutele, by any chance are you using the chrome extension of Postman. Also check this - stackoverflow.com/questions/46243745/postman-scripts-pm-is-not-defined
Hi , please view this I am getting the syntax error for this script... Collection is running well without this script... console.log("twinkle"); Let urlVar = pm.variables.get("url"); console.log("Valuse of url is" + urlVar);
Hi Raghav I have a doubt in running collections, I have headers and parameters for all the request I am sending and it is same for all How can I set Universal parameter and Headers for all the API I run?
Hi Sharana, pls see if this is something you want github.com/postmanlabs/postman-app-support/issues/1947 community.getpostman.com/t/setting-headers-for-entire-collection-folder/708/7
I defined an environment variable as url and able to fetch its value using the command - : let urlVar=pm.variables.get("url"); So it seems that without using the pm.environment.get("variablename") I can get the value. Please correct me if my understanding is wrong.
Okay, that means pm.variables.get("variableName") command works for env variable as well. I will also check the same. You can continue with other videos.
Hi Elijah, You can check it here for XML - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-jXbg5OE1uyE.html for JSON - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9FHVKaIs8cQ.html
Hi Jean! I received the same error and realized the "L" should be lowercase and not capital. When I changed Let to let I was able to successfully send the API request. Hopes this helps as I am a novice at this. I am learning a lot from Raghav's videos. Thanks Raghav!
Hi, you will need to understand scope of variables 1. Scope- Environment variables can be accessed with the corresponding environments. Global variables can be accessed broadly regardless of the selected environment. 2. Priority : priority is as follows: - local - data - environment - collection - global So in case a global variables shares same name with an environment variables, at runtime value will be referenced from env variable 3. Getting & Setting variables through scripts - Global - pm.globals.set() - pm.globals.get() - Env - pm.environment.set() - pm.environment.get() learning.getpostman.com/docs/postman/environments_and_globals/intro_to_environments_and_globals/
Hi Sayma, I thought of writing this in my language but then I found these very useful links. This should make it clear auth0.com/learn/refresh-tokens/ stackoverflow.com/questions/3487991/why-does-oauth-v2-have-both-access-and-refresh-tokens
Hi Kavi, this is created for both manual and automation testing with TestProject. The scripting part also can be used in manual if required. You can find all here - automationstepbystep.com/
Hi Kavi, wrt Postman, if you are setting up your requests and then running them manually i.e. a user is required to run and check the result and then do the reporting, it will be manual. If you setup scripts and solutions and do integrations in a way that all testing can be triggered on its own without human intervention, it will be automation
@@RaghavPal thanks raghav ,much appreciated, i did see your course in UDEMY as well,they were nice.keep going.also one last thing pls help us as a beginner in testing which site is good for doing freelancing .
Automation Step by Step - Raghav Pal thank you .. I searched lot for JavaScript tutorial of yours but unable to find Can you please help and assist us on JavaScript tutorial as well