LoadRunner Developer: Setup, scripting, test execution & integration with InfluxDB and Grafana.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi I'm Paul from test data services and this video is all about loadrunner developer the video is going to show you an install from on a clean operating system it's going to show you the recording of a script and then the running of that script in a 50 user load test visualizing the results in graph honor because the results will have been sent in real time to in flux DB now this is a sort of test that's very easy to incorporate into any CI CD system that you've got and I think that you'll find this useful I'm including all of the steps to go from a blank operating system except for Chrome I've already downloaded Chrome all the way through to running a test so just skip over with the chapters down below the bits that you don't need to sit through so what we're going to do to start with is download 20:20 I've already logged in to the web site so it's now downloading and won't take very long to download once it's downloaded there we go let's show in folder we need to unzip it extract it so we'll do the extract now now while it's doing that extract let's just set an environment variable we need to have one environment variable to support the dev web protocol when it's standalone you don't need to do this if you're installing loadrunner like professional so let's go to advanced environment variables new and it's called save web path and we're gonna set it for sweet : oops give web that's all we need to do like that and that's done and now we have got our dev web code here we're just going to copy this and we're going to paste it into the C Drive just like that and once that's done we've got our basic install we'll set our environment variable now we do need though to set up the C++ distributable redistributable so I will just show you that I'm putting all these links in the instructions in the description below now we'll do the 64 bit and show in folder run as administrator' yes I agree and we'll also so it's done we'll also do Z 30 or D 32 bit or the x86 that one well there it is right run just a bit slow to download that's okay okay so now that we've done that if we were to open up a command shell command prompt and let's just change the settings here let's change the font make it a bit bigger and the layout let's make it a bit wider 150 by say 50 and if we were to change to see dev web and if we were just to look at what's in that directory you can see there's dev web here we just type in dev web help then it should give us up that means we're good to go we're ready to do a recording which we will do very soon and before we do the recording we just need to download a Microsoft code so let's just do that Visual Studio code let's get the system install or 64-bit and let's show in folder and let's run it so this is very useful for editing files no most developers already gonna have this or or some other IDE but I am just putting this on a vanilla operating system so you can see that I am doing all of the prerequisites to be able to get the script to work and be able to run a test okay so we now have code installed and ready to go which is good next thing we will fire up Chrome and we'll turn developer tools on so what tools we're gonna get ready to do a recording now now what we need to do is go to network tell it to preserve log which means don't clear out the log each time we change pages okay that's good I'm gonna open up another page it's not being recorded and I just need to do a few extra calls now the pro the business process we're going to use is signing up to a website and it requires a email verification so an email is going to be sent to the email address we use we have to type the code in so this is a proper production website so for the test data services because I can't remember the syntax and if I just grab this random person the URL and I'm going to paste it in here and you'll notice it should record that I can't good we get random person so that's it's recording that's useful now the person that we're going to use for this particular test is Jose Taylor let's just copy this and let's put it into a notepad I find it easiest to use notepad for this type of situation and let's get his password I like to use password for I'll put a link at the top in ways to use this this data so these are persistent items this is two and a half million of these and it's quite useful so it means if we want to log in again as this user after have signed up then we'll be able to because we'll know what the password is by using password for everyone's password is obviously different and then the next thing we're gonna do is we need to get ready to clear and catch emails so I'm gonna copy this link copy and paste and we're gonna copy get most recent email link open another link up in the top right hand side so you can see how this works I make this bigger now I need to use the correct email address so what we're doing here is we're clearing out a message any messages for this email address so that we can catch the email the verification email and it's at test our email is the domain from domain paste paste alright so the reason I'm doing this is I want the script that we generate to have this in calls embedded in it so we're gonna clear out email and then we're going to check an email there there won't be an email yet which is fine and now we're gonna actually do the proper business process now the business process you'll see this in the description below is to sign up to a website with this endpoint so now for the email address let's just type in a person's details birthday I'm not putting the correct date in one industry gender given my own surname password let's use a password that matches and now before I hit sign up I'm just going to show you if I go to copy this now this is the AWS console for kognito which is where we're signing up if I do a search on this user no user found right and now if I hit sign up I've now got a message saying an emails being sent to that email address enter it to confirm now if I check it'll say it's unconfirmed and we can see that we put this in it 12:30 3:05 a.m. and there the details we entered in so now to get that message the code all we have to do is take this URL here copy paste and the verification code is 101 2 3 6 101 four three six confirm and we're done now if we refresh this page over here it's confirmed and you can see it took us like Milly a minute to do that when we run it with a script it'll be much faster okay so we've now got a business process up sorry it's another man so what we need to do is we need to download that or export the half file so let's just call it rec and it's got ha let's pull it in just in to see : I was in downloads that's fine okay so now we've got a half file there which is good now that half file is what we're going to use to generate a script for the skeleton of our dev web script for loadrunner developer now the next thing we need to do is I need to actually just create a directory for and to create a directory for this demo and I'll call it script scripts and I'll call this one demo one okay cuz we might do a few might only do one but I'll just set that up like that okay so we've got our demo one script and I'll copy that har file into the level of the script level not into demo 1 itself alright so now I will do the offline generator it's called if I was to type in our flying generator and I command prompt you can see that it's giving us some usage information I already know what my fire will basically look like so let's just paste that you know it's not in that directory let's just check that we're in the right directory here see demo Qin scripts so demo scripts demo scripts and demo one all right so now we've created a script let's now open that script with code file open and let's go into this PC and demo scripts demo one and it's mine all right so this is our dev web script so you can see we've got our get random person we've got a clear message in our get message now I did those as preliminary steps so I've got them in the script and I'm going to move them to other places then we have the sign up request which produce that page the form with all the field fields in spots before entering in the name and the birth date and so on and then the next then we've got a few resources there and if we scroll down then we we do a confirm in the confirm we're posting in a CSRF use the name destination and so on and there will be some query parameters as well and after we have done that with the external CSS files and other web things the last step we do so that's the confirm step and the one before that was to sign up so sign up puts all the details in and then confirm re into some of those details but has the code and if the codes not correct it's not gonna work and that code has to be fetched from an email so that's our foundation so what we'll do now is I am just gonna borrow some some text so I don't use up all of all of our time typing in very slowly we can put some transaction markers around to start with so I'll show you what they look like so the way we do a transaction in dev web is we say load and then transaction and then a name and we we set that to a variable and then we start it and then when we're done we end it so we do a stop in fact just put that stop in and now when we make this call we get a whole lot of data back in JSON format so we want to catch that we do that with something called extractors so I'm gonna copy these extractors there we go see extractors so now we've got get random person and we've caught the UID email address address password given name family name and all of that we've got there now the date of birth has to actually be entered into this form in a date a month month year year year year format so to do that we need to actually have like leading zeros and all of that stuff in there so I will copy that instead of making you wait through it after here so I'm taking those extractors and if the date of birth day is less than 10 which means it has there's no leading zero and Jason numbers it would just be a single 9 if it was the nines I need to put a leading zero in there to construct that string with the appropriate leading zeroes in days and months and then I'm logging them so you can see that log there and then the next thing we want to do is start the next transaction now the next transaction though here is not that one or that one copy those out of the way I feel I'll cut them out of the way I'm gonna paste them right down the end of the script it's syntactically incorrect to do that but and that's not the point and then the next thing to do is we need to just bring up we need to get the CSRF from this next response go up to quest for so this transaction here let me just make sure I started it correctly no I didn't name gotta give it a name so I'm giving this transaction a name I like to have in my transaction names a descriptor at the beginning then a sequence number and that is numerically sortable that's why I like to have 0 if it's a two-digit number to start with so that if I have stepped 12 in step 12 comes after step 909 for example so we're starting the transaction and we're doing this web request and the web request is going to press that page and we need to grab the CSRF from that so let's just go down and grab that CSRF stop the transaction grab the CSRF and get ready to start the next transaction you're saving some typing by doing it this way so you can see here we're getting there CSRF now the way we're getting that CSRF is from an extractor so we need to put the extractor in here to the extractor so the way the first extractor I showed you it was simple Jason toad whenever you get a response back you can just pluck off the values if they're at the top level of the Jason structure that's very easy but in this case it's not Jason it's actually embedded in the actual page and there's a left boundary and a right boundary so I'm looking for a left boundary of CSRF I'm escaping the the quote there space value equals R escaping it again and then on the right boundary I've got an escaped quote so I quote so everything in between that quote and this quote in the HTML response is the CSRF all right so we've we've done the second transaction so the second one is where we're bringing up the form and the next thing we need to do is clear out any emails so that in case that email address had been used already by someone else for this from domain we want to clear that out so that we can in the next few seconds read that email and also that way we know if we're reading a new email or if we're reading an old one by clearing it out we're definitely not going to read the old one so to do that I just need to take the recording I did so @ly 113 there if I go right down the bottom and take this one here which is clear message and cut and go up to line hundred and thirteen paste and Justin Jensen which they should line up now so we can see that we're doing this clear message now in the clear message we need to make sure that we use the correct email address obviously and the email address that we're using we extract from that first web response which is that and the way we've got that is this web response one extract this email so if we go up here we can see this is web response one and it's extract us and it's email which is this one here so it's got the whatever is dot email is what it's loaded into there so that's that and that's all it needed the from the mains correct and the subscription keys unchanged so now that we've done that we just need to end that transaction and get ready to start the next ones cancels copy that actually won't end yet because it's doing this CSS files the JavaScript JavaScript jpg okay before we do this I'll stop it so we'll actually be running those things I see for our browser concurrently and we do the stop now what we're doing is setting two new transactions submitting news new user details and putting a verification code in we're starting both of these at the same time because they're finishing at different times and we want to actually have the same start time verbose so we're starting both of them and the next thing we need is to put all of this data into this into this request so it's a post and we'll go CSRF so that we need to grab that CSRF that we had from before so did I she log it I think I'm - where is it I'm sorry up a bit higher this CSRF log here great when we run this we'll be able to look at the log I'll see it so i CSRF is this post and the username now I'm just going to for the sake of things because I've already done this a dry run instead of copying and pasting all these variables in front of you I'm gonna just paste them like that because it's gonna be faster so DOB is dead birth with they were put together ourselves higher up now the client ID stays the same that's an open idea next client ID those query parameters stay the same and what we need to do immediately after that though so we need to end transaction for and actually before that we need to add an extractor in add this extractor and here what we're looking for in the extractor is we're looking to check we don't get and a message coming back saying an account was the given email already exists that's possible and if that happens we don't want to try and sign that person up because when it's not gonna work because they're already signed up and now do you way to deal with that is with if statement nice easy if statement so I'm stopping the transaction for and if web response five go back here that's one eleven let's just change that copy web response eleven extractors accounting sisters false then we're waiting for verification emails true in my latency 0 and maximum checks we're going to check we're polling really we're going to pull up to fifty times for this value and then we need to actually put that code in so we'll do it in a while loop and we'll go down to the bottom of our script here and we'll take this copy or actually cut we don't want that there and in this while loop we are doing the get message call so this get message call when we recorded it was for Jose Taylor we need to obviously change that to use the appropriate email address so let's just grab email copy but everything else is the same paste and that if the message is there we'll get it now we need to put some extractors into there now these extractors are going to be Jason ones because it said the Jason it's a JSON response so in this case we've got a verification code with the left so it's not this is actually an email sorry it's not Jason it's in its it comes back as Jason data but embedded in one of the JSON response fields is the whole payload of the message the the entire email so we're looking in the entire response regardless of what Jason field it is for the text your verification code is spaced and with a right boundary of . and when the the text in between those will be the six digits of the verification code so that's why we're doing that and then we are also getting back though the latency so the latency in this case from this return this return from this get message call and goes it takes the amount of time for when we cleared the message to when that email was received in the back end in AWS and as it's saving us the database it notes when it was received and it puts a latency in in seconds to a thousandth of a second precision into into the field latency so we can actually fetch that and we do so we want to we want to actually save that and convert it into a transaction response time so let's do that so email latency equals a thousand times web response three extractors latency which is this one and we want to log with the verification code is so that we can see it in the log and now if the verification code is good then we want to end the loop and if it's not good we want to wait for a second and then do it do it again and if we've exceeded the maximum number of checks who want to break as well so that means that this will end that that while look and what we also have to do is in here back if the maximum text is greater than zero so if we still had checks available to be able to do and then I know it's a dodgy way to do it but that's the way I did it then we know that we've that we're OK to submit a code we haven't burned through all 50 of our of our attempts and getting the code so then we're going to start a transaction and you know what I just realized I should have stopped that other transaction this stop here make a whole lot of space I should have done that stop after all of these CSS and other resources were returned let me just get them now fonts CSS PNG maybe not start again CSS JavaScript CSS CSS CSS jpg I okay all of these ones really belongs to the previous request so I'll cut them and we'll put them up here alright so that means we've we'll fetch that all of those resources if as if a browser had made that request and all those resources are coming back then we are looking for the email response and we'll doing it the appropriate number of times and then after we've done that we can indent this we can do our post now in the post we need to put the CSRF in here host CSRF there it is is it wasn't for was it I have to have a look and see what it was the username was definitely the email address third the destination is sort of a masked one up it's for the same thing sub is for subject which we'll use it's up to us we'll just use the UID of the identity which is okay to use as a subject and we don't have to really do the Cognito SF data but now we do need to put the code in the code is verification code like that now let's just check the CSRF find up and then let's just check if it's the right one yes it is the right one that's fine okay alright so that means we've now submitted the verification code and we want to check the date code is okay so we want to put another extractor in to make sure that we've got a thank you for submitting your query type response back and finally if just paste all this in here huh string right at the end after all these requests there's web style requests if that web response six extractors account created is true then stop the transaction and then we'll say I've signed up I don't think it was cool web request 6 so let's just go back it's response 17 all right now we've done that let's see how close we are to the script working a file save now to run a script what we do so if we say dev web mode load summary and to the console and see demo scripts demo one C start it off one user and I've got a problem already unexpected token line 103 103 oh that's not it's a square bracket copying okay so now we're running that's looking better and we're running through all these steps and my gosh it might have worked let's just have a look copy this email address Laura no jocks up again copy and if I grab this one and put a email address in that anymore look at that and you can see that we created it at 107 and 26 seconds and we last modified it at 107 35 seconds so that was nine seconds later so we did the whole signup process in about nine seconds and it's confirmed so that script worked which is really good so next thing is to actually run this as a load test so we do that by updating file in the script I'll show it to you let's just go into into code and in the directory we have here scenario llamo so if we open that one up we can just say 50 users let's do pacing every 10 seconds let's ramp up over a 10 second period and let's run for 60 seconds and that's enough save now if we do that and now we we redo that same command that I just did before it's going to run that 50 user tests will ramp up over that period of time when it's at full load or run for 60 seconds now to show you that this is working because we haven't got graph honor or influx TV setup yet I'm just going to show you what the CPU is doing so you can see we're not doing much Ethernet and not doing much CPU if I see it in turn the other let's see this actually does some proper work so this is more than one user obviously so we can see within 5 megabits per second us in now 6 between 70 megabits 8090 megabits per second of data coming back so you can see our CPU is working a bit as well as we're doing those transactions we even went to turn on 20 megabits a second for a little while so that's doing your stuff which is good so to make it so that we can make use of this though we want to actually get those response times and plot them and use them live so to do that we're going to create an influx DB database so to do that we need to download influx DB so let the test run this isn't no need to stop it so we go to download influx db9 - that version 1.0 point 1 in this case and we'll just take the windows binaries and show in folder you can see the test is now finished I'll unzip okay so I'm gonna take all of if I double-click on that you can see there's just a few files in there so what I'll do is I'll copy this I'll cut it in fact and I'll just paste it in here but I'm gonna just change its name to just influx DB now in influx DB we need to create a few directories and we need to change some config so the influx DB conf file needs to be changed so let's do that with code might as well file open and see in DB conf and in here we want to change this to just really be C colon backslash influx DB like that and we have to have our backslash there as well let's just do it like that let's double check make sure it's right in fact they'd be all lowercase ah we don't have to directories is just one glad I double-checked right then so there's a meta directory there's a data directory and there's a wall directory I think they're the only ones we have to change sure so let's save that and now let's create those directories new data new wall and then you met look new meta alright so that means that influx DB should be good to go which is great now we need to get Graf Anna well we need let's let's actually create a database though so I've updated the config file we need to start in flux so we just do from a new command prompt see the three column in flux DB and if we just stop in flux BD it's now running so that's good next is to create new download graph Anna so let's go to Chrome and let's say download refiner and let's download the Windows version and download install ru let's do that show in folder store okay so we'll have graph on a running and I think this actually starts up the web server I'm not sure if it doesnõt let's just have a look local host 3000 it does okay admin admin is the initial password and we have to put one in let's just make it admin admin again okay so now we have Ravana and what we'll be doing is we'll be connecting this to influx TV shortly but that's just sitting there good to go don't need that anymore now for influx DB when it's now running we have to create a database though so let's create a database see the C column in flux DB and now the command to create a database I'm gonna call it my DB my DB so we're creating a database I started but that's a bit I'm a bit ahead of ahead of myself here let me just copy that and I'm gonna run the actual program in flux for the CLI and now I can paste it and now if I say show other bases it's showing me an internal and my DB and when I created it I created it with a 2 hour duration so so so that's good so having done that I now need to tell loadrunner developer how to write two in flux DB so to do that I go to the appropriate config file let's just go back to C dev web now the dev WebM I'll file for let's just find it config mo what they suggest you do is make a copy of that and then call it local local config mo right now if we edit that file file open and dev web and [Music] local config mo now in here we can specify the database now we don't want to send it to SQL live database but we do want to send it to in flux DB and we want it to go to in flux DB so I can just put this in here and it's not my host it's localhost and the database is my they'd be like that so we've got port 8080 6 is the default port for a local install of in flux TB and the database name is my DB so that should be enough if I save that and now if I run that test let's go back here and run it again and now if I say show measurements I use my DB and then show there we go we got some measurements so having measurements in there is a good sign so what it means we can do is go in surah fauna and add our data sources and we're going to do in flux DB and we are in fact doing that local host ID 86 386 and database is my baby and browse our save and test look fail to fetch wrong that maybe yes great so I've now set up the connector the data connector so now I can actually create a dashboard so let's make a new dashboard had a panel and now because we've had some data come through we can just say autogen transactions name and let's look at the time it takes to submit a verification code and well I should just refresh that and look at the last five minutes duration there we go so the is the response times in milliseconds now we don't want to record that millisecond so let's just do a bit of math select math and let's divide that by a thousand and save so now we can see the response times are showing up as seconds so let's run that test again there we go and if i refresh here we'll see the data coming in as it's going so these are the response these are the actual response times that are coming through right right now which is great so we can do a bit more than that let's just enhance that like you're probably all used agra fauna but just in case you haven't so that's submitting verification code what about if we add a new one to actually look at response time transactions name let's look at the email latency math divided by thousands and let's save and apply that now we should have two transactions showing should do haven't yet probably done something wrong let's just keep this test rolling here what have I done wrong to go back edit ah duration that's why I did wrong now we can see two different lots of transactions there now the other thing we'd want to do is we some of us want to see well how many transactions per second are we doing so to do that we can look at transactions again and where transaction name that's just it doesn't no matter which one we choose let's choose the submit but instead of group-by let's make it group by one second and let's instead of doing mean let's do a gratuity erasure miss novel iteration so now we can see how many per second we were doing so this is here transaction count is nine so let's give it a name submissions per second and this one is email latency and this one was submission save deploying so how good's that I reckon that's pretty good it's making a bit bigger second see a bit clearer so it looks like my camera stopped working so I disappeared from the screen but I'm back so just to recap we've managed to get a test running from a clean operating system install you've seen the scripting process you've seen a test run you've seen the results comes through and if you zoom in on these results it's very nice that you can actually see int interest second response times so this was eleven twenty five and fifty fifty four here but this response was the 60 60 milliseconds past the second and this is a hundred sixty and so on so you if there's a micro spike that lasts for a quarter of a second and it only occurs occasionally you can actually use this instrumentation type view to see where it's come from you could also bring in all sorts of other instrumentation whether it's x-ray or any other software that you you can get extra metrics from whether the server side or code based instrumentation metrics but basically being able to view things in graph honor and have them saved in a time series database like in flux DB really is a powerful thing to be able to do and also the scripts that you develop and run in loadrunner developer can easily be extended out and run at a very large scale with the other loadrunner products and you can just run them directly I'll do another video on on doing just that so I hope you found this useful instructional tutorial style video and hope you enjoy using lode runner developer have a great day
Info
Channel: Test Data Services
Views: 1,369
Rating: undefined out of 5
Keywords: TestAutomation, Test Automation, Test Data Management, Performance Engineering, LoadTesting, Load Testing, Email Automation, loadrunner developer, loadrunner, automated testing tools, load testing tools
Id: SwP7VDtyCGo
Channel Id: undefined
Length: 55min 37sec (3337 seconds)
Published: Wed Jul 15 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.