JMeter 2021 Masterclass | Step by Step for Beginners | Raghav Pal |

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome to this master class and crash course on jmeter i'm raghav and if you are a complete beginner on jmeter do not worry i am going to take you from the very basics from scratch and we will go up step by step together and you can do hands-on along with me so this will be a very practical course and below this video you will see a description where you can find timelines for every topic so if you want to jump to any of the topics you can use the timelines you will also see all the notes in the description and you can always go to my website that is automation step by step dot com and you can find all these videos on j meter and performance testing here as well so let's get started and i wish you all the best before we start setting up and using jmeter let us very quickly see what exactly is j meter and for this i will go to google and search for j meter and here i have got this link the website of jmeter is dot jmeter.apache.org and if you go here this is the website and you can find everything about geometer here so jmeter is a 100 pure java application and therefore to use jmeter you will need java on your system and i will show you how you can start using jmeter on windows mac and linux operating systems and it is an application that is used to load test the functional behavior and measure performance so jmeter is an application to test performance and i have also written some nodes here and let me very quickly add these nodes here so it is very easy for you to follow so jmeter is a performance test application it is built using java so you will need java on your system to use jmeter it is completely free and open source application created by apache supports recording so you can use recording to create your test cases in jmeter we can also use the command line options to run our tests and we can view the reports if you go back to the jmeter website here you can see it was initially designed for testing web applications but now it has expanded and now you can use jmeter for doing performance tests on a wide variety of applications which includes web soap and rest web services ftp databases jdbc ldap gms and tsp and tcp mail and all these different kinds of applications and protocols can be tested with jmeter and then there are a lot of plugins in jmeter that you can use to extend it and we will see all this in the coming sessions i hope this helped you to start with geometer and in the coming session we will start setting up jmeter let us go to the next topic let us now learn how to install jmeter and you can use jmeter on windows mac and linux operating systems and you will need java on whatever platform you are using jmeter on and i have also written some nodes so it becomes very easy for you to follow and you will see and find all these nodes and all the description in the description section below this video so here the first thing we have to do is we have to check is if java is installed on our system so this is my mac i'm on my mac and this is my windows system let me first check on my windows system i will go to the command line i will say cmd and open the command prompt and i will say java space hyphen version and hit enter and here you can see in my case i have java 8 installed and if you go to the jmeter website and go to download releases so this is jmeter.apache.org download here if you see gmeter requires java 8 plus so java 8 is the minimum requirement for jmeter so in my case i have java 8 on windows and if i go on my mac i am pressing command space bar on my keyboard to bring up spotlight and i will type terminal here and open the terminal app and here again i will say java space hyphen version and here as well i have java 8 installed now just in case you do not have java on your system you can go on my website that is automation step by step dot com so when you go here it will take you you will get see this home page and if you scroll down you can see a section on programming here and then we have java here this will take you to my youtube playlist on java and here you can see tutorials on how to install java on windows and how to install java on mac and if in case you are using linux this is a tutorial on how to install update java on linux so whatever platform or operating system you are using you can set up and install java first and you can use this command java space hyphen version to check if java is already installed on your system and then go to step number two that is download jmeter so here on my windows i will open my browser and search for jmeter and go to the jmeter website that is jmeter.apache.org go to download releases and here i will go to this section now you can get jmeter from the binary section or the source section i am going to the binary section and i am getting this zip file i will click on this and this will start downloading the zip folder and similarly on my mac i will go to jmeter download page and i will click on this zip to download the zipped folder for jmeter and once this is downloaded you can unzip and keep at any location on your system so this is step number three after download unzip and keep jmeter folder at any location on your system so let us wait for the download to complete and yes this is done on windows i will go to the folder and it is here let me just i had two folders i had already downloaded one so let me just take this one and first i will place this folder to any other location wherever i want you can use the same location or let me just go to tools and i will go to i will create a new folder here and say jmeter 2021 and paste it and now i will do a right click and say extract all so it will extract the jmeter folder and it is now unzipping the same thing i will do on my mac i will go to the folder and i will go to downloads and it is as of now downloading let me just stop this because i already have this downloaded here so if i show you here is my apache jmeter zip folder i will again open it with any unzip utility and let me just check yes it is here and now you can see this is the folder let me show you in a different view and yes this is the folder contents on mac and on windows it is still getting unzipped so let me first show you on mac now if you have to start on mac you can go to the bin folder of jmeter inside the jmeter folder you will see bin and here you will see jmeter.sh file now what you can do is you can either just directly use this to open jmeter like i will just drag it to my terminal and hit enter and you will see it will start j meter on mac operating system and you can see it is now starting and you can also see a message here don't use gui mode for load testing only for test creation and test debugging so it is suggested that you use the gui that is this gui of j meter for test creation and debugging but when you want to run the actual load or the actual performance test you can do from command line so here jamit is started the other way is i am pressing ctrl c on my terminal so it will stop this i can also say i will go to the location of this folder so let me just press command i and copy this location until bin folder and on the command line or terminal i will say cd to the bin folder of j meter and then i will say sh j meter dot sh and this command will also start j meter on mac operating system and similar commands will work on unix based or linux operating system as well so this has started jmeter on mac and on windows now this is unzipped i will go in the folder inside the folder bin folder and here i will see a jmeter.bat file i will again have to run this from command line or i can just do a double click here and this will start j meter on windows operating system and this is starting and yes you can see jmeter is up and running here so this was a slight difference in starting j meter on these different operating systems and once j meter is started rest of the process will remain same this is a java application so you do not have to you will not see any differences in using jmeter whether you are working on windows or mac or linux in case there are any differences i will show you during the sessions and now jmeter is open on our mac and windows and now we can go with the next session so let us now move to the gui overview so let me start my jmeter and it is already started we have started our j meter in the last session and this is our j meter running here let me increase the window size so you can see everything clearly and this is now our j-meter here and now you will see four sections here the first section is the menu bar which is at the top here then we have the main toolbar which is this section and then here you will see the test plan and all the elements of a test plan in a tree view and then this is a section this is the editor section where you will see the editor window for whatever element you select here in the tree view and then here is other options for time logs and users i will show you everything so let us start with the menu so you can see at the top we have file edit search run option tools and help if i go to file here we have these options to create a new test plan we can go from here or to select from a template or open any test plan from your system open the recent test plans merge save save test plan as and save selection save as test fragment or restart gmeter now if i go to file again and here if i go to templates here it will open the templates window and you can use these templates as sample projects for example if you want to start or create a web test plan you can select build a web test plan from here and if i say create here i will not save the earlier test plan let me just create this one you can see here it has created a template for a web test plan which has all the basic elements required for a web test plan now i am going to show you all this from scratch in the coming sessions but it will be a good practice to start with the template then again if i go to file we have all these other options here let me go to edit and here we have options to add and this is where we can start adding our assertions timers preprocessors config elements listeners and everything and we will see this in detail in the coming sessions we have options to insert parent cut copy paste duplicate remove save selection as save as test fragment and all these options here we also have a help option here and if i go to edit and if i go to help this will take me to the documentation page where you can see help for that particular element that is selected for example if you see here as of now i had selected an element which is an http request and as i went to edit and went to help it open the documentation for http request let me select view results tree here and again i will say edit and go to help and now this time you will see it will take me to the view results tree documentation so this will be very handy and helpful and now if i go to the option search here we have search and reset search options if i go to run menu here we have start start no pauses remote start when you have remote nodes attached you can also do remote start from here remote start all stop shutdown and exit options here and then some of these options are also available in the main toolbar and i will show you this in a moment then we have options menu and here you can change the look and feel of jmeter if you want a light theme or dark theme or any of these you can select from here then we have a log viewer so it will show you the locks and we also have the log viewer button here so this is the button if i select this it will show me the logs if i select it again it will hide so as of now it is showing me the logs here if i press again it will hide and the same option you can get from the log viewer here then we have log levels and by default it is at information level but in case you are doing any debugging you can always change this to a trace debug all and then see all the logs we have ssl manager in case you are dealing with any application that requires ssl certificate you can select the certificate from your system then we have option to choose language if you want to change language of jmeter can choose from here we have collapse all and expand all and then zoom in zoom out and then you can also see collapse and expand buttons here as well then we have tools here we have a option to create a heap dump and thread them so it will save a log file if i select this you can see it is it has saved this dump into this log file and then we have function helper dialog which will open this function helper where you can select and create functions i will show you this later we also have function helper dialog here so you can see on the main toolbar this will take you to the same window and then we have all these generate html reports option compile options export and generate schematic view options and import from c url then we have help and here if i go to help it will take you to the documentation page of jmeter where you can see all these help options and all the documentation i will go back and go to help menu and we have all these options enabled and disable debug we have useful links it will take you to release notes if you want to create an issue or you want to go to the component reference documentation it will take you all to the documentation page and then we have a link or option of about jmeter this will show you your j meter and its version so this was the top menu and then we have this main toolbar and some of the options which are very frequently used are provided here in the main toolbar so here you can see all these options we can start with new this is to create a new test plan then our template it will open the template window as we have seen earlier then here is the option to open a file or a test plan from your system we have save then cut copy paste expand and collapse then this is a toggle switch then we have run or start and start without pauses here you will see a button for stop and then here is a button for shutdown now the difference here is if you are running a test plan and you want to stop everything abruptly you can select stop here and if you want the test to stop gradually gracefully after stopping all the active threads you can select shutdown and these will become active when a test plan is running then again we have clear and clear all when we have listeners or results element report elements in jmeter if you want to select a report element or a listener and want to clear it you can use clear and if you want to clear all the data from all the listeners we use clear all again i will show you this in detail then we have search option we have reset search this is function helper dialog and this will take you to the documentation now coming to this side of j meter here you will see the time so when you run a test plan you will see the time elapsed here this is to view the logs as i have already shown you this will show you the logs at the bottom and then hide the logs and here this is for viewing the number of active users so as you start your test plan and you have multiple users you can see this count increasing as the users get added to your test plan now coming to here here you will see all your test plan and all its components so as of now you can see this is a test plan and then here you can see a thread group and then these http request defaults and all these elements and here is the editor so whatever element i select here its editor will open here now if i want to rename any page or if i want to rename any element for example instead of home page i say my page here you can do that and if you see as of now it is still showing home page here if i select anything outside or click outside now this is changed to my page so you can do that and this is all about the gui overview of jmeter i hope this was useful thank you for watching okay so now let us move to how to create first geometer test so in this session we will learn how to create our first jmeter test and i have also written down all these steps for easy reference and all these steps and all the description will be available in the description section below this video so the first thing is first step is i have to start geometer my geometry is already started here uh let me expand this and now i will create a test plan so the options are i can go from here file and click on new or i can just click on this new button here so when i select new it will create a new test plan and it is asking me do you want to save the earlier test plan i will just say no for now and you can see here a new test plan is created now step number three is i will create a thread group or the users so here i will do a right click on the test plan click on add and thread users and here i will select thread group and this is where we can give the number of users for the load test or the performance test now you can always change this name and when you click outside that name will get changed here and then if you want to give any comments you can give here we have options here for actions to be taken after a sampler error so all the test requests we add in a geometer test plan are called samplers it can be a http sampler for a browser or a website request it can be a api sampler it can be a ftp or a jdbc sampler so it is saying what should i do after in case there is a sampler error should i continue or start the next thread loop or stop the thread or stop test or stop test now by default it is continue and i will keep it as it is here then we have here number of threads or number of users so here you can select how many users you want to use for this test or for this performance test and then we have ramp up period so let us say if i say remember period is one second that means all the 10 users will start testing instantly without having any ramp up time but if i say 20 here that means 10 users will be ramped up in 20 seconds that is one user will be added every two seconds and after 20 seconds we will run with a full load of 10 users then we have loop count here so how many iterations you want to do for this test by default it is one you can change this or if you say infinite it will keep on running until you forcefully stop it so i will keep it one for now and then here we have option do you want to use the same user on each iteration so you can check or uncheck this and then we have delay thread creation until needed specified threat lifetime all these options are here i will now go and add a sampler and for this test plan i will add a very simple http sampler so here if you do a right click on your thread group and go to add and go to sampler you will see all these different types of requests or samplers that we can use in jmeter i will go with http request and here we have got the editor for http request and we can give a name here let us say this is i will say my first http test and if i go and click outside it is changed here i can give some comments and then we have to give the details about the http request or the web page we are going to test so here let us say i will go to uh one of my websites that is lifecharger.org and let me see if this is running and i will use this and yes so if i have to use and do a performance test on this web page this website and this web page i will just copy this url and if i give this url here so this is what my webpage url is however i will not give it like this the http part comes here in the protocol so i will remove http from here and add it here now here in case it is not http s and it is http then you do not have to give anything here in case it is https then you can provide it now here for server name you just have to give your server name or the ip of your website without any other path so for example here it is livecharger.org and then in case your url has a port number that will come here now this is a simple web page so i will keep it get in case you are using or doing any api testing then we can use any of these other http methods i will keep it get here now this is the path let us say if you are testing any other page for example if i go to this page or let me go to this two minute rule so here this is the location of this page so this is the path i will copy this and add it in the path field here so this is how we give the url the https part comes here and if it is http you can leave it blank the server name or ip comes here the port number comes here it is get for a http request and then the path comes here now in case you need to have any file upload or body data which usually will be in the case of api testing or any parameters if you want you can add it here and then we also have an advanced section here and here you can select if you want to change the implementation protocol or connect timeout response timeouts here and then all these options we will talk about this later let me just go back to our basic and this is now done so i can now save this test plan it will ask me to save with a name that will have a file that will have a extension.jmx and save it at any location i will say save now my test plan is ready i have added my thread group i have given a user load here and i have also added the request details however to view the results i need something where i can see the reports or results and that component is called listeners so listeners are the components where we can store and view results so i will again go to the thread group do a right click and go to add and i will say here listener and i will select view results tree there are lots of listeners i will just go with view results tree here and i can add multiple listeners i will also add a view results in table listener here and now this is ready i will save and now i can start run and i will click on this run button and let us see the output so here you can see this is the table view results in table listener and this is view results in tree listener and we can see the samplers getting executed and we are getting the reports here now here you can see this is the sampler number and we will have 10 runs because we have 10 users the start time and this is the threat name and if i just expand it and show you you can see this is this comes like this and this means this is the first run of first user first run of second user first run of third user and so on this is the label of the request which we have given the name that is my first http request this is the time taken by this particular request and then the status so everything is fine and we can also add assertions for this just in case we want to do any kind of checks on the results and the response these are the bytes and the latency and then the connect time you can also write these results to a file you can browse the file a csv file or an excel file and can send the results there or you can also upload from a file if you want to do any changes in the results you can go to configure and change the fields here and then if i go to view results tree if i go to any of the result or any of the sampler result you can see all the details and the summary here i got response code 200 okay and everything was fine this is the request that was sent and this is the url that was sent and then here is the response so this is what we got as the response as html you can see the response body and headers and similarly request body and request headers you can see raw here or http similarly if i go to response you can see all these html page of the response here just in case you want to find something in the response you can find it from here and make it case sensitive or insensitive and make it regular expression again here we have option to write or read from a file and then a configure option you can also see this is the total time and if i try to run this again let me go to my test plan uh go to thread group and i will say infinite this is not recommended but just to show you i'm just going here now to clear the report or the listener i can select this that is the clear button it will clear only from this listener but if i say clear all it will clear from all the listeners so you can see all these listeners are now cleared now you see if i now run this again check this part and you can see the number of users getting added i will click on run and now you can see here we have one user two users so user is getting added every two seconds as we have done the configuration in third group and you can see the time here and now it will keep on running until i stop or shut down and i told you stop is for stopping everything abruptly but if i want a graceful shutdown after stopping all the threads i will select shutdown and now you can see it is saying shutting down all the threads and it is done it is now stopped so now we have done step number six as well and this is how we create our first test in geometer i hope this was useful thank you for watching so moving to the next topic so here we will learn about jmeter listeners so jmeter listeners are the reporting elements in jmeter where we can create and view the reports of our test and here gmeter listeners or listeners in jimmy are used for reporting and these are the elements that gather information about the performance test and we can use it to view the results and metrics of our test so let me go to my j meter and this is the test we created in the earlier session so we have a thread group where we have 10 users rampa period is 20 seconds and let me say the loop count is 1 here and then if i go here this is my http sampler that i have named my first http test and here it is going to this live charger.org and going to this page two minute rule and in the earlier session we already saw two listeners that is view results entry and view results in table so the listener that main listeners we are going to see are these ones let me copy them here and you will get all these notes as well so view results in table is what we are going to see first and we have already added this so to add a listener you just have to do a right click on your thread group or maybe your test plan and go to add and here you can go to listeners and you can see all these listeners are here so let us first see view results in table so here this is my listener and we know that to clean or clear the listeners we use this clear or clear all button so clear all will clean all the listeners that you have added in your test stand and clear will only clean the results from the selected listeners so this is already clean and now i will start my test and let us see the output here and now you can see i am getting the sampler results here and we should be getting 10 sampler results or 10 results or 10 rows here because if i see in the thread group i have 10 users and the ramp up period is 20 seconds let me say users5 and the rampa period also 5 here this will help to run the test quickly now we have got our results in the view results table let us study this listener so the first column is sample number and you can see there are 10 samples then we have the start time for every sample and this is the thread group name so this is what is the name that comes from here this is our thread group and then here you will see a label also if i expand this before going to the label let me show you this in the thread name you will see thread group which is coming from this name and then you will see these numbers 1 1 1 2 1 3 this means that this is the first iteration for first user this is the first iteration of second user first iteration of third user and so on suppose we have more users or we have multiple requests you will see duplicate entries for every user and then this is the label that is coming from our request that is my http test and then here we have the sample time so this one is the time taken in milliseconds let me expand this and show you so this is time taken by this sample in milliseconds and then we have a status now if you have not added any assertions status will only be checked against if you have got a valid response and 200 status or any successful status otherwise it will show as a failure and if you add assertions that we will learn in the coming session then it will be also be based on the assertions that you have added so in this case everything is passed and then you will see bytes so this is the size of the response this is the byte sent to the server and now we have latency here latency is again in milliseconds and what exactly latency means is let us say if i take a scale from 0 milliseconds to let us say 2000 milliseconds now let us say here we send our request by the time request went to the server it was 1000 milliseconds let us consider and then from 1000 milliseconds we started getting the response and then we got the complete response at 2000 milliseconds now here this point where we started getting the response will be the latency so this will be latency that we started getting the response at this particular time but the complete response we got was in 2000 milliseconds so the sample time will be 2000 milliseconds but the latency time that is the time when we started getting the first byte of the response from the server will be 1000 milliseconds so this is what is the latency time in simple words we say latency is equals to time to first byte and i will highlight this so this was latency and then you will see a connect time here so the time it took to connect to the server this is that time again in milliseconds and then you will see a field where you can browse a file you can read or write these results to a xml or a csv file and you can also upload the results from that file we have a configure section where you can configure the headers and other properties so this is view results in table let us now see view results in tree and you can already see if i go to view results in tree i already have this results here and this is how it is shown here for every sampler result you will see this tree and if you select anything you will see the sampler result you can see here the response code is 200 okay and the body size headers sent bytes latency everything you will see here connect time load time and then for a request the request body and request headers and for response response body and response headers now you should not use this listener when you are doing your actual performance test this listener will results in tree and any other graphical listener or any listener that shows you a lot of data and information is good when you are creating your test case and or debugging your test cases when you are doing your actual performance test with thousands or hundreds of users you should disable all these listeners and should have only simple listeners that give you tabular data or when you run from command line that we will learn in the coming sessions you can just use a csv file to log all your reports so you should not use this listener when doing actual performance test and to disable you can just do a right click and disable from here again you will see a field name field here where you can write or read results from a file then let us go to aggregate report and for this i am going to add the listener which is called aggregate report and for now let me clear everything and i will run my test again and let us see the output now so you can see in view results tree and view results table you are getting all this report but if you see the aggregate you are getting a single line and it depends on the number of samplers as of now i have a single sample or a single http sample therefore i am getting a single line and this is basically a average of the all the samples for that particular request so if you see in the results in table we had one row for every request of the sample but in aggregate report we will see an average of all the samples so here we can see an average time again it is in milliseconds we have a median median means this is like a middle line so half of the request took less than this time and half of the request took more than this time then we have ninety percent line that means ninety percent of the response was within this time that is six four four nine milliseconds then we have ninety five and ninety nine percent lines similarly and then we have maximum time you will mostly find that the 99 percent line and the maximum time has more or less the same time so 99 percent of the requests were under three eight two milliseconds and that is also the maximum time taken this is the minimum time taken by any request in all the samplers if there are any errors you can get the error percentage this is throughput and this is per minute so this is number of requests per minute metrics and then we can see received data or size and then send data or size here so this is kind of an average of all your requests per sampler and you can again use a file to read and write here the next report we are going to see is graph results and this will be interesting let me create and add the listener that is called graph results and here it is and to see some data here i'm going to go to my thread group and i will increase the number of users here and also increase some ramp up time and make it infinite so that you can actually see some data now also make sure when you are doing this if you are learning jmeter and if you are doing it on your own system do not give a very high count of the users like 100 or 2 000 or 5000 we also need a system with an infrastructure that can handle that load so therefore we create separate environments for performance testing and i will tell you about that later but if you are using your own personal system do not increase the load more than 10 users or 20 users and also keep it for one or two iterations just for this demo i am doing it infinite and now if i clear and run my test you will see some data coming here so you can see some red dots are here and some blue dots and green dots let me go and change the look and feel of j meter so that you can see this very clearly if i say windows yeah now you can see it very clearly you can see some dots here and there are different colored dots so here you can see the key here green is for throughput red is for deviation purple is for median blue is for average and black is for data and if you want you can also check or uncheck something from here so i do not want to see data i do not want to see median i do not want to see deviation i just want to see throughput and average also you will notice that when you start your test you will see throughput is more and average is less but very soon you will see these lines coming together and also crossing each other sometimes and that is because as you send the same request to the server over and over again the server develops cache memory and therefore the next request takes less time so you can see it is now crossing each other so this is how it is performing you can see this graph here and i will have to shut it down or stop i have already shown you and told you what is the difference between shutdown and stop if you want to shut down gracefully and want to stop all the threads before stopping you should use shutdown and for abrupt stop you can use stop button now it is stopped i will go back and change the loop count to 1 and also change my users to 5 and ramp up time to 5 seconds also this is a graphical listener so you should not use it when you are doing your actual performance test and now let us see a summary report i will add a new listener and this is called summary report and now if i run my test case you can see a summary report listener here and again you will see here we have got this single line where we have one row per sampler and it is something similar to what we saw as aggregate report but you will not find this 90 line 95 percent lines all these here you will only see the label that is whatever name is your request has number of samples the average time the minimum and max time taken standard deviation error percentage throughput received and sent data size and average bytes so this was a simple summary report then we have simple datawriter and let me show you i will go to my thread group right click add listener and we have simple datawriter here and you will see here we do not have any graphs or any table here we only have a option to add or send these results to a file so here let us say i create a file i will go to my desktop and let me say i will create a simple csv file i will say here report and make it csv so you can see i have added this file and now i need to go to its location so let us say this is on desktop or i can directly browse it from jmeter i will go to my jmeter and i will say browse and i will have to go to my desktop and yes my file is here i will say open and let me just try this i will now run my test and see i will run my test case okay so it is asking me to give a new file let us say i give it reports one dot csv which is not already existing and now i will save and run and let us see now so here i can see the progress and it is still running once this is completed i will check so now the users are ramping down and yes looks like this is done now i can see the other listeners all these listeners have data but now i will go and check my reports1.csv which got created here you can see i have got all these data in my csv file so we have timestamp elapsed time label or response code and let me show you all these columns we have timestamp elapsed time label response code response message thread name data type success failure message bytes sent bytes group threads all threads the url of the request the latency time idle time connect time so these are the details we can get in the file of course you can do the configuration from jmeter you can go to configure and you can select all what all fields you want to get in the file and this will be a good option to use when you are running your actual performance test because it is directly adding it to a csv file without using any jmeter memory here so these are the most commonly used listeners in jmeter let me see if there is anything else we can see here so if i go to listeners we have summary report you can see all the summary aggregate graph assertion results so assession results listener will show you the results of your assertions if you have added any assertions and we will learn about this in the coming session then we have uh summary results then miller for if you are using any mailer sampler then you can directly use save responses to a file we have already seen simple data writer and then if you are using any scripting of bin shell sampler you can get a bin shell listener as well here so these are the top listeners that we use in gmeter i hope this was useful thank you for watching so we can go to the next topic now that is assertions in jammeter and i am going to go very basic step by step so assertions in geometer are the checks on the request and response and mostly it is the checks on the response so you can check the response code you can check some particular data in your response you can check the response time duration size etc so in gmeter we have all these different types of assertions that you can use to check your response let us see all these common assertions in geometer i will go to my geometer and this is the test we created in the earlier session uh let me just go and disable all these listeners i will select everything i am pressing shift and down arrow key on my keyboard do a right click and i will say disable i can also delete all of these but let me just keep view results tree and view results in table and i am going to clear everything in my thread group i have five users rampa period five seconds and loop count is one and this is my request i am going to this website livecharger.org and going to this page two minute rule in the last session i had changed the look and feel from options look and feel and i had made it windows but if you want you can just go back to the earlier dark theme so let us start with response assertion now in jmeter you can create your assertions at different levels like at a test plan level at a thread group level or for a particular request or a sampler let us say if i add it at a test plan level i can do a right click add and go to assertions and i can add any of the assertions from here and that will be applicable to every sampler that is in this test plan now if i go at a thread group level and add the session that will be applicable to all the samplers of this thread group and if i go to a request and then do a right click and say add the assertion it will be applicable only for that particular request so let me say for this request i want to add a response assertion and if i select response session you will see here we have got the name of the session and you can change it here we have option to apply it to main samples and sub samples main sample only sub sample only or we can also use a geometer variable i will teach you about variables later and here we have options to select the fields you want to test so let us say i want to test the response code and here i will go and set the pattern matching if i want to check contains matches equals substring not or i will say equals so in simple what i am saying response code should be equal to whatever pattern i give here so i will click on add and i will say i want to check response code is 200 and that's it i will save and now i will run and if i go to my view results entry listener you can see everything is fine everything is running and everything is passed let me add some different pattern to test i will say here 201 which should fail and i will save and now i will clear and run the test again and let us see this time what happens you can see we have got a failure and if i expand this and see response assertion you will see it received 200 but it was expecting 201 also if i add a session let us say i add a assertion or i add a listener for assertions so we have a session results listener and we have already learned about listeners in the earlier session and i can also bring it up so if i now clear and run my test again you can see here we are getting the responses and it is a failure if i go to assession results here i can see only the results for the failed assertion so you can see all this is failing if i go back to my response a session and make it back to 200 and save and now if i go and check if i run this now you will see here we are getting the results if i go to a session results you will see there are no assertion failures here so this is a very simple response assertion and this is the most and widely used assertion in geometer and you can use it for response code or to check any text in your response all these options you have here then let us see the duration assertion so here i will go and add assertion and i will say i want to add a duration assertion and here you can see we can select or we can give the duration in milliseconds and if any sampler takes time more than whatever we give here it will be a failure so if i see as of now i am getting a response time somewhere around 1000 to 2000 milliseconds if i go to my duration assertion and i say i am keeping a threshold for 1500 milliseconds so any request that takes more than this time should be shown as a failure i will clear and run and if i see my view results tree here you can see some requests are passing but some have failed if i see the failure and here it is due to duration assertion and it says that the operation lasted too long it took two to nine eight milliseconds but should have not lasted longer than 1500 milliseconds the same i can see in the session results as well so whenever you want to check if your samplers should not take some uh should not take time more than some specific duration you can add a duration session then we have size assertion again this is a commonly used assertion if i do a right click again on my request and add a session and say here size assertion here you can see you can add it to all these samples and then we have to select the response size field to test do you want to check the full response or only headers or only body or only response code or only the response message and here you can give the bytes so let us say if i check how many bytes i am getting as of now so i am getting here around 42 000 bytes and i will go here to my size assertion and if i say something like uh 42 000 and now here i have option should it be exactly equal to this number or not equals to or greater than or less than or greater than equal to or less than equal to let us say i'm saying it should all be less than or equal to this size all the sampler size should be less than equal to this number and now i will go and clear everything and run my test again and let us see the output so we can see some failures if i go here this failed both due to duration and size assertion and you can see the size was four to eight nine seven bytes but it should not be more than forty two thousand bytes and i think most of these failed due to size if i see the assertion results you can see most of these are the failure due to size recession let me go and say i'm saying that it should not be more than 44 000 bytes and now i will check again let me see if this time we get some pass and yes we are getting all this is running fine and yes now everything is running fine so this is how we can use a size assertion then we have html assertion so i will add this assertion called html session now here if you see it will actually check the html against the standards formatting and syntax of a html document and here it also tells us do you want to add some error threshold and warning thresholds that means how many errors are expected and you should not fail in case the errors are less than this number and similar for warnings this is the threshold and if i do not give anything and run my test case you will see here i am running my test case or running my test plan and you will see everything is a failure and if you see html assertion it is saying there is a assession failure which is can't pass argument number and here if i see the accession results this is the same thing i will go to assertion html assertion and let me give some error threshold let us say 10 here and 100 here and i will now again run this and if i see the view results entry again i'm getting a failure and if i see html assertion so here i'm again getting this now what i can do is i can actually write the report to a file and i can say here i will browse and let me just go and use something on my desktop let me say or i will create a text file on my desktop i will say new text document and i will say report1.txt and this is what i am going to browse on my jmeter so i will say go to desktop and use report1.txt and i will run it again clean and run and once this is done i will go and check my report1.txt and you can see all these errors and warnings here so you can see everything is here so this is basically checking your html or the html of your response against the standard syntax and in case it finds anything wrong against the standard it will show you the results and can also lock the report in a text file now here most of the times you may not want to validate the html assertion however in case your application needs to talk to any other application or needs to interact with third party applications you should take care of these html warnings and errors and you can discuss with your team and similarly you can also do a session on xhtml format or xml format of your response so this was the html assertion then we have assessions for xml and json in case you have a xml or json response which mostly you will have in case of api and web services then you can use these assertions we will learn how to test apis both soap and rest in jim meter in the coming sessions but here if i go and go to the assertions you can see here we have a json assertion and if i add a json assession you can see you can check here if the json path exists i will tell you about json path when we deal with a rest api having a json response you can also match a regular expression you can then check on this particular json path if you want if you are expecting some particular value you can add the value here and then you can do a json assertion and then similarly if i add a session for xml there is a xml assertion as well and here as well if you have a xml response it will check for the formatting and syntax according to the standards for the xml and then uh if i add another session we have a xpath assertion we have xml schema assession as well now xml schema is you can test your xml against some schema that you have added in a file let me show you if you go to uh if you just search for xml schema by raghav pal you will see a video you can see this is my video xml schema and you can see exactly what is an xml schema how do you create it and you can also get a xml schema from an xml so just in case you want to know more you can check this and then this is how you will give your xml schema file here and your xml will be tested against this schema then i will tell you about xpath session so as we have json path you have xpath for xml documents so you can give some xpath here and then you can say you can validate your xpath you can also check if that particular location has some value all that you can do for a x path or a xml document i will show you this again when i when we deal with xml responses for api testing so these are all the commonly used assertions in geometer and i hope now you can very confidently use all these assessions in jmeter so let us now move to the next topic so let us go to the next topic and now we are going to learn in this session about https test script recorder in jmeter and i am going to go very basic and from scratch i will teach you step by step how do you use the test script recorder in geometer so we will answer the following questions what exactly is the test script recorder why do we need it when should we use it and how exactly we can use the test script recorder so the test script recorder in jmeter is a element that helps us to record our requests from the browser so let us see so it can be any http request let us see here i have my j meter and i can use the same test plan that i have been using or let me create a new test plan and before i do that uh let me also show you the things we are going to learn here so we are going to learn how to record your test on jmeter how to add and use test script recorder how to add and use the recording controller how to use proxy on firefox chrome browsers and also on your system whether you are using windows or mac operating system i will show you how you can add the ssl certificate how to do request filtering and then how you can do the use the recording template so before that i will go to my gmeter and i have created a new test plan i will do a right click and say add and i will go to non-test elements and here we have a option for https test script recorder so i will add this here and it is added here i will also add a thread group in my test plan and inside the thread group i will take this up and inside the thread group now i am going to add a logic controller which is a recording controller so here we have a recording controller now what is this and why do we need it let us say i go to some website i am going to my website lifecharger.org and here i will go to the home page and i will record all the actions and all the events from here i will go to the archives page and i will go to the about page and i want to store all these events from every page separately so therefore we need a recording controller i can add multiple recording controllers per page or categorize my recording into different recording controllers and i will show you that in a moment so now we know what is https test script recorder it is a element in jmeter that helps us to record our http request so instead of manually adding your request in a http sampler you can very quickly do a recording and everything will get added now why do we use it we need these kind of a recorder so that we do not have to manually add every request in our j meter we can just browse and do the actions and everything will get recorded so it will save a lot of time it will be efficient and powerful therefore we need these kind of option and function to do the recording and whenever you want to record your http actions like your website or browser you can use this and now for how to use it we are going to see it here so let me bring it down this is how we are going to see the https test script recorder so i have added the test script recorder and the recording controller now i want to store the requests or the events from these three pages that is home page archives page and about separately so i will add three recording controllers i will again go to the thread group do a right click and say logic controller and say recording controller i can also just copy this i will select and press ctrl c or command c if you are on mac and then go to the thread group and say control v it will copy the element here now the first recording controller i will name it as home the second one i will name it as archive and this is optional it is only to store my requests and events from different pages separately if you do not want to do that you can still continue without a recording controller and then i will say this one is the about page now this is my test script recorder and here you will see we can give it any name by default it is https test script recorder then here we have an option to give a port you can give any port by default it is 8888 and you can select your domains if you wish to the https domains and here we have to select the target controller so if i see here we have these controllers home archive and about i will first select home so all my recording from my home page should go into this home recording controller and then we have option for grouping do you want to group samplers or not group all these options are here i will keep it as it is default here then we have option capture headers add assertions regex matching all this you can do for now i will keep everything as it is now the other thing is you can also do request filtering so here if you go to request filtering you will see that if you want to exclude some url patterns because when you hit any server there are lot of resources that get exchanged and if you want that some resources or some patterns should not be included in the request you can add them here if you want to include some patterns you can add them here i will show you a template and then it will be very clear to you as of now i will keep it as it is and go back to the test plan creation now here we have already added the test script recorder we have also added the recording controller now we want to see how to use proxy on your browser on and your system so if you see here we have a port 8888 and we want that all the traffic from a particular website or a particular http network should only be recorded and not anything else and therefore we set up a port here and in our browser we can set up a proxy for this particular port now let me show you on firefox and chrome both let us say if you are on chrome i will open chrome browser and you can go to these three dots here on your chrome and you can go to settings and here if you search for proxy here we have open your computer's proxy settings it will actually open your system's proxy settings now because i'm on windows it is opening this one if i'm on mac you can see here it will go and open the system proxy on mac let me show you quickly this is for mac users i will go to network and then i will go to advanced and here i will go to proxies and here you can set the proxy so you can set a web proxy and set the server and the port here so this is for mac and if you're on windows you can just go to the manual proxy setup and this window can also come if you just search for proxy on windows it will open the proxy settings from here so now here you can say manual proxy setup and say user proxy server and here you can say localhost and the port number so this will be done at a system level and then you can use proxy and use the same port as you have used on jmeter for now i will switch it off and then after you have set up the proxy you also need to add a certificate so if you search for certificate you can go to the security and scroll down you will see manage certificates here and here you will have to import a certificate from jmeters bin folder so if you go to your jmeter wherever your jmeter folder is and go to the bin folder you will see a certificate apache jmeter temporary root ca dot crt and this certificate needs to be added on the browser so you can say next browse and add the certificate and this is for chrome now coming to firefox let us say you want to do recording from firefox again you will go to these three dots here and go to the options so we have options here now i will again search for proxy and here we have the proxy settings and here you can see it is as of now use system proxy settings or it may be on no proxy but now i will say manual proxy here and then give the server which is localhost because i am doing it from my system itself and the port is 8888 now sometimes the port that we are using on jmeter uh may not be available or as busy then in that case you can always use any other port like 8181 but it has to be same on jmeter and browser both and i have also checked this also use this proxy for ftp and https and i will say okay now i have already set it for firefox and i will use firefox i have already shown you if you want to do at a system level then how you can do it so this is how we can do proxy setup and for ssl on chrome i have shown for firefox if you want to add the certificate you can just search for certificate here and then here go to view certificates and then here i will click on import and go to jmeter spin folder and this is the certificate we want to add so i will just add it for websites and say okay and you can now see it is added here and we have done this step as well to add the ssl certificate and now we will see how to start our recording so now if i use jmeter if i go to the browser that is my firefox we have i have done the settings and i go to this website livecharger.org as of now it is not going but when i do a start from jmeter i will click on start here and it is saying that you should be adding the certificate which we have already done i will say okay and now here we have got a transaction controller you can give the transaction name here and you can also select what is the prefix you want so i will say home because i want to do a testing on the home page and do recording there and now if i go back to my browser and go to livecharger.org you can see now it is coming here and i will go to home and you will see all these actions i am doing will be getting recorded in my jmeter so if i open my jmeter and open the home recording controller you can see everything is getting recorded here all the samplers are coming here now we have not done any request filtering therefore we are getting so many samplers but i will show you how to do request filtering and when it is done you can click on stop and now i will again go to the test script recorder this time i will select the target controller to be archive and i will say start again and say ok and here i can give a prefix let me say archive and now i will go to my archive page and it has gone here if i go to my jmeter i will click on stop here i will go back to my j meter and you can see all this has come here and the prefix you can see with every sampler we have a prefix called archive and then similarly i will go again to my http test script recorder click on start and here i will say about and again go to my browser and go to the about page and i can do more actions whatever i want to do here i can do everything here and then i will say stop and if i go to my j meter i think it did not record let me try this again okay it got recorded in archive that was a mistake i did not change it here so that was my mistake let me change from here about and now let me start and here or i can do one more thing let me stop this if i go to my archives there are these are the samplers with the prefix about that got recorded for the about page and i can just drag and drop it inside the about recording controller and it is done so i have got this now i can also add a listener let us say i will add a listener view results tree and i will add one more listener view results in table and then in the thread group i can give some user load whatever i want to and then i can start test it is asking me if you want to save let me say yes and i will name this jmx file as recording demo one and say save and now you can see it has started execution and it is now running all our samplers and if i see in the view results in table you can see all this is coming here so we have done and we have learned how to record your test on jmeter now we need to see how to use recording templates now if you see here in this particular test plan we created everything from scratch we created a new test plan and added the test script recorder added the recording controllers and everything but in geometer we have some templates you can go here to file and go to templates or you can see there is a template option or an icon here if i go here to template and the template window opens i will scroll down and we have a recording template and recording with think time the difference here is if you select recording with think time it will create a test plan along with some random timers that will have some random delay between requests that will mimic the actual real word scenarios like real users testing the applications with some think time in between or some delay in between a random delay between requests i will select recording with think time and then you can also read some documentation here and go to the links i will say create and you can see here we have got a test plan created and we have got all these elements added we have got a thread group along with a recording controller we have got a test script recorder and now this time if you go to request filtering you can see all these are already added so these are some common patterns that you want to exclude when you are recording from a url or from any http resource so you can always add these things and this is a ready test plan that you can use for doing your recording with meter and this is how you can do recording with jmeter i hope this was very useful for you thank you for watching so now let us go to the next topic and here we are going to learn how to use blaze meter to record j meter tests and i will tell you what is blaze meter and all the steps so these are the steps we are going to see we will create a blaze meter account and then we will get the blaze meter extension on browser log into the account record a test save the jmx file and then add the jmx file on jmeter and then run the test now blaze meter is a application that we can use to run performance tests on the cloud so let me just go and search for blaze meter and here is the blaze meter you can see it says open source enterprise ready platform that unifies all shift left functionality with that is performance testing functional testing load testing and api testing so there are lot of options this is a cloud-based service and if i go to blazemeter.com and you can see all the documentation here so this is basically a continuous testing platform and you will get all the options to do performance testing you can add your jmeters jmx file here and do the testing and the first step is i will click on start testing now or you can click on get started and we need to register and in my case i am already registered so i will just login you just you can just create an account for yourself so you can create an account and we have done step number one that is create placement account now we will need a blaze meter extension for recording and you can go to your chrome and go to apps and go to web store on chrome browser and search for blaze meter and here is the blaze meter extension so you can see this is the extension if i go inside and see the details you can see here this is for recording the http traffic and it is apache jmeter compatible and you can add it to your chrome in my case it is already added therefore i am getting this option remove from chrome and if i go to my extensions you can see here is my bliss meter extension and let me go to my website that i want to record and here is my blaze meter extension now you should be locked into your blaze meter account if you see something like login here then you can first login and then give any name here let me say this is j meter demo and now if i go to advanced options you can see we have options to use the current browser or you can use any other browser if you want to sometimes we need to test on some particular browser in that case you can see all these options are here as of now i will say my current browser here we have the filter patterns so i am saying i only want to add the http and http as patterns and nothing else and then we have these options to disable browser cache record ajax and all these options are here our test plan will get created accordingly as we select all these options here and then i will click on recording or start recording and now you can see as i go to my home page it will do the recording here and you can see the sampler count here and you can see this is getting recorded i will go to archives page and the count is increasing here you can also pause the recording and let me go to my about page here and of course in case you want to go to any other page whatever you want to do you can do that it will record all the actions let me say i go to this two minute rule page this article is here how to find your passion in three steps i'm going here and all this will get recorded now once you have recorded you can click on the stop button i will say stop and now i will go back to the extension and this is now stopped and now i have the option to run edit or save if i see run we have options to run a performance test api functional test gui test and user experience monitoring i will just click on run here and it will ask what domains you want to include i only want to include this and i will say submit and it will start execution on the blaze meter dashboard so you will see on your blaze meter dashboard it will open itself and it will show you the execution and of course with a free account you will have some limitations but you can still see it running on the cloud so you can see here it is warming up and it can take some time it is booting and then it will download and will get ready and you will see all the options and all the results here but what we are more interested in is we want to get the gmx to be executed on our j meter so i will again go to the extension and then we have an option to edit just in case you want to edit the script you will see this option and here if you want to make any changes you can do that you can always export the gmx from here directly or if i go back to the extension i can always save it from here directly so i can select the gmx format and i only want live charger domain and i will click on save and this will save on my system you can see this is getting saved here i can go and open the file so this is here let me copy this and i will take it to the system where i have j meter i will paste it here on my windows i am using jmeter here so it has come here so here we have done step number two we have got the blaze meter extension we have logged into blaze meter we have recorded the test we have also saved our jmx file now i will go to my jmeter and i will say open and i will select this jmx file and say open and you can see i have got the entire test plan created i have got the header manager the user defined variables where it has created a variable called base url and using this url or the domain name in the request defaults i have got this which is empty as of now and this is the cache manager authorization manager cookie manager and here we have this cache manager and if i go to the thread group as of now we have one user ramper period one and one loop count and if i open the test you can see here this is a transaction controller and under this we have all our requests and you can see this was my home page and it is referring the user defined variables here then this was the archives page this one is the about page then i went to the two minute rule page and then i went to the how to find your life purpose page and i can now just directly add a listener i will do a right click on the thread group and add a listener let us say view results tree and also you can see for every request it has also added a constant timer so here you can see this is added this is just to add some random delay to mimic real world use of the application and i can now go and run the test plan and check the result and you can see the results are coming here so we have got this all this is coming here and if i go to the thread group i can increase the load from here now and i can do a actual load testing so you see in the earlier session we have used a https test script recorder which was inbuilt in jmeter and there we had to set up all the proxies and certificates and everything but here you can just use the blaze meter extension do the recording and add the gmx in your jmeter and run so we have also done step number six and i hope this was very useful and very easy and now we can move to the next topic in this session we are going to learn how to get data from a csv file in jmeter or how to refer data from the csv file and this is going to be very easy very interesting and this is very important because in jmeter in your testing you will be required to get your test data from an external file like a csv file so let's get started and here i'm on my jmeter i'm going to create a new test plan so i clicked here i have a new test plan and i will do a right click add and here if you go to config elements you can see a lot of config elements here so we have csv data set config http header manager and cookie manager authorization jdbc connection and so on so in geometer we have a lot of config elements and these config elements run before the sampler request at that particular level for example if you add a config element at a test plan level then it will run before any of the requests or samplers added at the test plan level and today we are going to learn a very important config element that is csv data set config so i will click here and it will add a csv data set config element here and here we have the editor for csv data set config so this is step number one let me say step number one is add csp data set config and let me increase the font size for you so we have done step number one and step number two will be so now i have added this csv data set config and now i need a csv file that i will refer so step number two will be create a csv file and add data so now i will go to my desktop you can go at any location on your system and create a csv file here i'm first going to create a text document that i can convert it into a csp later i will give it as a name any name like data1 and i will change the extension to dot csv and yes now it is a csv file and let me open this file and here i can add some data now of course you will add data as per your needs for your request for this example i am adding some dummy data here let us say i will say first name and i will say here last name uh let me also increase the font so i have created these two header for this two columns now in case you want to refer the variable name or the header as a variable from the csv you can give this headers or i will tell you later if you want to ignore them in the csv or in the csv dataset config let me add some values first here i will say here first name is raghav and i will say pal here i will add some more data i will say john robling and i will say graham bell so i have added some data here and now i can save and close this file now step number three will be we have done step number two and step number three is refer the csv file in jmeters csv dataset config so i will go to my jmeter now and here i have my csv dataset config now you can give any name here if you want to give any comments you can give here and here is where we will give our file path or we can also browse our file so i will click on browse and i will go to my desktop and yes my file is here see data1.csv i will open this and that's it now i will tell you about all these fields for now let me keep everything as it is and i will go and create a thread group because now i need to refer the values so i will create a thread group and inside the thread group i am going to create some sampler let me say i will create a java request a very simple sampler just to show you the data referencing and i will also add a listener to check the results i will add view results tree listener now to refer the values from csv file let me say step number four refer values from csv file using syntax dollar and in curly brackets give the variable name and i should also highlight this all these notes will be available in the description below this video so now here i can refer the variables from csv anywhere in my request and just for this demo what i'm going to do is in the name of this java request in the name field i will just refer the variables so that i can know if the reference is proper and is correct so let me say something here i will say request and i'm giving a underscore and the syntax is dollar and then curly brackets and inside the curly brackets i will give the variable name so the variable name that is coming from our csv file is first name so i will say first name here and then i will again give a colon i will give a underscore i can also give a space that does not matter i will again say dollar and in curly braces or curly brackets i will give the other variable that is last name so this is how you can refer so basically this is what you need dollar and the variable name and you can use this at any position anywhere in your samplers the example i am showing you may not be a very practical example but this is just for demo that this is how you can use it and wherever you want to use this variable in your request this is the syntax now i will save everything let me save this let me save this with the name csv data set config itself and save it and now i will run it so let us see what happens now i am going to run it so because we had a single iteration and a single user it has ran a single time and if you see here it has taken the request name by referring the first row the data from the first row from the csv file now let us say if i go to my thread group and make the number of threads as 3 or i can also make the loop count as 3 so that it runs three times and it should go to each row of my csv file because in my csv file i have three rows let me go and check again this is my csv file and i have these three data sets raghav i will go and again run my test plan from here i will clear everything and run again and let us see what happens and you can see here this time it has got data from all these three rows now let us come back to our csv dataset config and understand the rest of the fields now we have file encoding here and by default it is empty but if you want you can set the encoding to any of these and you can also edit and create your own encoding type and this will be required if you have some characters some data in your csv file that requires any of these encoding normally we can leave it blank but you can check with your team if you need any kind of encoding if you are not able to refer your data properly or there are some characters in your data that are not getting referenced properly you can check on this then we have variable names now if you see our csv file i have given the first row as the variable name or the header and i am using this as a variable name in my geometer just in case you do not want to use this and want to give your own variable names you can give it here for example i can say here i can say f name comma l name and in this case this is what will get referred in variables so if i now go to my request and you can see i am referring first name last name if i go again and run this now i will save and run you will see now it is not getting referenced because now i will need to use here instead of first name last name i will have to use fname and lname so this is what is if you want to give your own variables here let me remove it for now then here we have ignore first line in case you want to use your own variables and do not want to use the first line as header line you can make it as true but in our case i have kept it false because i want to use the first row here as a header row and i am also getting my variables from here so i have also not given anything in the variables field here then we have delimiter now if you are using a csv file the default delimiter is a comma and that is why it is called csv that is comma separated values but just in case you are using any other character for separating your data or being used as delimiter like a tab you can always give it here and you can use anything here it is a editable field it is not a drop down now if you want to allow coded data you can make it true false or you can also edit it so if you want to use something of your own you can do it here so i will say true so this is to allow csv data values to have to be coded then we have recycle on end of file and by default it is true what this means is suppose i have three data sets in my csv and i go to my g meter and in the thread group let us say i give number of threads as four or i can also give the loop count or iteration as 4 and then if i save and run it now you can see i have said recycle on end of file true so what happens is it will run three times with the three sets of data and then it will recycle that is it will go back to the first row or the first data set so that is why it has gone to the first data set again after reaching the end of file then we have stop thread on end of file and it is by default false if you make it true as soon as the last data set is executed it will stop the thread then we have sharing mode so in case you want to share this csv data file with all the threads in this test plan you can say all threads or just the current thread rope or the current thread or you can also give your own values here so by default it is all threads so i will say step number five will be run and validate and you can check if you are getting all your data referenced properly from a csv file and this is how you can read and get data from a csv file in jmeter i hope this was useful for you thank you for watching so let us now move to the next topic and in this session we are going to learn about j meter config elements and we are going to start with the http config elements in geometer now in gmeter config elements are very important if you go to your jmeter let me go and create a new test plan now also before i create a new test plan this is the csv data set config that we created in our last session and this is also a type of config elements so let me now save this and create a new test plan and if i do a right click and go to add we have config element here and then here you can see a lot of config elements we have already seen csp data set config then we have some config elements for the http requests then we have dns cache manager ftp http authorization manager java and so many config elements now here config elements are the elements that are executed before the sampler requests at the same level what does we mean by this is if you add any config element in your test plan at any level it will run before the request samplers at that particular level for example if you have added config element at a test plan level then any config element added here will run before any of the requests present at a test plan level also if i go to the j meter documentation i will go to jmeter website this is jmeter.apache.org and if i go to the user manual here and if i go to point number 18 that is component reference here you will see samplers logic controllers and listeners and here we have config elements so these are all the config elements whenever you need i will tell you some basic config elements and show you a demo but whenever you need you can check this list and whenever you require to add any of the config elements you can read from here so for now in this session we are going to focus on the http config elements and also if i go to this config element here you can see it says configuration elements can be used to set up defaults and variables for a later use by samplers and these elements are processed at the start of the scope in which they are found which i have already told you i can also copy this and put it in the nodes for your easy referencing and now i can go to my g meter and create a third group and then i can create some config elements on http requests but a easier way will be i will go to my browser i am going to a sample demo application that is orange hrm so this is the sample demo application i will also copy its link in the description of this video i will say demo app that i'm using and you can use any website for this in case this is down you can use any other website and here we have this username admin password admin 123 and i can log in but i want to record this and for that i am going to use the blaze meter chrome extension we have already learned how to use blaze meter chrome extension in the earlier session so you just need to create a blaze meter account and now i am already logged in i can give any name here i can say jmeter demo1 and i can start recording also in the advanced option i am only including the http and https patterns so i will click on record and i will go to this website again so that it gets recorded and i will add the username and password and click on login and just to verify i am on the home page i can click on something here let us say admin and you can see all this is getting recorded i can pause or i can stop i will just stop this i can run and check or i can edit and i can save if i go to edit here it will show me all the steps that i recorded and now here i can just download the jmx i will download the gmx here and it will download a gmx file and let me copy this gmx from here and i will go to my system where i have my j meter and paste the jmx here so it has come here i will go to my j meter and open this file which is jmeterdemo1.gmx and open and now here you can see it has created the entire test for us these are all the samplers it has recorded and these are all the config elements now before i go to each of the config elements and show you the details let me first try to add a listener so i can see the results i will save you results tree listener i hope you remember that view results tree listener is a memory consuming listener and we add it while we are creating or debugging our test plan but when we are actually running our performance test we should disable it so now i will save and run just to check if everything is running fine so here i'm i have started getting the results if i see the thread group i have a single user rampa period is 1 and loop count is 1 and yes i have got all these i see some failures here so validate credentials has failed and if i check here this is the request so this is filled which is fine i do not worry about the failures as of now what i am going to show you is all these config elements which are added by blaze meter so blaze meter has already added all the required config elements let us go to http header manager and if you see here in your request in your http request if you need any headers or even if it is an api request and you need any headers in your request you can always add it here and you can also use it for your api requests if you have any headers in your api you can add them here here is a add button you can add from here or delete from here and all these headers can come here and the good part is it can be added at a top level for all the requests so you do not have to add all the headers for every request you can edit once in the http header manager then we have user defined variables now here if you want to add any variable or if you have any value that needs to be referred multiple times in different requests it is good to add them here as a variable and you can click on this add button to add more variables and then this value can be used at multiple places by just referring this variable if i show you if i go to any of the request you can see this user defined variable base url1 is being used with this syntax that is dollar and within curly brackets we give the variable name so this will be very handy very useful when you want to reuse a value multiple times then we have http request defaults now as of now this is empty even if i go to the advanced section it looks empty but what you can do here is for example in your multiple requests you are using some values which are being used as it is every time instead of adding everything in the http request samplers you can remove from here so let us say this is being used every time i can remove from here and go to the http request defaults and i can add it here so for every request every http request the server name or ip will be referred from here so now i can go to every http request sampler and just remove all these server name values because it is now being referred from the http request defaults and if i save and run this it should still run fine and you can see we are getting the results here so this was http request defaults then we have dns cache manager now in case you are using load balancers at your servers you can use the dns cache manager if i click on this question mark it will take me to the documentation for dns cache manager and here you can see this element allows to test applications which have several servers behind load balancers and just in case you want to know more on load balancers you can go on my website automation step by step dot com and here if you go to stories you can see a section for stories here it will take you to all these mickey and mini stories so here you can read the story about dns and then you can also read a story about load balancers here so here and you can read this story and you will know what is load balancer and if you have any doubts whether you should be adding this in your test plan you can always talk to your dev or your network team if they are using load balancers and if you need to add the dns cache manager so basically this is used to clear cache on each iteration and use system dns resolver here so you can use these values then we have http authorization manager and this is for adding the authorization like username password and you can click on this add button to add a row and then you can use any of these mechanisms basic digest basic all these options we can use from here so in case your requests have any authorization we can add it from here then we have cookie manager so if you want to clear all the cookies on each iteration which is normally recommended for a performance test you can use this we also have all these options standard standard strict ignore cookies netscape default all this can be used here and similarly we have cache manager we want to clear the cache on each iteration otherwise the server will develop cache memory and we may not get a real time performance test results so we can clear the cache on each iteration and num max number of elements in cache also can be edited from here so these are the very basic config elements for a http request and all this we have got from blaze meter now in case you are not using blaze meter and you want to create your own test plan you can go to template so you can go to file and go to templates or you can go to the templates icon from here and then here if you click on this drop down and here you will get a different templates i will select building an advanced web test plan and i will say create and if you see here it will give you all the commonly used config elements for a web test plan or the http requests and then you can start creating your test plan from here so this is how you can create the config elements for our web test plan or the http requests in jmeter i hope this was very useful for you do try some hands-on and let me know if you face any issues i will meet you in the next session thank you for watching let us now move to the next topic so now we are going to learn the other general jmeter config elements in this session we will see the jmeter config elements that are widely and commonly used in geometer and this is going to be very easy and very interesting let me go to my geometer and i will go to a new test plan and in the earlier sessions we have already seen all the web and http config elements and we have also seen the earlier csv data set config now if i go here and go to my test plan do a right click add we have config elements and we have seen all these earlier the http and csv now let us see some others some commonly used let me go to counter and to show you a demo i will add a thread group and inside a thread group i am going to add a sampler let us say a java request now if i go to counter config element here you can create a counter i can give a starting value let us say i give a starting value as 1 and i say increment is 3 and i give a max value as 30 so i want to use a counter 1 to 30 with an increment of 3 and i can store this in some variable or i can use a variable to refer this values let us say i am saying num here and if i now go to my request this is just for demo so i'm saying here request and then i will say dollar and in curly brackets i will refer the variable so num this is the syntax and to see the result i will add a listener i will say view results tree and i will save this test plan and to save this let me give some name i will say config elements and now i will run this so here you can see i am getting request 1 and this one is coming from the counter config element and because we are running it only for one time this is showing us a single run i will go to my thread rope and i can increase the iteration count to let us say 5 and i will save and clear and run again and now you can see it is going from 1 to 30 and the increment is in the steps of 3 i will go to my thread group again and let me say i want to see 10 runs or let us say i want to see 14 iterations and i will save go to my view results tree clear and run again and let us see what happens this time so it will go until 30 and you can see it has gone from 1 to 30 with the increment of 3 and after that it has again started from 1 so wherever in your test plan you need to add a counter or need these numbers like this you can always use the counter config element let us see some more config elements i will go here and then we have we have already seen dns cache manager in the earlier session then we have ftp request defaults now if you have any ftp sampler in your request for example i will go to the thread group and add a sampler and we have a ftp request here and if i go here so if you want to have any defaults for your ftp request that you can add in the ftp request default config element then if i go to the config element again we have already seen http authorization manager in the last session then we have jdbc connection configuration and this is important so let me take it up here so in your test plan if you have any jdbc sampler or a preprocessor or a post processor the connection will be established using the jdbc connection configuration config element for example if i go to my thread group and i go to sampler and here you will see we have a jdbc request so if i add a jdbc request or if i go again to the preprocessors and you will see a jdbc preprocessor and if i go to post processor there is a jdbc post processor as well so if i add any of these preprocessor post processor or sampler you can see we do not have an option to create the connection for the jdbc or the database here the connection will be set up in the jdbc connection configuration so whenever you want to create a connection to the database you will use this jdbc connection configuration and in jmeter whenever you want to get any more details you can highlight that element and click on this question mark this will take you to the documentation for that particular element so you can see this is for jdbc connection configuration now let me again go to my test plan do a right click add and go to config elements and then we have java request default this is for our java request sampler then we have keystore configuration and this is used to manage any key store or certifications if you need in your test plan again if i go to this question mark it will take me to the documentation and here you can see the keystore config element lets you configure how keystone will be loaded and which keys it will use so in your request or your test plan if you have a need to use a ssl key store or certifications you can always use this keystore configuration and you can get more details on the setup from your dev or network stream on this so you just have to remember that you have this configuration element in jmeter and if you need you can get it from here then i will go to the next config element which is ldap we have ldap extended request defaults and ldap request defaults and again this is used for the samplers if i go to the ltap sampler i will go to sampler we have ldap extended request and ldap request so just in case you want to use this you can use the ldap request default config elements now let me go to we have a random variable here so let us say in case you want to get a random value i will say i want a random value from 1 to 10 and the variable i want to use is here i will say random num so i'm saying i want a random value from 1 to 10 and the variable name i want to use is randomnum now i will take this up and in my java request instead of num i will say randomnum and let me delete the other requests so i'll do a right click and remove and say yes and let me also move this key store configuration above and i will save everything and in my thread group i will just say i want to run five iterations and i will clear view results tree and run and let us see here i can also just disable the other config elements so that they are not executed and i will run now and you can see it is getting a random number from one to nine so here we have request and then this is the number nine six nine two seven if i run it again you will get a different set of numbers so here you can see ten seven one seven now here we have a option here seed for random function and here let us say i say 2 here what happens now is if i go back to my view results tree and i will run it again and here you can see it has used the numbers 93189 if i clear and run again you will see it has used the same numbers 931810 and again i will say just to verify and yes 931810 it is using the same numbers and this will be useful if you are doing any troubleshooting debugging or you want to reproduce your scenario so you want to use the same values in that case you can always have a seed for random function so this was random variable config element and then i will go again to config elements now we have a simple config element and here you can see we have keys and values so in case you want to have keys and values and want to override this in any of the samplers you can use the simple config element and if i go to the documentation you can see here the simple config element lets you add or override arbitrary values in samplers and you can choose the name of the value and the value itself so this is how you can use a simple config element and then i will go again to the config elements now tcp sampler config again will be used for the tcp samplers and we have already seen the user defined variables in the earlier session where you can add the variables using the add button and then can use these variables in any of your requests now in geometer we also have some plugins and if you add plugins you can get some more config elements but this is the standard set that we have seen here so all these elements that you see here the config elements these are all the standard sets and i have already shown you if you go to the apache meter website which is apache geometer dot org and here if you go to the user manual here you will see point number 18 component reference and this will take you to all these components we have samplers logic controllers listeners and then we have all the config elements so you can always refer any of the config elements documentation from here and also you can select any of the config elements and click on this question mark to directly go to its documentation i hope all this was very useful for you thank you for watching okay so now let us move to a very interesting topic and in this session we are going to learn how to run jmeter from command line and command line runs are very important so in this session i am going to show you how to run the jmeter test from command line how to log results from command line i will also show you how you can check all the help and options that you can use from command line i will show you how you can set users or ramper period from command line and then we will also see how you can run your jmeter test from command line from any location on your system now before i go into the demo let us see why exactly do we need command line now when you use the jmeter gui it is more memory consuming so any gui consumes memory so it is therefore slower and if you go to command line it will consume less memory it is faster the other option or the other reason is if you want to integrate your j meter tests or performance testing with any external process or in a ci cd system in that case you will have to use command line so you should have a command that you can integrate with any process or used in a continuous integration system and then you can run your geometer tests from there so now let us see i will go to my j meter and this is the test plan we created in our earlier session so let me just go with this you can use any of your test plan that you have created in this test plan i just have a very simple request a java request so it will not take a lot of time it will run very quickly in the thread group i have added one thread with five iterations and now i will first go to my jmeter bin folder so you go to your folder wherever you have your jmeter folder on your system i will also tell you on mac so the step is same for windows or mac that is step number one and let me increase the font for you so step number one is go to j meters bin folder and here this is my bin folder of j jmeter and now you have to go to your command line and go to this location if you are on windows you can directly go to this address bar and say cmd and hit enter you will see it opens command prompt on the same location wherever your bin folder is or manually you can copy this location and open your command prompt and then so here let me just copy this location that is the bin folder of jmeter and if you see this is on my d drive and on my command prompt i am on c drive so i will first change to d drive here by saying d colon and enter and now on my d drive i will say cd to change directory and i will give the location of my jmeter folder so let me do it again cd and this is the location and now on i am on my jmeters bin folder now later in this video i will also show you how you can run from any location without going to the bin folder or bin directory and then the first thing you can check is you can say j meter and if you are on mac you will say sh and then j meter dot sh and then the rest of the command or it should be she meter let me show you in the notes it will be very easy for you to follow from here you have to give the command you have to say j meter and this should be in all lower case and then you have to say minus n minus t and minus l now minus n means non-gui mode minus t means you have to give the location of your test file or your test plan so after minus t you will give a space and give location of your test file that is your gmx file and minus l is to log the results so here after space you will give the location of results file where it will lock the results now there are other options also that you can use i will tell you that later but this is the very basic command and this command will work on windows if you are on mac you will use the same command but then you will add a sh before this so this is this will work on mac or linux also this is for mac or linux and this is for windows so let me also put this this is for windows this is for linux or mac so i will go here and i'm on windows so i will say jmeter and here i should say open console or command line in case of mac it will be terminal and then go to this location and then run the command this is the command so i will say j meter minus n n minus t and minus t and then i will give the location and it is good to use the codes here so just in case there is any space in the location or the path of your test file it will not break if you put it in codes otherwise you can also add it directly but then make sure there are no spaces so it is always better to use codes now the test plan i am going to use is the same that i am i'm using here and if i go to the top and see this is the location it is in my jmeter bin folder and then templates and config elements.gmx so in that case what i can do is i am already running this command from my bin folder so i can directly go to the templates and then i will say config elements.jmx now in windows backslash works but if you are on mac or linux you can use a forward slash and then i have to give the minus ln location of the result file so let me say i will just say here report one dot csv and that's all if i hit enter now it will start execution of my test plan as configured on jmeter and yes it has run you can see the summary here and everything is done i can check the report file if i go here i will see this should be this one report1.csv and you can see here so here it has added all these results now i think there was some already existing results so it has just appended it so this is also one good thing that it will append the results not overwrite but you can change that and let me use this again with a new file name so even if the file does not exist it will create it for you this time i am saying report2.csv and if i now see it has created report2.csv and if i open this you can see all the results here it was a very simple and a very quick test so it did not take a lot of time so here we were able to run the command now we have seen how to run jmeter test from command line how to log results now let us see how to see command line help and options if you go to your j meter and again on the command line let me clear this i will say cls if you are on mac or linux you will say clear and i will say j meter minus h and hit enter and you will see here it shows all these documentation on command line also it says if you want to see all the command line options you can say jmeter.bat and minus question mark on windows and on linux or mac you can say jmeter.sh and hyphen question mark i will show you this later but here you can see to run apache in the gui mode you can open a command prompt and this is what you should use now here we have just used jmeter not jmeter.bat but you can also use jmeter.bat which will mean the same thing because this is the only bat file or the batch file in our folder and similarly for linux or mac you will you can say jmeter.sh and here is the command we use minus n minus t and minus l also we can use minus j for the log file we have seen this and also you can get all these graphical reports by using minus e minus o all these options you can see from here the other option is i can say jmeter or i can say jmeter.bat or just geometer should also work and minus question mark and here this shows us all the options that you can use from the non gui mode so you can see here minus h is for help minus v or minus minus version is for printing the version then we have minus t for test file minus l for log file minus n is for non gui mode then we have server proxies if you want to set any property username password everything is here you can run remotely so this is how you see command line help and options now before i tell you how you can run from any location on your system in gmeter you can also set the users or threads from command line and you can set other parameters like ramp up time and everything from command line and for that you can go on my website that is automation step by step dot com and here if you scroll down under performance testing section you will see a section for jmeter tips and tricks and if you go here it will take you to my youtube playlist and here you will find all these videos how to set thread users from command line and all these options and videos how to create aggregate result csv from command line and then how to run specific thread from command line so this will be very useful you can check all these videos if you like to and now let me tell you how you can run jmeter command from any location from the command line now if you see here we had to go to jmeter bin folder to run from command line and this is because the file that is jmeter.pad in case of windows and jmeter.sh in case of linux or mac is present in this folder so what i can do is i can just copy the location of this folder and i can go to my environment variables i am going to this pc on my computer right click go to properties go to advanced system settings and then environment variables you can also just search for environment variables on your windows and you will find this option edit system environment variables and here you can go to users or system environment variables let me go to system and search for path environment variable and click on edit now in case you are using an earlier version of windows where all these paths are available in a single field in that case make sure you do not delete anything go to the end give a semicolon and add the new path and in this case i can just add it from here click on the new button and add the path of the jmeter bin folder and say ok and close everything and now you can see if i exit from my command prompt and open a new command line and i can run the jmeter command from any location and it will show me the results you can see everything is coming fine so this is how you can run jmeter from command line i hope this was very interesting please do some more hands-on and let me know if you face any issues and if you have any questions on jmeter let me know and now we can move to the next topic so now let us move to the next topic and now we are going to learn a very interesting topic and that is how we can create html dashboard reports from command line and also from the gui and at the end of the session you will be able to create some very very beautiful reports in geometer let me very quickly show you if i go to google and search for jmeter dashboard reports and if i go to images so you can see these are the kind of reports we will be able to generate we will get a pie chart table and also we will get all these graphs so here we are going to see how to create a report from command line i will also show you how you can create a report from a existing csv result file then i will show you how you can study the dashboard reports and then finally how you can generate the same reports from the gui of jmeter so let's get started and step number one will be let me increase the font for you create a test plan or you can use any existing test plan that you have so you can create a new test plan or can use any existing test plan in my case i will very quickly create a new test plan so i have a new test plan here i will add a thread group and then inside the thread group i am going to add a sampler http request and here i'm going to go to this website that is lifecharger.org so i will copy this url this is my blog and i will add it here and of course https will not come here it will come here and if it is http you need not add it you can skip this but it is http so i will add it and here only the server name or the ip will come and then because i am going to the home page in the path i will just mention a forward slash and i will call this as home page and i will save this let me just save it under templates then i can just either add another html or sampler or http request or i will just copy and paste the same thing here and this one i will call this as i want to go to archives page so i will call this as archives page and here i have to go to this path that is forward slash archives so this is what i will give here and that's it rest of the things should be same and then i will again copy i'm pressing ctrl c and go to thread group and press ctrl v so it will copy and paste and this i want to go to about page so that i have two or three requests to show in the report and i will call this is about page and here the path is about so this is what i have added here very simple requests and i can also add a config element i can also add a config element for cookie manager and one for cache manager so that i want to clear the cache on each iteration and i want to clear the cookies on each iteration and let me keep them at the top here and now to see the results i will add a listener i will add view results tree and i can increase the number of users let us say let me just keep one for now and save and run this to check the results and i am running it now so this is home page archives page about page everything is fine and if i look at the load time it is coming around 944 for this one one zero eight seven and then two one nine seven let us say i add a assertion i will add a assertion here for duration and i will say it should take between or it should take less than 1000 milliseconds that is one second and now if i save and run this again i will keep the duration session here and run my test again let us see what happens now and yes there is one failure because of duration assertion again archives page failed and only about page was having a load time less than one thousand if i see archives page it is one one nine eight home pages two one one seven uh let me say duration assertion for 1200 and that should be fine now let me go and make the the thread or the users to 20 and ramp up time to 10 because now i am going to run it from command line and also as i have informed you in the earlier sessions view results tree is a memory consuming listener so whenever you are running your actual load or performance test you can disable it so i will right click and disable and you should only use it for creation and debugging or troubleshooting purposes so we have done step number one now step number two is open command line or terminal in case you are on mac or linux and go to jmeter bin folder so we have to run a command for geometer so we will go to the jmeter bin folder from command line now if you are on windows you can go to your command prompt and then go to the location where your jmeter bin folder is so wherever you have your bin folder for example this is my bin folder i can go here also in the earlier session i have shown you that if you add your bin folder in the path environment variable then you can run the jmeter command from anywhere on your system in my case it is already added so i should be able to run from any location so i will just directly run from here and then step number three will be run commands now we have the actual commands and the command to generate html report is i will say j meter minus n minus t and this is the same as we have seen earlier this is the general command for j meter let me increase the font and the color i will change it of course if you are on linux or mac you will say jmeter.sh in case of windows you can directly say jmeter or jmeter.bat minus n minus t and minus l now after minus t you will give the location of result file or sorry this is location of your test file that is your jmx file then minus l you will give location of your result file wherever you want to add the results and make sure there is a space we say minus t and a space here and then we give the location here and it is good practice to give the location inside course if there are any spaces in the name of any folder within your path it can break if there are no codes otherwise it will run without course as well but it is a good practice again minus l and the location of your result file and now there are two more options or arguments that you will use to generate reports and that is minus e this will generate your html reports or dashboard reports and minus o this will put the reports in the folder and you can give the location of reports folder now it is not necessary that you should be having a result file and the reports folder already created even if it is not created it will create a new file and a new folder here okay so this is to run or create your reports along with your test creation and in case you want to generate only the reports using some existing file in that case you will say jmeter minus g and location of your result file here and this is j in lowercase and then minus o the location of your reports folder so this is create report at the end of the test and then this command is for create report from a standalone csv file now let me show you both of these commands so i am on my command prompt and this is my jmeter i will save and i have already disabled the resultstree listener and the location of my file is in my jmeter bin templates folder and home page dot gmx so i will go here i will say j meter and if you are on mac you will say jmeter.sh or in case of linux as well i am on windows i will say j meter minus n minus t and location of my gmx file so let me just copy it from here this is the path and then i will go to templates and then i will say i will go to homepage.jmx and also make sure backslash works on windows if you are on mac or linux you should use a forward slash then i will say here minus l and give the location of my result file now let us say i want to create the result file on the desktop itself so here i will copy the location of my desktop let me just copy until here and then i will add it here and i want to name a file let us say result one dot csv and you can see as of now i do not have any result one dot csv file here on my desktop so it will create a new file so i will now say this is fine and now for the reporting i will say minus e and minus o and then again location of my report output folder and again i will give the location on my desktop you can give any location i will say report and that's it so it will generate a new folder called reports here and then we'll save the html reports there i will just call it as reports and that's it i will run this and let us see what happens now so it is now running and you can see it created this result.csv and as of now this is running and let us just wait for this to get completed and we have started getting some data here the average time in time max time error and yes looks like this is done although i think most of these are errors which is fine we will see this later let me go and check the result file first and here you can see all these results have come here and everything looks okay here i will close this and now let me go to the reports folder so this is our reports folder here and if i open this now you can see we have all these data then we have a index.html open the index.html and this is our report and yes you can see this is the report and of course you can see this is all showing failure and i think this is because of the time so you can see most of these errors are because of the duration assertion and looks like uh this is taking a long time i should go back and actually change the duration assertion to something some large value so that it does not fail or i i get a mix of pass and fails i will save this again and let me run this one more time i will delete the report folder and the result file and let me run again and check so yes it has started creating the result file and we have started getting the results and of course there are some errors again but that is fine this time we should have some past requests as well and this is done i will check the reports folder now i will open the index.html and yes you can see there are some pass and some fields but now we have got a result and you can see now the dashboard we have dashboard charts and custom graphs i will first go to the dashboard and here you will see the overall information like what is the source file used the start time and time and any filters and then here you will see a abdex or application performance index now if you click on abducts it will take you to a wikipedia page so it is a open standard and it gives us some standards for a performance test and here you can see here the threshold is one second 500 milliseconds and this is the toleration and the frustration threshold and according to that it will give you some reports now you can always change this i will tell you this later if i go to this graph you can see a overall summary of your pass and failed requests and then here you can see your stats so all your stats the samples fail minimum maximum time and all these throughput everything you can check here this is a summary and then all the errors will be shown here and most of our errors are because of the duration time now i will go and go to the charts and we have overtime chart so here you can see this is the overtime chart and you can also see the granularity set is two seconds you can change this if i go to my bin folder the jmeters bin folder you will see a file called reportgenerator.com you can open this in a notepad or any text editor and search for granularity and here you can see the granularity is set for 2000 milliseconds that is two seconds sometimes you will find this is set to a higher value like sixty thousand which is actually one minute and in that case if your performance test is very small and very quick and you have granularity set for one minute you may not see a very detailed reports here so you can see here i am getting separate lines for every request like about page archives page and home page because it was a very quick test and granularity is 2 seconds if the granularity is 60 seconds i will not see a very detailed report so you can change it from here and let me also tell you from where you can change the abdex thresholds if you go to your bin folder and go to jmeter.properties and open it into any text editor and here search for aptx you can see these are the thresholds that you can change from here so you can change all this from here and i will show you the other configurations later on but now coming to our graphs so here is the response time where we have the average response time in milliseconds here and then this is the elapsed time so you can see this is how our requests performed and we can see all the requests separately you can also filter this out suppose i just want to see the about page i can do it like this so all this can be done from here then we have response time percentile chart and again we have the filters here active threads over time so you can see these are the active threads that we had and it went to 20 because we have set users to 20 which is the max and then it has ramped up and then rammed down like this and then bytes throughput over time latencies chart we have here connect time is here for all these three requests then i can go to throughput so you can see the throughput and here is the number of hits per second and the elapsed time so you can check all these here's we have code per seconds then we have transaction per second chart here for each of the requests and here it will also show you about the failure so what happened due to failure you can check from here then we have total transactions per second here response time versus request and the latency chart here then i can go to response times and here this is very intuitive you can see your response time percentiles and then let me come down and check the response time distribution so this will be very handy you can check all these response times so you can see what was the time when your particular request took a large amount of time and you can then go back and check your locks on the server or you can hand it over to your performance engineering or dev or network stream to see what actually happened at this position at this particular time and they can troubleshoot this we have all this here so you can also have any of the custom graphs now before i show you how you can directly create from a result file let me also take you to the jmeter website so if i go to j meter that is jmeter.apache.org and go to user manual and here you will see step number 14 for dashboard report if you go here you can see all the details about the dashboard report the overview and all these charts you can see the details and all the configurations here then if you want to configure the dashboard report you can see all these options that you can use for configuration so here you can do all types of configuration for your report you have all these general settings the title date start and date you can see the granularity that we have set and all these options are here the graph settings are also here in case you want to do any changes you can do that export settings are here then specific properties for graph filtering everything is here all these configurations and then these are our commands that we are already learning that is how to generate a report after load test and we have already seen this and then if you want to generate from an existing sample csv file this is what you will do minus gn minus o and this is what we are going to learn that how you can create the same report from an existing result file so let me just now say i already have my result file which is result1.csv and i want to generate a report from this file so in this case i will say let me clear everything and i will say j meter minus g and the location of my result file so i can say here result 1 dot csv sorry this is result so result 1 dot csv and then minus 0 and i will give the location of my report folder so let me create a new folder reports 1 and hit enter and you will see reports1 folder is created and if i go inside and check the report you will see the same report here so this we can generate even without running the load test if we already have the report file with us so we have seen all these let me also show you how you can generate the same report from gui so just in case required you can go to your jmeter gui and go to tools and then here we have option generate html report you can give the csv or the jtl file location you can browse here you can also browse your user.properties file which will be in your jmeter.bin folder so in your bin folder you will see this user.properties file and then you can also give the output directory or the folder where the report will be generated so let me try this i will browse my report file which is on my desktop so i'll go to my desktop and i will select result1.csv uh let me just use the output directory i will say reports2 and let me click on generate yeah i need to specify the user.properties as well so i will go to my jmeter bin folder which is in my d drive tools i have jmeter folder here and then bin folder and this is my user dot properties file open and now let me generate the report so it is saying generating report and now it is created if i go and check on my desktop yes i have this reports to folder generated and this is my report generated here so this is how i can generate the reports the html dashboard report from command line and gui i hope this was very useful for you please do some more hands-on and let me know if you face any issues and now we can go to the next session so let us now move to the next session and this is interesting in this session we are going to learn how to extend our jmeter and how to add jmeter plugins manager so this is going to be very easy i'm going to show you a very easy and fast way to find the plugins for your project or your test how to install uninstall or upgrade plugins and before i do this let us see why exactly we need plugins and what are plugins so if i go to my jmeter you can see this is my jmeter and here you can see we have all these different options and if i go to add we have different config elements listeners assertions test fragments and if i create let us say a new thread group and i do a right click on the thread group and go to add we have a lot of samplers now all these options that you get after you install jmeter or after you set up jmeter all these are standard options and standard functionalities that come in built in geometer however jmeter is an open source platform and a tool and there are lot of people who keep on creating new functionalities and new features for jmeter and these new functionalities or new features are added as plugins so these are called as plugins that you can add into your geometer and then you can use that feature or functionality and if i go to i'll go to my browser and search for jmeter plugins and i will go to this link so here i am on jmeter hyphen plugins.org and you can see a lot of plugins are available for jmeter and if i click on this 81 more plugins they can be more at your time you can see we have a lot of graph plugins so in case you want any kind of graphs you can check here then we have a lot of plugins for thread groups like ultimate thread group concurrency etc then for timers we have there are a lot of extra listeners that you can add to your geometer then we have all these tools like command line graph plotting tool https simple table server jms etc then functions logic controllers samplers config elements preprocessors post processors etc so whenever you are looking for some new functionality or feature in your jmeter and you do not find that in the existing set of features or options you can always come here and then you can see all the different plugins and features extra features available let me also add this link here all these links and notes will be available to you in the description of this video and now whenever you have to get any of these plugins what you will do you will do is you will come here and go to that link of that plugin and then here you can click on download which will download a jar file and you can then go to your jmeters bin folder so or you can go to your bin folder or maybe go to lib folder and go to ext and then add that particular jar so you can see a lot of earlier jars are also available here you will also find the documentation on this page how to add and use this plugin let me also show you something some different plugin let me say i go to uh this perfmon metrics collector and you can see you can always download it from here and then add to your jmeters folder now an easier way to do all these setup and installation of plugins is jmeter plugins manager and if you go on the same link that is the plugins wiki you will see a link for plugins manager you can go here and then you can see plugins manager helps you to install uninstall upgrade and find the plugins and you can also see a catalog of plugins here and then you just have to download the jar file and put it into your jmeters lib ext directory and then you will restart your jmeter and you will find the option for jmeter plugins manager under the options menu so let us see that i will write down the steps let me first click on this jar file so that it starts downloading the jar for me so it will download the plugins manager jar and now i will write the steps so step number one is download plugins manager jar from this link and then step number two will be add the jar file in j meter lib ext folder and restart j meter so let me check yes this is downloaded i will see this is here and i will cut from here go to my j meters bin fold lip folder so this is my j meter and this is the lip folder and this is the ext folder i am just going to paste it here and it has come here and now i will restart my j meter i can go to j meter file and click on restart i will just restart it now and let us see and you can see jmeter is restarted so now if i go to my options you will see we have got a plugins manager here and now if i click on this plugins manager you can see here we have three tabs installed plugins available plugins and upgrades if i go to installed it will show you all the plugins which are already installed in your jmeter and if you click on any of the plugins you can see all the details and documentation and the link or for the documentation of that particular plugin and then you can also check the review changes here and you can go to any of this plugin and then see its documentation then you can always search for a particular plugin from here if i go to available plugins tab you can see all these are the plugins that are available and you can get it from here directly so if you have to get any of the plugins for example i can search for any plugin so here we have custom thread groups we have we have this step-by-step debugger let me try this one i can check this and it will give me all the links and documentation here and then here i can review the changes what all i have done this is all what will happen when you click on apply and restart jmeter here so if you click on this apply changes and restart geometer it will do all these changes the good thing is you can do multiple actions on a single apply and restart geometer for example if i want to add more plugins like this i can do that or if i want to uninstall any plugin i can go to installed plugin tab and let us say i want to uninstall this i will uncheck this so you can see it will uninstall this particular plugin as of now i do not want to uninstall anything i will just keep it as it is and this is available plugins i just have to check this so to uninstall you have to go to install plugin section and uncheck to install you have to go to available plugin sections and check and if you want to upgrade you can go to upgrade section and see if there are any plugins that have a newer version and can be upgraded so as of now i do not have any upgrades so i will go here and i am installing something new which is blaze meter step by step debugger i will go here and click on apply changes and restart geometer so it will get the plugin and then restart jmeter so jamita is now restarting now to check let me go here to options or let me just go back to plugins manager i will go to options and plugins manager and in the installed section you can now see we have blaze meter step by step debugger i can check this and if i want i can get the documentation here this is the github page and i can see how exactly it works so in the usage i can find it under the run item of the main menu so if i go to my jmeter and let me close this one and if i go to run you can now see we have step by step debugger added here i have a video on this as well if you go to my website that is automation step by step dot com and here if you go to the section for performance testing and go to jmeter tips and tricks here i hope this video is available here let me check very quickly yes you can see this one how to do step by step debugging here i have shown how exactly to use this step by step debugger so this is how you can very quickly and easily extend jmeter by using jmeter plugins manager let me also write down step number three which is check gmeter plugins manager is added and then you can start using the geometer plugins manager so i hope this was very useful and we can now move to the next session hello and welcome to this session in this session we are going to learn how we can create rest api requests in jmeter and this is going to be very easy and very interesting and i will show you the entire process step by step from scratch and we are going to create a get post put delete apis in jmeter so let's get started and i have my jmeter up and running here and here we do not have anything in our test plan it is an empty test plan you can also click on this new button to create a new test plan and here i will do a right click and i will say add threads and i will add a thread group so here in this thread group i can manage the users the number of users that will run this request and ramper period and loop count all this is for performance testing as of now i just want to create a request and run it so i will leave all this as it is and then i will go to google and search for sample rest api for testing and here i will go to this website req res dot in here are some sample rest apis that you can use for testing so we have all these get post put delete apis i will go with list users first and this is the url i will open it in a new tab so this is the url of this rest web service now here to create a rest api in jmeter either you can add some template so for example if you go to file you will see templates here or you will see a option for creating templates right here in the toolbar so you can go here and here you can find some samples that you can use for example you can use a sample to create a http request and then we can grow over it or build over it but for now i will show you from scratch so i'm just going to this thread group that i have created and do a right click say add sampler and we are going to use http request and here we have got this http request now here is the name if you want you can change the name here so i will say this is get user list and now here you can see we have a basic section and a advanced section we need to work on the basic section as of now and here we have a protocol field then we have a server name or ip field a port number field then we have the http request method so from here you can select your http request method like get post put delete etc and this is the path field so now for this request this is the url i'll copy the url and here is the url now here it has some parts different parts we have first the protocol which is http so here is the https protocol which will come here in the protocol field then in the server name or ip we will just have this req res dot in and then the rest of the path will go in the path field here and then we also have parameters so here are the parameters and in the parameters we can give these parameters that is page equals 2. so in case you have any parameters in your url you can give it there so let me now just put this https will come here and in case it is http then you can leave it blank as well then in the server name or ip i will put this req rds dot in this is just the domain name i will put it here and then http request is get and the path is this forward slash apis forward slash api forward slash users and then if i want i can also append the parameters along with the path but i will create the parameters here so i will go to parameters section and click on add and here i will give the parameter so the parameter name is page and the value is 2 and then we also have other options like url encode content type include equal etcetera which i will leave for now now in the next session i will also show you how you can actually record your api request in jmeter but for now i'm going very basic now here in some of your requests you will also need to provide the request headers and for that you can go to the http request do a right click add and go to config element and say http header manager we also have http cookie manager cache manager request defaults so you can go to header manager and here because this header manager is added as a child of this request so it will work only for this request in case you want to use it for all the requests you can put it at the top of all the requests so here you can put your headers whatever request headers you want you can add it from here and put it here then in some request we may need to have authentication like adding username or password or oauth or any other kind of authentication in that case you can do a right click on your request add and when you go to uh here config elements you will see http authorization manager so again this can be used for providing any kind of authorization to our apis now in this case i do not need this i do not need header and authorization so it will work without that as well now i have created my request uh let me also show you the steps i have written some steps to save some time so we have already done this we have added a thread group right click on test plan add thread users and third group right click on that group add sampler http request and then add the api data in the http request sampler now step number four is add view results tree listener and we can also add a table listener so you can add any listeners you want to listeners are used to store and view the results so for that we will add the listeners i will do a right click on the thread group and say add and here we have a option for listeners so there are a lot of listeners what we will need here for now is view results tree i will add this now take care that view results tree is a graphical listener it has some it takes some memory while running so when you are actually running from command line you can disable it you can right click and disable from here but it is very good to check our results and make sure that everything is running fine so initially we add this and then i will also add a listener for getting results in table i will add view results in table so i have added these two listeners i will now save my test plan i can save it at any location on my system i will say this is j meter rest api now i can run this i will have to use this run button to run and i have gone to the view results tree listener to check the results and when i run this you can see i have got a single result for get user list api and here i have got the sampler result and you can see it gives me all the information start time load time connect time latency size in bytes sent in bytes and then here if you see the response code is 200 okay which is fine and if i go to the request here so this shows me the request that went to the server this was the request that went to the server so sometimes if you face any issues you can always go to the request and check what is the actual request that went to the server there can be some mistakes like forward slash colon or some issue somewhere so you can always check this so you can also see it has taken the parameter and it has created a proper url which has gone to the server so here then you can see the request body request headers here so these are the request headers then in the response data you can see the response body which gives us the list of users and the response headers here so all these are our response headers and then if you want to find something you can always find from here and then if you do a right click here let me see if i'm getting other options no that is fine i do not have more options here so this is what how you run a get request now of course if you want to run with a user load you can always increase the number of users here set the ramp up period then set the loop count if you want how many loops you want all this you can set for example if i say 10 users and now if i go you can also see view results table here i have the results in a table format where i get the start time uh the label the sample time this is the time taken the status bytes latency connect time so now i have set two 10 users i will save and clear all the results and run it again and now you can see it is running with 10 user load and all this you can see the time taken and status and the same thing you will see in view results tree as well so this was a very simple get request now let us see a post request and post is for creating a resource i will click to click on this post create and this is the end point i will go here in a new tab and this is the url of the request i will copy this and i am going to create a new sampler http request and here i will name this as create user and then i will give the url here and as we know we have to keep the https in the protocol field and then here it will only be the server name or ip and make sure you do not even have any forward slash or columns here and then the rest of the path will come in the path field and that's it now i will change the http request method to post and save everything now here we also need body for a post request because it is creating some resource so it needs a body and this is the body i will copy it from here and in my request there is a body data section here and i will paste this here so i have just added my body here now if you want to uh give headers like content type application json and anything like that we always can use the header manager like this and then for authorization we can use the authorization manager and i will also move it up so let me move it here that's it so we now have the create user we also have the advanced section here so just in case you need some more advanced properties or settings like if you want to set the time out and embed resources from html files all these things you can do here if you want to set any proxy server information that also you can do here for now for us the basic setup is enough i will save and i will go to my results let me now move the number of threads back to one and i will clear all the result and run again and here you can see i have also got a result for create user if i see here this is the sampler result and i am getting here 201 response code 201 created and this is for successful creation of a resource on the server and then again i can see resource a request request body request headers response response body response headers and everything so this was a post now let us try with a put request this is a put request and this is for updating a resource and this is the url i will copy the url and here in my jmeter i will go to thread group do a right click add sampler http request and i will rename this to update user and now i will just drag and drop it here and i have to give the url here https will come here and here we will have only the server name and the rest of the path will come here like this so we have https in the protocol in the server name we have req res dot in and in the path we have forward slash api forward slash users and forward slash two in the http request i will change this to put and then for put as well we need a body data so i will copy the body data or the message from here and edit here and that's it we do not require any authorization or any headers for this request so i will save and go to view results tree clear everything and run again and you can see we have got a update user and we have got response code 200 okay and if i go to the request i can see the request body so this was a request that went to the server this is the url and then this is the put data that went to the server and then in the response i can see the response body so in the response i get updated at this time so this is fine and the response headers so this was a put request let us now create a delete rest api request and we have a delete request here i will go here and open in a new tab to get the url i will get the complete url here and now on jmeter i will do a right click add http request and i will first rename this to delete user and i will move it up and then the same thing i have to give the server name here the protocol here and the path here and here it will be delete and for delete we do not need any body so that all is should be fine i will save go to my listener clear all the results and run again and here i have got a delete user request which is running fine i can see the sampler result and here i am getting the response code 204 which is for new content and this is fine for delete and then this is request request body request headers and then response response body and response headers are here so you can see all this here so this is running fine and we have done here step number six we have done save the test plan run and check the results so we have done all the get post put delete api request in jmeter now in the next session i will also show you how to run soap api request in jmeter and i will also show you how you can actually record a api request in jmeter so i hope this was very useful for you and i will meet you in the next session thank you for watching hello and welcome to this session in this session we are going to learn how to create a soap api request in jmeter and this is going to be very easy and very interesting and do not worry if you have never worked with api requests in jmeter i will start from scratch and we will go up step by step so in this session we are going to cover how to add the request sampler how to add the request headers how to add authorization and body and how to add assertions and then finally we will run and check the results in case you find the speed of this video faster or slower you can always control the speed from the player settings and with that let's get started and here is my j meter i will expand this to full screen and here we can start creating our test plan so before we create the test plan let us see the api that we are going to test so i will take some online example i will search for a calculator web service and you can use any of your apis as well so once you learn how to create the api request then you can use it for any soap api web service so here i am going to the calculator web service i will also copy the url in the notes all these notes will be available in the description or the notes section of this video so you can refer it from there here in this service we have add api request divide multiply subtract all these services and here is the service description or the wsdl of this api service now we can create a api for addition which will add two integers and give us the result and before we do that let us go to j meter and a very quick and easy way will be instead of starting from scratch or creating everything from 0 we can actually use a template if you go to file there is a option for template here you can go from here or you can go to the main toolbar and here we have a templates icon so go here and here in the drop down you will find a option building a soap web service test plan click here and here are some links that you can check i will click on create and this will create the test plan and here you can see we have a example api already added and all these sections added we have a user defined variables section where we have created a variable so the host name is host and this is the value and this is the description we have a http request default section and here you can see the variable that we created in the user defined variables is being referred here and this is the syntax so we use dollar then curly brackets and the name of the variable within the curly brackets now why we have used this before that let me show you how you add this if you go to the test plan do a right click and go to add config elements you will find http request defaults here and you will also find user defined variables here so you can add it from here and http request default can be used in case your api requests or you have multiple request that use some common field for example in this case this is a common field which will be used by all the apis so instead of adding it every time in the api requests we can add it in the http request default and it will be referred from there and then the user defined variables again you can create variables for values which are referred at multiple places and you can just refer the values using the name of the variable the advantage here is suppose you have to change it this value you just have to make the change here at a single location and it will be referred at all the places from here so as of now we are referring it in the http request default and then this is our thread group where we have number of threads as five ramp up period as five and loop count as two and then inside the thread group we have our soap request now in this request the server name and ip is being referred from the http request default which is this host and which is this value and then we have the path here the http request method is post and then this is the body of the request and if you expand this request you will also find some other elements there is a http header manager so all the request headers can go here and then there is a response assertion so in case you want to check that you should get some particular value in the response or any other thing like response code response message request headers etc you can add the response assession we can also add authorization manager if your request needs any kind of authorization like username password or oauth so if you go to the request to a right click and say add and say config element you will also find http authorization manager here and here you can add your authorization so this was a sample but now we are going to start from scratch and show you so i will go to the test plan do a right click and say add thread group so i'm going to add a new thread group inside the thread group i will add a http request sampler so for a soap api we add http request and the same for rest as well as we have seen in the last session so now i'm going to go to this ad i will click and this will open in a new tab and here i can use the i can just use this i can actually you go to the wstl url and copy this url and then i will add it here in the server name or ip and here the http part will go in the protocol section here and if it is http then you do not have to provide anything you can keep it blank and if it is https then you can provide https here then this is the server or the domain and then this rest of the part will go into the path field so i will copy this in the path field and here we do not need question mark and wstl we only need until here so this is how we provide the values in case there is a port number required for your service you can provide that here and then the method will be post here so i will say post and that's it now we have to provide the body data here now to get the body data you can actually get it from here so you can see this is here i can get it from here or if you have any wsdl parser which can pass a wstl document and generate the request you can do that there are tools like soap ui that you can use or catalog will also work or uk you have some browser extensions as well if i go to my chrome browser and go to the web store here i will search for a extension called whistler so this is the extension whistler this will help to pass the wstl files and generate soap messages and in my case it is already added so you can add it to your chrome and here you can see this is the wstl or the whistler icon and it will be grayed out if the there is no wstl url on your browser it will only get active when you have a wsdl url and now you can see it is active so this is active now i will click this it shows me all the requests i will click on add and it shows me the request message or the body of the add request i will copy this and go to the body data paste it here and this is added now i need to provide two integers here i will say here 2 and i will say 3 so i have added the body data as well i can save my test plan so i will click on save and let me just save it by the name soap underscore api so here we have added the request sampler now for headers i will do a right click on the request and say add and say config element and we have http header manager so we can add a header manager like this as of now i am not adding the header i have just added the header manager and then for authorization as well you can do a right click add config element and we have http authorization manager so in this case this request does not need any authorization so i can leave it blank or even if i do not add it that should be fine and then we have already added the body if you want to add the assertions you can add so i will do a right click add and then we have assertions so we have a lot of assertions here i will just add a very simple response assession and as of now i am not adding the actual value once i run the request i will get a value from the response and then i will add it here and then i will have to add the listeners so that i can view the results so i will do a right click on the thread group add listener and i will add a view results tree listener and as we have learned earlier that p results tree listener consumes some memory so you can use it while you are creating and checking your request and after that once you want to run the actual performance test you can just disable it do a right click and disable i will also add i can add some more listeners let me say i will add a view results in table listener as well so now i have created my request here i have added the body let me just run and see if it is giving me any response and i'm just keeping the user count to 1 as of now and i will say run from this run button and it has failed if i see you can see in the response message i am getting unsupported media type and this is because we have not given the content type header so i will go to the header manager you can see in the template as well we have the content type header and this you can get from your request or from the details of your request if i go here you can see the content type header here is this one so this is what i have to add in fact this is the same as we have seen in the sample or the template so i can actually add the same thing here as well so i will copy this and go to my header manager and say add and say content type and then the value is also the same here i will copy the value and paste it here the next thing i have to add is the soap action so you can see here we have the soap action and this is the value so i will add this as well i will say add soap action let me copy it again and it was added here as well you can see soap action and this will be equal to this url for add api and i will add it here and i will save it now you can also see all these config elements the header manager authorization and response assession all these will be applicable only to this particular request because these are added as a child of this request in case you want this to be applicable to all the api request you add in your third group you can keep them out of the request so it will be applicable to all the requests in the thread group let me also change the http request name i will say add so it is easier to refer and now it is changed so we have added the header manager i will go and check again i will run the request again and yes you can see this time it has passed and we are getting the response code as 200 okay if i go to the request this is the request body this is what went to the server the request headers as we have added all the headers and some default headers as well if i go to the response data this is our response and here we have the add result as 5 which is that the addition of 2 and 3 and the response headers now i can just copy this add result parameter or this particular node and this i will add in the response assertion i will say apply to main sample only and this is a text response and i can just add click on add and i will add it here you can also add a session for response code as of now i'm just adding this and now we also have a listener for checking the assertion result so if i go to listener there is a listener for assertion results so if i now run it again i will clear all the earlier listeners or results and run it again so it is running fine here in the table also you can see the sample time this is the time taken by its latency everything and in the assertion result everything is fine just in case i change the assertion let us say i make here 10 and save and if i run again so let me just see here all right so you know um the reason it was still running was it is it may also be running this thread group the template thread group we should be disabling it so i will just go here right click and disable so it does not run this and only runs our this thread group so i will now run again and this time you can see the response assession failed and here it says test field expected was add result 10 and therefore it failed so therefore this is how you will get the results and therefore you can here as well you can see it has failed because of the response assertion so i will correct it i will just again make it to 5 so now we have added all our elements and everything is done i can now go to my thread group and i can increase the number of users or the load as i want and then if i now run this i will clear everything and run and you can see it is now running and it is running with 10 user load so this is how you can add a soap api request in geometer i hope this was very useful for you i will meet you in the next session thank you for watching so let us now move to the next topic and this is very interesting and in this session we are going to learn functions and variables in geometer and we are going to go very basic and we will learn what are functions what are variables and how to use functions and variables i will also show you the syntax so in geometer we can use a lot of functions and variables and if i have to define functions in jmeter i can say these are methods used to populate fields in any other element of a test plan and the syntax is i will say dollar and then curly brackets and double underscore and the function name let me highlight it with a different color so this is the syntax and in the moment i will show you this is very easy do not think that this is going to be difficult i will also show you how exactly you can get help on functions directly in jmeter uh and the other syntax is if you also are using any variables you can say function name and in brackets i can give the variables for example variable 1 variable 2 and so on and i will show you an example in a moment so this is what function is and this is how we use functions in geometer now when i talk about variables so variables are containers that can store values which can be referred in any element within a thread so within the thread if you want to refer any value you can store it into a variable and then can refer it at any other location or element within that thread and the syntax will be so it is almost the same we will use dollar and then curly brackets and then we give the variable name whatever name we have stored or used we will give the variable name like this now let us go to jmeter and see how can we use functions and variables i will have i have a new test plan i will right click and create a thread group and let me create any sampler i can use a very simple sampler like a java request now here let us say we want to log something so there is a function called log and i can go to the i can go to options and you will see here no you have to go to tools and under tools you will see this function helper dialog you can go from here or can press ctrl shift f1 or you can also see there is a direct icon here function helper dialog on your jmeter toolbar so i will go here and you can see this is a function helper dialog and in this drop down you can see all these functions that you can use and let me search for log as i typed log i have got this function here and then you can see all these details about the function you can give the values here and can generate the function which you can copy directly from here and i can also go to this help it will take me to the documentation of this function and will show me how exactly to use this function so for now i will say log here and let us say i want to log something say hello world and i do not want this log level as of now i will click on generate and copy and you can see it has generated the function for me directly and i can just use it from here it also shows me what will be the result of this function and now i can close this and here in place of my name of this sampler that is java request i am just copying this function so it is saying log hello world and let me also add a listener to see the result i will add view results tree and now i will save this i will say functions and variables.jmx and i will run this and see so you can see in place of name it has logged hello world now i can also use functions along with some static data for example i can say here request space and this function which is locking hello world and of course because i am not using the other parameters i can remove these extra commas from here and this should still work i will save and run again and now you will see it is saying request and then appending whatever is the result of the function now i can go and see some more functions i will again go to the function helper dialog and let us see a time function so if i go here time here i can give the format you can always go to the help but here you can see i can give the format of the time let us say i want to have a time in dd mm yy yy and i will say generate and copy and now i will add one more sampler for a java request and in place of name i am adding this function now i am just adding all these functions in the name for this demo only just to show you how functions work and what will be the output in real world you will need to use them wherever you need in your elements or requests so let me now take this up and again i will save and i will clear everything can run and now you can see it is showing me the current date here if i also want the time i can just go here and say that i also want a time in hours minutes and seconds format so this is hh mmss and that's it i will save and run again and now you can see it is also going showing me the date and time then i will see some more functions i will go to function helper dialog and let us say some thread function so you can see we have thread group threadnum let us see threadnum here and this is a function which will show me the current thread and this can be useful while you are doing your performance testing let me copy this and i will create a new sampler to demo this a java request and i will just add this threadnum and also let me append something i will say threadnum space whatever will be the number of the thread and to see some real output i will go to my thread group and increase the count of users to 5 so that i can see the thread number and now i will save and run and check so you can see here it is saying here thread number one then here it is thread number two thread number three four and five so if you want to lock the thread numbers in your result you can use this and similarly there are other functions like i can also get a machine name or machine ip you can see machine ip and machine name is here so this will be useful if you are doing a kind of distributed testing where you have multiple systems running the performance test and in the result you may want to know what machine or ip was used to run a particular request in that case you can use a machine name or machine ip then there are some functions like in sum so let us see in sum i can give a number here i can say 2 here and 3 and say generate and copy this generates a function to do integer addition of 2 and 3 let us say i add this here and let me go back to the thread group and just keep the thread count to 1 and also i will disable these other samplers and now if i run you can see in the report in the result i am getting the addition of 2 and 3 that is 5. also let us say if i want to store this in a variable i can say here i can give a variable name say result so this will be stored in the variable result and this variable now i can use anywhere in my within my thread so for example i go to the next request let me enable it again and here i'm just going to use this variable so to use the variable we know the syntax is dollar and within curly brackets we use the variable name that is result in this case so let us see what happens i will save go to the result clear all and run and you can see at both the places i am getting 5 because here it was the addition and here we have referred the result of the addition which was stored in the variable called result now i can also say here i can actually again do a again call the integer sum underscore underscore in sum is the function and then here i can say i want to add 2 and then instead of giving a hard coded value for the second number i am referring the variable so i can say dollar and within curly brackets i can say result which is the which stores the value of addition from the first request and then that's it i will close this function so here it should add 2 to the result of the earlier edition that is 5 so we should get 7 here so let us see i will save clear and run and yes you can see we are getting 5 and 7. so this is how you can use functions and variables and this is very handy you can always go to the function helper dialog and see what kind of function you want and you can get it from here you can always go to help it will take you to the documentation and if you go to the jmeter website that is jmeter.apache.org and go to user manual and here under point number 20 you have functions and you can see all these functions are here so you can always check from here what all functions are available and what is their use and how you can use it all the documentation is here and you can then use all these functions and variables in your test i hope this was useful thank you for watching hi great to know that you have completed this master class and crash course on jmeter this was to get you started with jmeter and now you are ready to work with jmeter you can now go to my website that is automation by step dot com and here if you scroll down you will see a section on performance testing and you will see all the jmeter beginner intermediate advanced and tips and tricks i will also add this master class in this list and you can learn everything about jmeter from here if you have any questions you can let me know and do share your knowledge with everyone and never stop learning [Music] [Music] [Music] you
Info
Channel: Automation Step by Step
Views: 176,168
Rating: 4.9396019 out of 5
Keywords: jmeter complete course, jmeter training, jmeter beginners training, jmeter beginner tutorials, jmeter tutorial for beginners, jmeter complete tutorial, jmeter step by step from scratch, how to use jmeter, jmeter crash course, jmeter by raghav pal, how to setup jmeter on windows mac and linux, jmeter reporting, jmeter recording, jmeter assertions, jmeter how to get data from CSV File, jmeter config elements, how to run jmeter from command line, jmeter api testing
Id: SoW2pBak1_Q
Channel Id: undefined
Length: 211min 26sec (12686 seconds)
Published: Tue Feb 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.