Rest Assured Framework Components

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone this is SMY welcome to QA automation classes and uh today is the seventh class and today we are going to learn the framework development from the scratch okay so what exactly we're going to learn and how exactly we're going to do right so the agenda for today's class will be like uh in the intelligy we'll try to set up a new project from the scratch and uh after that uh we will create the folder structure and whatever the folder or the packages will need going forward in the project so we'll be creating all those folders first or the packages first and as and when we need the components or the files to be placed in those respective folders we'll be creating them in our framework development session and we'll keep them there okay and uh apart from that uh we'll try to understand the different packages okay so what exactly are those packages and what what are what types of the content we're going to put in that packages okay that is important to understand and uh then uh we need to we'll be adding our uh dependencies right in the pom.xml whatever the dependencies we need we'll be adding that into the b. XML so that is the agenda for today's class so without wasting further time let's get it started so let's go to our intellig if you have seen this is our bdd selenium framework that we have already completed so I'll just go and say close project okay so project is closed so so now I'm going to create a new project okay so create a new project click on new project Untitled so we can give some project name okay bdd so we'll say bdd rest assured demo okay so let's get the year Al 2024 okay bdd R show demo 202 for and create a get depository perfect and Java language and build system is M jdk 21 okay Oracle open JK version 21 that is been installed in my system okay and uh if you want you can give this advance settings your uh group ID and artifact ID so group ID I'm saying Q automation classes artifact ID is bdd rest assure demo 2024 okay so now go ahead and hit create so a default mavin project is going to get created with the uh default structure okay so if you see this is uh bdd rest short demo right so if you go and see my pom.xml right you can see this is the artifactory ID we have given and this is the group ID we have given right so with the artifact ID the project uh name came and there is whatever the group ID with G with that inside main Java we have this Q automation classes uh package and inside that we have have a main class it's just a sample hello world okay so but we don't need them so we can get rid of that let's delete this Q automation classes itself okay we don't need them main I can delete okay so before that let me just see Source main okay tast is also generated okay fine so let's go and let's delete okay main delete this one yep and and Q automation classes also we don't need so we can get rid of this one okay so delete directory Q automation classes so delete okay so we are done now so now if you see the folder structure we have Source main Java inside Java we have deleted the default created uh project structure that Main and all we deleted and uh you can have like Java is there nothing is inside and resources is there similarly inside the test we don't have we we have only Java we don't have resources okay so for the uh test okay I can say right click new and uh directory okay and here if you can see M Source directory just click on this one double click it will come here okay so now we also have the Resources directory for the test okay so all our code will go under this one so we can minimize the close the main uh hide them okay we don't need this TR to C so we need the test inside inside the test we have Java and we have the resources okay so all the source code will go into the Java and all the properties file and configuration file will go into the resources okay so this is the basic folder structure what we created but apart from this okay so we need to create uh more folders okay or the more packages so what packages we need so let's say whenever you want to run right uh what you can say like uh run your feature file right so you need your cucumber Runner okay so we can create one cucumber Runner uh package right cucumber Runner okay so this is one of the package and apart from that we need uh if you need uh hooks also right so package hooks okay and uh we might need a pojo classes okay so what is this pojo classes uh who everyone know okay let me explain this one so Runner is the runner that will be running okay and the in the runner will have all the feature files configured or the feature files which we want to execute those will be configured and then hooks uh all the before and after related uh uh things will be there like uh what you can say like loading your properties file and uh getting the Bas let's say in here in the API world we can say getting the base URL can be done for all the things right so we have to load and get the Bas URL that we can do with the help of the before annotation in the hooks and similarly after annotation like whenever the scenario fails we can take a screenshot over there right so that we can also do with the help of the uh after annotation of the hooks okay so this is one thing and then I'll say pojo classes okay so what is this pojo classes so right click new package okay let's say Bojo classes Okay so this project classes is nothing but what I can say like plain old Java object right so this uh plain old Java object okay so what it does uh let's say when you have a post method or when you need to provide a method body right so there is a post call and in the post call you have to provide a G right so your input uh Jon right request parameter request payload so that payload can be constructed uh in multiple ways so one of the way is to go through the PUO classes so pujo classes will have all those uh parameters okay along with those all those parameters that will be uh along with the gets and sets methods okay so and another way is like we can go with the hashmap also okay we'll be looking into that in detail so when we will uh construct the post uh request parameter through proo classes as well as through the uh our hash map also both will we're going to see okay so for that one we need the classes we can design under here and then we might need uh then definitely we need the API classes okay so what is this API classes so the API classes is nothing but if you want to compare it is just like your page classes right so how you define your actual operations on the page classes right so you identify all the element in case of the UI automation framework so you suppose there is a login base so you identify uh username field password field login button right and then you do some operations and those are part of the your login page similarly in the API classes okay so here let's say there is a post endpoint right so for the posts okay posts endpoint or the comment endpoint okay or the profile endpoint okay so for the profile endpoint or the comments endpoint you want to create a comment you want to delete a comment so you want to read the content of the comment right so those operation get post delete all those things okay or you want to update a commment put or patch whatever you want to do those all the methods will be designing inside that API class okay so we'll create a uh like a comment class and in the comments class we'll be having our methods for the put call get call Patch call delete call whatever calls are applicable okay so we'll have all those methods over there and then this uh API classes has to be called from your step definition right so how we have the step definitions so let's have our package okay so let's say step definitions okay so step definitions so and okay let me refactor rename step definitions okay fine so and the step definition is nothing but it will have the glue code for each step defined in the feature file so this will act as a bridge between your feature file and your this API classes and uh like uh other calls okay so so so this is the bridge and we can have the utilities Suppose there are most some common methods which is applicable across all the um all the classes so in that case we can have the utilities okay so I'm just creating the folder structure whenever we need those kind of things we'll be adding otherwise we'll leave it blank okay and then we need uh configuration also right so configuration uh whatever configuration related stuff we want to keep right so we can keep it inside the configuration okay and uh then we can have the features okay most important thing is the features let's have this configuration so configuration okay and we can have one more that is feature okay and make sure feature you write inside the resources okay so you have to design the features inside the resources so let's say okay so done okay so this is nothing but your uh a simple uh folder structure that we are going to uh use okay so let me reate so inside the source test Java we'll have the AP classes are there configuration is there and cucumber Runner hooks pojo classes step definition utilities and inside the resources we have the features okay so next step is to add the dependencies okay list of the dependencies what we need for this one right so if you see this is the default XML that got generated okay and everything within the project tag and Properties Group ID and artifact ID we have already seen okay and uh properties uh like uh Source 21 Target is 21 this is nothing from our jdk things okay uh mavin compiler source is 21 M compiler Target is 21 okay and uh project build Source including UTF utf8 okay this is fine so the main thing is we need to add the list of the dependencies okay so let's uh create the dependency tag okay dependencies so inside the dependencies we have to add the dependencies okay so what are the dependencies we need so let's see first add L uh add the what is that rest assure okay what is the most important one rest so let's open our browser let's go to mavin Central repository okay Marin Marin Central repository okay okay and from here we have to uh keep downloading all our dependencies so first one is rest assur okay so rest assured iio do rest assured okay so this is the one so 5.4.0 okay so copy this one let's go to our intellig dependency section just paste it okay so inside the dependencies we have first added our dependency that is nothing but the iio do uh rest assur okay so 5.4.0 so now we can open and see we have only uh jdk uh 21 related uh dependencies over here okay we don't have any of things added as of now I'm just going to add and then we'll install all of them okay so now after adding the rest assured we can have our Json path okay so that also should be from the rest assur don't go with the J guys okay that is the older one so now everything you should have it from the rest should okay so let's say Json hypen path okay so not from jway don't go with the jway okay so go with the rest should so now 5.4.0 this is also same okay so copy now let's go and add it over here second dependency G path okay so why this G path if you guys have remembered right so we have seen right how to go navigate to a particular node through the Json path okay it is going to identify with the help of this J path Library okay and similarly if your uh response is in the form of the XML you can have the XML path also okay so let's I can add them but uh mostly we'll be working with the Json but uh yeah let's add it okay it will not harm but it is not required also in our case because we are going to work with the Json file mostly okay so uh I can just take this XML path cool so apart from that what we need to do we need to first get the Json schema validator okay so why Json schema validator so you want to validate whether your schema whatever the schema it is return returned by your API response is proper right so that's why we need Json schema and I'll say validator okay Json schema validator and it has to come from where it is also from io. restur so here okay this is also 5.4 I think these are all updated in December 2023 awesome [Music] so okay so now we have to add our J unit okay so what's the J unit J unit so J unit it should come from your uh J unit okay so junit Jupiter this is a j unit okay so let's take this J unit uh the ctif has move to gunit API okay that's okay 4.1 3.2 okay so let's copy this one so let's add it over here G also okay okay so we need to add the Cucumber related dependencies right so cucumber Java we can add so let's search for cucumber Java cucumber hyen Java so right uh it should come from the io. cumber not info okay so let's take this one i. cumber 7.1 15.0 awesome okay so let's copy this one and let's put it in the dependency section okay so after cucumber Java what else we need we need cucumber J unit also right so cucumber junit so cucumber G Unit junit so it should come from io. cumber okay kumber Jim jumber Jim jit 4 okay maybe 7.1 5.0 okay let's take this one so let's add it next one is uh cucumber core okay need cucumber core also these are all cucumber related uh dependencies guys okay so cucumber core i. cumber okay fine 7.15 awesome so let's copy and let's add it in the dependence section okay awesome and after cucumber related things we have to add the Gin related dependency also right so because we are going to write in the plain English format so it has to be gin so how to write this kin so dependency so let's go to the repository let's say gin so IO cumber gin okay so from from here uh 28 okay so now it is 28 we can take that or you can go to one previous build which is most widely used we can use that one 27 also that is perfectly all right apart from that we need log for right so we'll add the loging capability as you have seen right so it will be from or Apachi logging log forj so log forj core so 2.23 I think this is the perfect one let's go with this one so log project code 2.2 3.0 okay so let me add this one and log forj core and we can go with the log forj API also okay so log 4J API log 4J API so this is from Ora logging log 4G okay so this is nothing but the this is the one okay so take this one 2.23 okay copy and then put it in the dependencies okay so apart from that what else we need log 4G we have added and we need our uh extend report also right so so extend report will do okay so let's say uh extend report and uh extend reports cucumber 7 adapter these two things we need okay extent extend reports cucumber 7 adapter okay here it came okay let's search for that one and uh this also come from the take. grasshopper Okay so a of so 1.14.0 okay so let's take this one and copy just put it here in the dependencies and the next one will be your uh extend report okay extend report should come from the Avent stack okay so let's say extend reports okay it should come from your a stack so okay and 5.1.1 okay lest one let's take this one so H report also you have to keep it over here done done okay and uh plugins I think we need to have the Marvin compiler plugin and we can have the fail set plugin also okay so let's add the compiler plugin as of now F Poli letter okay so let say Marin compiler login okay so 3.11 or one two whatever so this is coming as the dependency but we have to add it as the plugin okay so let's uh take it from here let's go to Google okay and we can go to our uh what is that Q automation classes right Q automation classes. block I might have added in my last uh what is that last bdd framework development okay if we go to that form. XML right yeah here we can see all of them so read more so if you see here so here uh the plugin section we have having compiler plugin and we have Sure Fire plugin we don't need and we have even have the P plugin okay so we can do one thing so we can get this entire plugin section okay let me take it there and put it okay and okay cool cool so now everything is here okay so we need to do one thing uh we need to click on reload changes okay resolving the dependencies if you see so it is trying to it is trying to resolve all the dependencies that we have just now added okay and this plugins also I think uh this is also it needs to be downloaded after the dependencies right so we need to put the plugins inside the build tag that's the mistake I'm doing so let's put the build okay and this build end would be after the plugins okay so plugins then we'll put the build okay this is fine okay so if you see this is all the dependencies we have downloaded let's see what is the issue with the plugin okay so now dependency tab is done so after the dependency we have to close the dependencies I think I oh my bad okay we have to be very careful while working with this taxs okay so after the dependency we have to put the dependenc es and then build plugins plugin so M compiler plugin is there and uh M sh plugin and this fail plugin also for time being I can disable I don't need this plugin for now okay so code comment okay fine so now if you see all the errors are gone now and if you see we have downloaded all the dependencies over here you can say extend report 5.1 and uh Jackson databind so many things whatever were there all those dependencies has been downloaded over here okay cumar need cumar Java gin related right so everything here HTML formatter okay so everything already come okay apach XML okay so whatever extend PDF report Excel report okay everything came here okay so now now uh we have added everything so now our framework folder structure and our uh adding the dependencies is uh completed okay so in the next session uh we'll be uh trying to create the feature file and we'll start with the actual framework development so when someone asks you what are the can you define about your project architecture right so you there will be another class for that one and then uh like if you have seen right uh uh in the next class I explain that one okay how exactly it is going to uh go right what is architecture and how exactly it is going to work so that uh I'll be explaining in the next class but you should be understanding all these folders or the packages that we have created and what should be the content inside that one right so when someone ask you you explain about your folder structure as well as your uh actual flow of the application right how exactly your framework flow happens okay so that's all for this class guys if you guys are really enjoying my sessions I'll request you to subscribe to my channel and please share this content with your uh friends and colleagues and uh please if you have any doubt please comment uh them I'll get back to you as soon as possible and please like the U video it will motivate me to come up with the such more informative videos okay so yeah uh we'll meet in the next class thank you everyone bye-bye thank you
Info
Channel: QA Automation Classes
Views: 68
Rating: undefined out of 5
Keywords: rest assured, rest assured api automation framework, rest assured api testing framework, rest assured api testing, rest assured framework, how to automate rest api using rest assured, rest assured java framework, rest assured tutorial, how to create rest assured framework, how rest assured works, rest assured testng framework, rest assured api testing tutorial, api automation framework using rest assured, what is rest assured, rest assured for complete beginners
Id: A3Rrfq5GoUM
Channel Id: undefined
Length: 25min 20sec (1520 seconds)
Published: Mon Jul 08 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.