Тёмный

POSTMAN BEGINNER TUTORIAL 7 💡 How to set and get VARIABLES through SCRIPTING 

Automation Step by Step
Подписаться 528 тыс.
Просмотров 277 тыс.
50% 1

Опубликовано:

 

6 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 255   
@RaghavPal
@RaghavPal 5 лет назад
Online courses - automationstepbystep.com/
@hindustani7566
@hindustani7566 4 месяца назад
The way he covers basics, tackling Advance level becomes so easy
@RaghavPal
@RaghavPal 4 месяца назад
Glad to know this is helping
@nandinigami7511
@nandinigami7511 Год назад
I've been watching this playlist from the beginning & i love how easy it is to follow you. thank you! I appreciate it! :)
@RaghavPal
@RaghavPal Год назад
Thanks Nandini
@Cmart6444
@Cmart6444 6 лет назад
Thanks Raghav, your videos are unvaluable for me, I really, really, really appretiate them. God bless you with more health, wisdom and generosity! AMEN!
@RaghavPal
@RaghavPal 6 лет назад
Thanks for watching and letting me know.
@leonardohernandez9804
@leonardohernandez9804 6 лет назад
Your videos are clear and easy to undestand! Gracias !
@faizalahamed3396
@faizalahamed3396 3 года назад
Thanks Raghav, the way you are creating sessions are really inspiring and helpful... really appreciated and give your best!! always
@RaghavPal
@RaghavPal 3 года назад
Thanks Faizal
@usmansaid4306
@usmansaid4306 2 года назад
Very Awesome way of Teaching. && Environment, I also spell it in the way you spelled.
@RaghavPal
@RaghavPal 2 года назад
Thank you Usman
@mohitgupta3201
@mohitgupta3201 2 года назад
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.
@RaghavPal
@RaghavPal 2 года назад
I will check Mohit
@JDKnider
@JDKnider 6 лет назад
This is really nice work! Very useful, clear and easy to follow!
@RaghavPal
@RaghavPal 6 лет назад
Thanks for your message JD
@fredericklane745
@fredericklane745 4 года назад
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?
@RaghavPal
@RaghavPal 4 года назад
Hi Frederick, sure I will take note of this
@Forex_trader_in
@Forex_trader_in 6 лет назад
Clear and helpful, please let me know how to split the screen.. Thanks
@RaghavPal
@RaghavPal 6 лет назад
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
@DhrumilSoni812
@DhrumilSoni812 4 года назад
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.
@RaghavPal
@RaghavPal 4 года назад
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
@DhrumilSoni812
@DhrumilSoni812 4 года назад
@@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?
@RaghavPal
@RaghavPal 4 года назад
May be, will need to confirm
@md.mahfuzulhuqtalukder6644
@md.mahfuzulhuqtalukder6644 4 года назад
You are the best.
@RaghavPal
@RaghavPal 4 года назад
Humbled to see your message Mahfuzul
@gauravdalvi9288
@gauravdalvi9288 5 лет назад
Thank you for video. can you please specify which language we use in PM scripting ?
@RaghavPal
@RaghavPal 5 лет назад
Hi Gaurav, its JavaScript
@pcginfo7270
@pcginfo7270 5 лет назад
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.
@RaghavPal
@RaghavPal 5 лет назад
Thanks for your message. I will take a note of this.
@TheSnehal23
@TheSnehal23 3 года назад
Thank You so much sir for making this series
@RaghavPal
@RaghavPal 3 года назад
Most welcome Snehal
@lts8683
@lts8683 2 года назад
Thanks Raghav
@RaghavPal
@RaghavPal 2 года назад
most welcome
@kamalpreetkaur8247
@kamalpreetkaur8247 4 года назад
When a tutorial is for beginner, plz explain code you are writing. How can a beginner know what is pm.variable.get
@RaghavPal
@RaghavPal 4 года назад
Thanks for the feedback Kamal. I will take are of this. For now if you require there is a separate tutorial on JavaScript automationstepbystep.com/
@hexatorus5452
@hexatorus5452 10 месяцев назад
Extremely helpful series!
@RaghavPal
@RaghavPal 10 месяцев назад
Glad it was helpful Hexa
@aravapallimanikanta1378
@aravapallimanikanta1378 6 лет назад
What is the use of pre request scripts & when we are going to use them??? Can you explain with some examples??
@RaghavPal
@RaghavPal 6 лет назад
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.
@aravapallimanikanta1378
@aravapallimanikanta1378 6 лет назад
Do these scripts will affect the API response/performance while we run it (or) It will execute irrespective of the API? -Thanks!!
@RaghavPal
@RaghavPal 6 лет назад
These should not impact the api performance (response time)
@JiminPark-ld2xx
@JiminPark-ld2xx 3 года назад
Can you do more videos on this and parameter settings on Postman? Thank You. So far it helped me a lot.
@RaghavPal
@RaghavPal 3 года назад
Hi Jimin, I will do, Can check more here - automationstepbystep.com/
@JiminPark-ld2xx
@JiminPark-ld2xx 3 года назад
@@RaghavPal Thanks
@omkarkhatavkar3650
@omkarkhatavkar3650 4 года назад
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.
@RaghavPal
@RaghavPal 4 года назад
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
@suvromukherjee4198
@suvromukherjee4198 3 года назад
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.
@RaghavPal
@RaghavPal 3 года назад
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
@harisahmed4269
@harisahmed4269 3 года назад
Thank you Sir! Much appreciated.
@RaghavPal
@RaghavPal 3 года назад
most welcome Haris
@bankuruvasavilatha5092
@bankuruvasavilatha5092 5 лет назад
Voice is clear and good communication 👍😊👍
@RaghavPal
@RaghavPal 5 лет назад
Thanks Bankuru
@bankuruvasavilatha5092
@bankuruvasavilatha5092 5 лет назад
Good explanation
@renujoshi3935
@renujoshi3935 3 года назад
Regarding setting variables -> can you tell where these variables are set?
@RaghavPal
@RaghavPal 3 года назад
There are diff scope Renu Priority : priority is as follows: - local - data - environment - collection - global
@mohanish3169
@mohanish3169 2 года назад
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.
@RaghavPal
@RaghavPal 2 года назад
let is a keyword to declare variables in JavaScript Older way is var, both can work
@kiranjape3941
@kiranjape3941 4 года назад
Thanks for this valuable session.
@RaghavPal
@RaghavPal 4 года назад
Most welcome Kiran
@feliks_magnificentbrowniez
@feliks_magnificentbrowniez 3 года назад
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.
@RaghavPal
@RaghavPal 3 года назад
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
@renujoshi3935
@renujoshi3935 3 года назад
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.
@RaghavPal
@RaghavPal 3 года назад
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");
@prachimuddapur
@prachimuddapur 4 года назад
Hi Raghav, slightly confused between how an environment variable differs from global variable?
@RaghavPal
@RaghavPal 4 года назад
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");
@akalyamohan2023
@akalyamohan2023 4 года назад
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?
@RaghavPal
@RaghavPal 4 года назад
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
@akalyamohan2023
@akalyamohan2023 4 года назад
@@RaghavPal Thank you so much
@washingtonmugo2253
@washingtonmugo2253 3 года назад
this was such a bliss
@RaghavPal
@RaghavPal 3 года назад
Thanks
@devanand5861
@devanand5861 3 года назад
Useful video..How could I use environment variable in my test script for verification? I need to reverify if my response body contains "hello welcome"
@RaghavPal
@RaghavPal 3 года назад
Hi Dev, you just need to refer the end variables with the syntax pm.environment.get("variable_key"); Ensure to select the env before execution
@devanand5861
@devanand5861 3 года назад
Thanks.
@senalihasanika6029
@senalihasanika6029 3 года назад
Hi Raghav why we use" set and get VARIABLES through SCRIPTING" I mean what is the purpose of doing this
@RaghavPal
@RaghavPal 3 года назад
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
@senalihasanika6029
@senalihasanika6029 3 года назад
@@RaghavPal Thanks
@toy2413
@toy2413 4 года назад
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?
@RaghavPal
@RaghavPal 4 года назад
Hi Yogini, I believe you have added the pre-request scripts and test scripts at the folder level. Add them at the individual request level
@HK-os8tj
@HK-os8tj 5 лет назад
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?
@RaghavPal
@RaghavPal 5 лет назад
Hi H K, you should be knowing the basics. As of now no, but I will be creating soon. For now you can get online help.
@PramodChamlingRai
@PramodChamlingRai 4 года назад
can you make python tutorial? its way easier to learn from your channel. so impressed
@RaghavPal
@RaghavPal 4 года назад
So happy to know, You can find Python here - automationstepbystep.com/
@user-rt3lt4tw7p
@user-rt3lt4tw7p Год назад
hello Raghav, help me what i have to do in the skill check where they are asking me to set a variable for favorite actor and his name through test?
@RaghavPal
@RaghavPal Год назад
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
@user-rt3lt4tw7p
@user-rt3lt4tw7p Год назад
@@RaghavPal thank you so much for responding me..:)
@vigneshrino1399
@vigneshrino1399 4 года назад
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
@RaghavPal
@RaghavPal 4 года назад
Hi Vignesh, May be some space or semi colon missing in the earlier line.
@AndyGrem
@AndyGrem 4 года назад
You are typing the Test Code with no explanation whatosever what it does. Great...
@RaghavPal
@RaghavPal 4 года назад
Sorry for that Andrew, I will plan a session with more inputs
@AndyGrem
@AndyGrem 4 года назад
@@RaghavPal Thank's. Waiting for that)
@maheshjakka7371
@maheshjakka7371 2 года назад
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
@RaghavPal
@RaghavPal 2 года назад
Hi Mahesh, if you are setting during execution (at runtime) the value will be available duing the runtime session only
@shwethabj6539
@shwethabj6539 3 года назад
Hi Raghav, If I have 2 global verible with same name and same value, which one will script use while executing
@RaghavPal
@RaghavPal 3 года назад
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,
@pblintso
@pblintso 4 года назад
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?
@RaghavPal
@RaghavPal 4 года назад
Hi Polina, what is your script. Pls show me. Yes pm is for postman
@pblintso
@pblintso 4 года назад
@@RaghavPal console.log("Hello World..."); let varURL = pm.variables.get("url"); let varURL2 = pm.variables.get("url2"); console.log("Value of varURL is " + varURL); console.log("Value of varURL2 is " + varURL2); pm.variables.set("name", "POSTMAN"); console.log(pm.variables.get("name")); let glo_var = pm.globals.get("globalVar"); console.log(glo_var); pm.environment.set("env_var", "environment_variable"); console.log(pm.variables.get("env_var"));
@RaghavPal
@RaghavPal 4 года назад
Hi Polina this looks fine to me. May be some console updates. For now continue with rest of the tutorials. Will let you know if I find something
@pging8328
@pging8328 4 года назад
Thx for the tutorials. Is the scripting language JavaScript?
@RaghavPal
@RaghavPal 4 года назад
Yes
@stevenclark1973
@stevenclark1973 5 лет назад
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?
@RaghavPal
@RaghavPal 5 лет назад
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
@lowrencek3592
@lowrencek3592 4 года назад
Raghav, the autocomplete is set correctly in Settings, Still I dont get the autocomplete. Pls suggest.
@RaghavPal
@RaghavPal 4 года назад
Hi Lawrence, pls try to restart Postman and check
@ankitprajapati6382
@ankitprajapati6382 3 года назад
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!
@RaghavPal
@RaghavPal 3 года назад
Hi Ankit, in general we use variables for this, I will need to check more for your scenario
@TheAnu1998
@TheAnu1998 2 года назад
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
@RaghavPal 2 года назад
Hi Anupreet, you can use double curly brackets {{global_var}}, can also get global variables with script - pm.globals.get()
@TheAnu1998
@TheAnu1998 2 года назад
@@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.
@johng5295
@johng5295 4 года назад
Thanks in a million.
@RaghavPal
@RaghavPal 4 года назад
You're welcome John
@hudakhaled8353
@hudakhaled8353 5 лет назад
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
@RaghavPal
@RaghavPal 5 лет назад
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
@olivegetsy8742
@olivegetsy8742 2 года назад
pm.variables.set("Name", "POSTMAN"); - Where does it stored whether in collection's variable or global variable
@RaghavPal
@RaghavPal 2 года назад
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");
@sindiyarajan3440
@sindiyarajan3440 4 года назад
Hello Raghav. Thank you so much for such great videos. Could you please tell me how and where do we use the local variables 'set' in the script?
@RaghavPal
@RaghavPal 4 года назад
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");
@praneethgandra9630
@praneethgandra9630 4 года назад
@@RaghavPal Thanks Raghav
@saiphanideep6788
@saiphanideep6788 4 года назад
hi bro.....TypeError: Cannot read property 'get' of undefined this error is coming what to do
@RaghavPal
@RaghavPal 4 года назад
Hi Sai, Try to print where you are trying to do a get. May be the variables is empty.
@priyankapandey6098
@priyankapandey6098 4 года назад
Thanks for the tutorial.
@RaghavPal
@RaghavPal 4 года назад
You're welcome Priyanka
@alokkumar4485
@alokkumar4485 4 года назад
what is the difference between pm.variables and pm.globals. where the variable is set when executing pm.variables?
@RaghavPal
@RaghavPal 4 года назад
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");
@fachrizalmasugi8703
@fachrizalmasugi8703 4 года назад
sir i wnna ask, how we make sure we have a correct data-type from API the datas like: ID -> Integer name-> String ty if u notice this.
@RaghavPal
@RaghavPal 4 года назад
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
@hemanthgowda5930
@hemanthgowda5930 4 года назад
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
@RaghavPal
@RaghavPal 4 года назад
Hi Hemanth, it is JavaScript. You can get all information on this in this video - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-6SzYhuVY8Jg.html
@amityeh
@amityeh 4 года назад
Hi, Is it possible to set a global variable by a value obtained in the result (the result is inJSON format)?
@RaghavPal
@RaghavPal 4 года назад
Yes, you can Amit, Check this - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-HHASdmCR1bE.html
@umairaslam466
@umairaslam466 6 лет назад
awesome chain of lectures (Y)
@RaghavPal
@RaghavPal 6 лет назад
Thanks for watching Umair
@kiranbastwad8178
@kiranbastwad8178 4 года назад
Hi Raghav, What is difference between scripting in Test level and scripting in pre request level
@RaghavPal
@RaghavPal 4 года назад
Scripts in Pre-request sections gets executed before running the api request, Tests section is executed after we receive the response.
@rajeshd579
@rajeshd579 4 года назад
Hi Raghav, Thanks for this video and i don't understand how to run the test after coding what is the command to run the code? Please reply.
@RaghavPal
@RaghavPal 4 года назад
Hi Rajesh, You can run the collection using collection runner
@JudyMendes
@JudyMendes 5 лет назад
Hi Raghav, what is the scope of the different variables defined at the Collection, global and environment level.
@RaghavPal
@RaghavPal 5 лет назад
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/
@JudyMendes
@JudyMendes 5 лет назад
@@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?
@RaghavPal
@RaghavPal 5 лет назад
Hi Judy, that's right, see this - learning.getpostman.com/docs/postman/environments_and_globals/variables/#data-variables
@debanjandas4957
@debanjandas4957 4 года назад
What does pm in pm.variables.get stand here?
@RaghavPal
@RaghavPal 4 года назад
PostMan
@accountingmarketjd275
@accountingmarketjd275 4 года назад
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);
@RaghavPal
@RaghavPal 4 года назад
Hi, can you check if l should be lower case in let. It should also be mentioned in the detailed logs
@accountingmarketjd275
@accountingmarketjd275 4 года назад
@@RaghavPal My apologies. I think the font made it look like a capitalized L but it was indeed a lower-case. Thx
@rickmedlin5389
@rickmedlin5389 3 года назад
When I print out my variables, they have quote marks around them in the log, whereas yours do not. Is there some setting to change that?
@RaghavPal
@RaghavPal 3 года назад
Hi Rick, check this community.postman.com/t/how-to-escape-double-quote-when-setting-using-variables/13505
@juergenschubert3247
@juergenschubert3247 4 года назад
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.
@RaghavPal
@RaghavPal 4 года назад
Hi Juergen, this may help you - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-HHASdmCR1bE.html
@thirstyhammad
@thirstyhammad 4 года назад
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".
@RaghavPal
@RaghavPal 4 года назад
Hi Hammad, you will need to capture and store the value and update in the variable. Now have to find where exactly you can extract value from
@gokulrao8984
@gokulrao8984 5 лет назад
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)
@RaghavPal
@RaghavPal 5 лет назад
Hi Gokul, as of now for Postman this is the only series, I will make another soon. You can check all here - automationstepbystep.com/online-courses/
@rajuboine
@rajuboine 3 года назад
When trying to create an Environment variable from the script, I am seeing an error as "newEnvVar is not defined".
@RaghavPal
@RaghavPal 3 года назад
Hi Yashvi, after creating a env variable Save and then try
@sviatkey
@sviatkey 5 лет назад
Please clarify: what means/does "Pre-request scripts" tab? How it helps us in a case when we have "Tests" tab for that?
@RaghavPal
@RaghavPal 5 лет назад
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
@sviatkey
@sviatkey 5 лет назад
@@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.
@RaghavPal
@RaghavPal 5 лет назад
I believe I covered this in a video in the playlist. Pls check
@greatadmire4730
@greatadmire4730 4 года назад
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
@RaghavPal
@RaghavPal 4 года назад
Hi, just ensure that you have saved after setting global variable.
@bharathchinni6168
@bharathchinni6168 5 лет назад
What are different Scripting languages that we can use Postman? I think u write scripts using JavaScript right?
@RaghavPal
@RaghavPal 5 лет назад
That's right Bharath
@abhishekthomas7799
@abhishekthomas7799 4 года назад
Hi Raghav, How much JS knowledge is required for postman?
@RaghavPal
@RaghavPal 4 года назад
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/
@abhishekthomas7799
@abhishekthomas7799 4 года назад
@@RaghavPal Thanks. Does pm stands for postman here?
@RaghavPal
@RaghavPal 4 года назад
Yes Abhishek
@aayushnehra9813
@aayushnehra9813 4 года назад
Hi, when we set vairables where are the variables stored? I tried to look for them in the collection and in the global scope. I was unable to find it.
@RaghavPal
@RaghavPal 4 года назад
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
@Eboo
@Eboo 5 лет назад
pm is not defined is the error I am getting. Am i supposed to define it earlier on before attempting to write the code?
@RaghavPal
@RaghavPal 5 лет назад
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
@DucNguyen-xn5bd
@DucNguyen-xn5bd 5 лет назад
missing subtitle for this video. However, thank you so much for your helpful video
@RaghavPal
@RaghavPal 5 лет назад
Hi Duc, yes it's not automatically generated. Thanks for watching.
@mathewjohn9092
@mathewjohn9092 5 лет назад
Can you pls share the link of your video Postman Beginner Tutorial- API chaining
@RaghavPal
@RaghavPal 5 лет назад
Pls find video 18 here - ru-vid.com/group/PLhW3qG5bs-L-oT0GenwPLcJAPD_SiFK3C
@delightful730
@delightful730 4 года назад
Need Swagger documentation tutorial plz
@RaghavPal
@RaghavPal 4 года назад
I will plan on this
@twinklevarshney4854
@twinklevarshney4854 4 года назад
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);
@RaghavPal
@RaghavPal 4 года назад
Hi Twinkle, I believe let should be with lowercase L
@twinklevarshney4854
@twinklevarshney4854 4 года назад
Ahaa ..thank you so much for response 🤟
@pogo3332
@pogo3332 4 года назад
Am getting Type error in console,let me know wat s d mistake.
@RaghavPal
@RaghavPal 4 года назад
Is it in the scripting, ls check on the postman console - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ne1RsYcgkSY.html
@sharanarani6800
@sharanarani6800 5 лет назад
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?
@RaghavPal
@RaghavPal 5 лет назад
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
@NaveenSharma069
@NaveenSharma069 5 лет назад
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.
@RaghavPal
@RaghavPal 5 лет назад
Hi Naveen, I will re-check this, Pls check do you have any local or collection variable with same name
@NaveenSharma069
@NaveenSharma069 5 лет назад
@@RaghavPal thanks Raghav. I did not setup any local variable with such name.
@RaghavPal
@RaghavPal 5 лет назад
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.
@JaNaMSoNi
@JaNaMSoNi 6 лет назад
Whatever. Command you have written are just only for postman ? Or any specific programming language command?
@RaghavPal
@RaghavPal 6 лет назад
these commands starting with pm are for postman.
@ravivishwakarma7786
@ravivishwakarma7786 Год назад
What is pm in console
@RaghavPal
@RaghavPal Год назад
postman
@elijahshackelford3746
@elijahshackelford3746 5 лет назад
Hi Raghav- Quick question: How would I take the response to one query to be used as the input of the next API query?
@RaghavPal
@RaghavPal 5 лет назад
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
@kavivenky6216
@kavivenky6216 4 года назад
@@RaghavPal this says that "the video is private ":(
@gazalbhullar2464
@gazalbhullar2464 3 года назад
Hi Raghav, do you any tutorial on RestAssured API?
@RaghavPal
@RaghavPal 3 года назад
Hi Gazal, yes, pls check here - automationstepbystep.com/
@Garisons
@Garisons 6 лет назад
Hi Raghav, The get and set works well, but I am having an error with Let. It gives me a red cross. Missing ";" before the statement
@RaghavPal
@RaghavPal 6 лет назад
Hi Jean, will need more info/logs on this to troubleshoot
@RaghavPal
@RaghavPal 6 лет назад
Hi Jean, will need more details/logs to troubleshoot
@kimberley4883
@kimberley4883 5 лет назад
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!
@dotnettitbits8517
@dotnettitbits8517 5 лет назад
What is the difference between pm.globals.set() and pm.environment.set() ??
@RaghavPal
@RaghavPal 5 лет назад
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/
@dotnettitbits8517
@dotnettitbits8517 5 лет назад
@@RaghavPal Thanks !
@saifalisanadi6519
@saifalisanadi6519 4 года назад
Which language are you using in test code
@RaghavPal
@RaghavPal 4 года назад
Its JavaScript
@iamthekd07
@iamthekd07 4 года назад
I don't know how to get/set variables for pm.environment?
@RaghavPal
@RaghavPal 4 года назад
Hi Kuldeep, try the examples shown, Let me know if you face any issues
@iamthekd07
@iamthekd07 4 года назад
Sorry I asked that question before watched full video
@iamthekd07
@iamthekd07 4 года назад
Raghav need your help regarding my question - what is token exactly ? Actually this question is asked so many times by interviewers
@SS_Cooking
@SS_Cooking 5 лет назад
Sir will you please tell me the actual difference between Access token and Refresh token?
@RaghavPal
@RaghavPal 5 лет назад
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
@SS_Cooking
@SS_Cooking 5 лет назад
@@RaghavPal thank you so much sir
@jeeturanjan1271
@jeeturanjan1271 4 года назад
where we can see the set variable (POSTMAN) in request?
@RaghavPal
@RaghavPal 4 года назад
Hi Jeetu, you just the variable using this command. If required you can do get and print on console to verify
@nsaiprasad8462
@nsaiprasad8462 4 года назад
i am getting this error "TypeError: Cannot read property 'get' of undefined" why?
@RaghavPal
@RaghavPal 4 года назад
I see your other comment and looks like you found the solution. Pls put it here to help others
@kavivenky6216
@kavivenky6216 4 года назад
hi, is this automation Api testing? or manual api testing? if im not wrong your writing scripts so it is automation rite?
@RaghavPal
@RaghavPal 4 года назад
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/
@kavivenky6216
@kavivenky6216 4 года назад
@@RaghavPal then wat is the difference between manual api and automation api? pls help
@RaghavPal
@RaghavPal 4 года назад
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
@kavivenky6216
@kavivenky6216 4 года назад
@@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 .
@RaghavPal
@RaghavPal 4 года назад
Can check upwork
@testercms2407
@testercms2407 4 года назад
is that java script y ou are using for test?
@RaghavPal
@RaghavPal 4 года назад
Yes
@lisazhou7776
@lisazhou7776 5 лет назад
what's PM stands for? like to know how to assert a value. thanks.
@RaghavPal
@RaghavPal 5 лет назад
its PostMan
@suwarnasonawane6480
@suwarnasonawane6480 5 лет назад
@@RaghavPal I am also looking for same Answer. Thanks!
@supriyapawar8417
@supriyapawar8417 6 лет назад
Hi Raghav, Can you please tell us which scripting language you are using here
@RaghavPal
@RaghavPal 6 лет назад
Hi Supriya, its Javascript
@supriyapawar8417
@supriyapawar8417 6 лет назад
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
@RaghavPal
@RaghavPal 6 лет назад
Sure Supirya, i will soon create a series on JS
@omkarkhatavkar3650
@omkarkhatavkar3650 4 года назад
in latest version of postman, you have to type 'let' and not 'Let"
@RaghavPal
@RaghavPal 4 года назад
Thanks for adding Omkar
@shwetagodbole7501
@shwetagodbole7501 3 года назад
thanks omkar for letting us know, I was not getting why error is occurring for Let.
@MovingDirection
@MovingDirection 6 лет назад
Raghav: You have written at 4th line -" pm.variables.set("name", "POSTMAN"); ". It is set to which variable. How do I check ?
@RaghavPal
@RaghavPal 6 лет назад
Hi, this will be a local variable created during the session.
@stevenclark1973
@stevenclark1973 5 лет назад
@@RaghavPal similar to a question I just posted.. where was this local variable set?
@anupamrai152
@anupamrai152 3 года назад
I am unable to understand scripts that you using. Please help
@RaghavPal
@RaghavPal 3 года назад
Hi Anupam, we use JavaScript in Postman, You can watch JavaScript Beginners tutorial here - automationstepbystep.com/
@anupamrai152
@anupamrai152 3 года назад
So I need to learn javascript before api testing?
@RaghavPal
@RaghavPal 3 года назад
No, you can start and can learn the basics when required
Далее
Friends
00:32
Просмотров 644 тыс.
Loop request based on data from response in Postman
13:13
Use Response Data in a Request | Postman Flows
3:29
Просмотров 20 тыс.
Postman Beginner Tutorial 9 | Environments
12:15
Просмотров 49 тыс.
Pre-request Scripts in Postman | The Exploratory
8:10