End to End Selenium Framework | E-Commerce Project | Complete Selenium Framework from Scratch|

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends welcome back to automationtestinginsider.com so from today onwards i'm going to start selenium framework development from scratch so sorry for the delay guys and yeah this is the first part of selenium framework development and we are going to construct data-driven framework with page object model and if you are new to selenium then i would recommend first go through my previous videos which i have created on my youtube channel i have created different videos on selenium with on java and selenium so i would recommend first go through all those videos so let me take you to my youtube channel and blog so if you simply search in on youtube automation testing insider you will find this channel and up front you will see this selenium java framework video okay so you can go through this where i talked about different components in a framework i have created this video long back so here we have discussed some theoretical stuff as well like what is a framework why do we need framework and what are the different components in a framework what is the data driven testing and uh data driven framework what is page object model so i discussed all those stuff in this particular video and if you go to this playlist you'll find different uh playlist over here so this is the complete playlist of selenium selenium webdriver is step by step there are around 76 videos but before that i would recommend first go through the java for selenium so if you're learning selenium with java then you first go through this java tutorial there are 30 videos around it and if you want to separate videos for particular section let's say like jenkins you want so you can go through this tutorial playlist we have getting github over here marvin tutorials we have test engine framework over here and the complete tutorials you'll get in this playlist selenium webdriver is step by step and if you go to my blog that is automationtestingincider.com so here we have this java for selenium so you'll find all the nodes and post related with java here and here we have selenium tutorials so here you'll find the source code and the nodes related to selenium topics so here i have listed on all the topics over here so if you are new to selenium then i would recommend first go through these two things and then come to framework so let me talk about the agenda for today so we are going to talk about the framework architecture for today and uh if time permits then i'll create a project as well and we'll create different packages and classes but the first thing is we should understand the framework architecture what are the different components in a framework and how it looks okay and these are the different tools and technologies which we are going to use in our framework so this is application under test so i picked an application e-commerce application so i'll show you that one and uh yeah selena web driver with java of course we are using this and we are going to use maven test ng lock 4g extent report and this source code management tool kit and github and we have jenkins for continuous integration so these are the different tools and technologies which we are going to use in our framework and regarding these two points like what are the different steps to create the framework probably i'll discuss from the next video onwards and some tips to create the framework we can discuss this anytime as as long as we'll create the framework and we'll understand different things so we'll talk about this as well so let's talk about like framework architecture how it looks okay and what are the different components in a framework so i'll explain with the help of diagram so i'll open ms paint and yeah so the first component would be the page objects okay where we'll define different page classes and uh so this is the application which i picked for our framework this automation practice.com guys so this is very good e-commerce website where you can practice and so that's the reason i'm uh i picked this application for our framework okay so whenever you navigate to any page webpage or website so you'll find different web elements as we have seen in the page object model okay i mean how to construct the page object models first we'll write the uh the page objects okay so in this page we'll see different uh web elements so here you can see this is the image and we have different tabs over here okay so we need to just store all these in page class okay so this is let's say this is index page so we'll create all the page objects in this uh in will create one index dot index page is class where we will store all the web elements okay and suppose you navigate to this sign-in page so this is another page or i would say this is login page where we have different elements as well so we have this username password field we have sign in button so we'll store all the web elements in page class of this login page okay similarly once you log in you'll find so once you log into this application you'll find this home page so here we have different uh web elements so we'll store i will write all the web elements with the help of page object model page factory method is there so we'll write using page factory method so the first component would be our page objects okay so i'll write the first component over here like this so let's say i'll give name page objects and we have different pages in our application so let's say index page so we'll create a index page class so let's say if you have 100 pages in your application so you'll write 100 page page classes okay so here this is sign in page or they'll say login page login page we have a home page we have order page a product search page or let's say product page and order page or you can say add to card add to card so in this way you have different pages on your application and you'll write separate page class where you'll store the web elements so this will act as object repository okay so this is one of the components in our framework and another component would be action driver okay so what it does is uh we have we need to perform different actions on a web page right so if you see this sign out so if you go to the index page of the application okay so what we are going to perform here actions here is we will search the product from here we can go to this contact us we'll click on this sign in okay so these are the different actions on this particular page so we'll uh will write the method reusable methods in this action driver so we have different actions to be performed let's say we have a scroll on the webpage okay we have a click we have send keys we have select class uh to select that from the drop down we have uh uh for same keys we have type we can create type meta method as well and what we have for different weights we have okay implicit weight uh explicit weight and fluent weights so all these reusable methods will be stored in this action driver class okay we'll create a separate class so this will be this will act as a separate component okay so this will applicable for all the projects guys all the web applications so we'll store all these uh reusable methods related to web action i mean page actions user actions in this particular class okay so so this is one of the components action driver and one important component would be utility class okay utility package will be there we'll create one package inside that we will have different classes so let's say this is a utility utility component we'll create a separate uh package for this utility and we'll store different classes inside it so what are those different classes so we'll have one util class we'll have in util class what we can do here is we'll store uh some methods let's say screenshot related how to take the screenshots okay we have uh extend class extend class would be another utility class we have a log class for log4j we need listeners as well listeners as well and what we have we need a data provider class as well to supply the data from data providers to the test case using data providers okay so we need a data provider so these are the different utility components utility cloud classes will create in our framework so this is one of the components utility component and what will have we need config configuration as well so this is config component okay and in this component we'll have different com configuration files xml files or x xml files or text file or whatever files we have will store in this particular component so let's say what are those different files we have so we have one dot xml in maven project where we'll update all our dependencies we have extend config file extend config file extern config.xml we have a lot for logging purpose we have log for jxml we need uh config.properties as well config.properties to read the constraints from config.properties file and we need what we need i think these are the uh four components we have testnd.xml to run our test cases xml so these are the different components under this config component okay and what we have we need one folder as well folder component where we'll create different folders keep our different folders in that in our framework okay so this would be the folder folders okay and here we'll store we'll create different folders such as i will create one test data where we'll store our excel sheet in the form excel sheet from where we'll read the data okay we need one screenshot screenshot folder we need what we need configuration folder where we'll keep this config.properties file inside this configuration folder we need drivers if you are using a system.set property where we'll we need a different drivers right so we'll have drivers folder anyways i'm not going to use this drivers folder i will use webdriver manager instead and for logs we need one logs folders as well logs where we'll capture all the log for logs and for reports we have for let's say for extent reports will create a separate folder so i would give here extend report so these are the four five components as far as i have i mean so far i have discussed and on top of it guys we have one second let me drag it little bit down like here and on top of it we have one base class base class so this is the main class or i would say the parent class base class and all these page objects classes will extend this base class okay and similarly the action action action driver class also extends base class okay so these two classes extends this base class and we have uh what we do in base class basically will we have some stuff to perform some of the tasks we need to perform using base class so what we'll do we'll read the properties file we read the configuration i would say and web driver initialization will do from base class web driver initialization version from base class and we'll configure before sweet before sweet and after sweet method so before we are running any sweet particular suit will we have to configure before sweet and after sweet because we need to set some parameters regarding log 4g extent report so we have these before sweet and after sweet so some common properties which required for our framework will keep in base class basically so this is base class and another component the main component is test script so here i'll write one second so this would be my test component guys where we'll keep all our test scripts so test uh we'll have some package like com dot let's say our application is my store com dot my store dot test cases so we'll write different test cases test classes inside this test cases package so what are the different cases so in case uh let's say let me show you so we have uh index page this is sign in page right so again yeah so here what action we are going to perform login application or login into the application okay so we'll test whether the user is able to login into the application or not so all the script all the test related things validation will be there in the test cases package okay the test cases which we are going to write so let's say we'll have separate test cases for all the pages it will not be the same like uh let's say we have hundred pages in our application so we'll have 100 classes of 100 of test classes so that is not mandatory so you can have uh i mean same number of classes of test classes or you can have less number of as well as per your requirements like what are the testing you are going to perform on your project so let's say i have some test cases over here so i would say login page test so i'll write like this login page home page test so these are the different classes and add to cart add to cart page test and what you can see product or let's say order test we have payment test like this so these are the different test cases which we are going to write in our this test cases package so these are different classes separate classes login page test homepage test where we'll do the validations we'll put our assertion and we'll do the validations and this test classes will also extend the base class okay so we can extend like this one second like this so all the tests i mean these test classes all these test classes will extend base class as well okay now we have and guys we have different phases in our framework so we'll talk about this one okay so let me write other components so this is one of the components which we have written just now test cases and we have how do we run our test cases so we have testng.xml so we'll configure our testng dot xml in our project okay so and the flow will be like this so we'll configure all the about all our test classes in testng.xml so this would be another component testng.xml where we'll run our test feed yeah now test ng.xml and let me have we have another one more component com.xml so this is my palm dot xml form dot xml so we'll configure our test suite in pom.xml okay and and we have configuration tools like git and github so i'll put git and github over here so i'll write grid and github so this would be my configuration management tool source code management so this is uh this is git and github and one second let me drag little bit down over here and finally we need continuous integration so for that we'll have one component called jenkins continuous integration so i'll write jenkins over here jenkins ci tool okay so we'll configure our pom.xml in git and github i mean uh we'll create the project we'll add our project into git and github repository and when we run our jobs from jenkins so it will read the git repository okay so it will take the git repository it will take the clone of git repository so this is the connection between getting i mean github and jenkins tool like this again from here we'll run our scripts from jenkins tool so we can divide our project our framework into three categories so let me divide so this would be guys uh development phase development phase of our framework so this this component all these components are the development fees and we have execution fees another phase right where we'll execute our test case so let's say these two are our uh from where we'll write will execute our test cases so this would be yeah this would be execution phase okay and we have continuous integration and maintenance phase so this would be my last phase continuous integration so these are the different phases in the framework so i think we are almost done with the framework architecture if anything is missing let me think about it i think we have covered everything so these are the different components now let me go over the eclipse and we'll create a project and we'll write different packages and classes over there so from next time onwards we'll directly start writing our page objects and if you see in this application guys so let me login with this application so this is the login page if you sign over here yeah so this is the home page and let's say if you search anything over here and you'll find any particular product i mean different products using this desert search so let me click over this so this is the flow of this i mean application so this is add to cart page from here will create will click on this add to cart so it will be added in the cart okay and from here we'll navigate to another page proceed to checkout so this is uh the order summary page from here will navigate to sign in page sign in already we have signed in so this will be skipped and it will go to address page from address page shipping page and payment page so we need to write different pages in our framework according to this application okay and another thing is uh i forgot to tell in this architecture that all the components will be integrated i mean uh interlinked with each other okay so index page will integrate i mean uh linked with this login page so let me tell you first sign out so this is the main page of the application from here we'll navigate to the sign in right so we are clicking on sign in so this is the first page and if you click on this sign in the user will land on the sign in page or login page okay so this would be the landing page of sign in page index page right so these so we need to interlink these two pages index page and login page and from where from login page if you login into the application you will land on home page so like that we need to create the link between all the pages so this is home page and from here what we are going to do let's say we are searching the product so click on search so you'll find another piece this is search result page okay so this is another page if you click over here and this is product result or you can say add to cart page and from here when you click on add to cart and proceed to this is still the add to cart page and if you click on proceed to checkout you'll land on this summary page or order summary page okay so this is how we need to link all the pages in our our framework so that it would be very easy this is also called the page training model as well because of the intel link i mean connection between all the pages okay so this would be i mean the design would be very easy when we do the connection between all the pages and it would help us to [Music] do the testing and create the framework okay so yeah let me create the project new project and we are going to use maven so maven project create a simple project next and here i'll write my store project i'll give name like my store project and i'll give artifact id same as the group id my store project click on finish so here you will see my store project is being created over here we have this pawn dot xml in my own project so we'll update the palm.xml from the next video onwards i'll show you what are the different uh dependencies we need for our firmware framework so what i'm going to create uh inside this main is rcm in java i'll create different packages guys so as we have seen different components in the framework in this diagram so i'll create different packages so what would be the first first package com dot my store application name so this is the naming convention you should follow and let's say action driver action driver i'll create com.meisto.actiondriver click on finish i'll create another package one second this is interface com dot my store page objects page objects or pages you can write page object let's it's fine page objects click on finish will have some other components as well com dot my store data provider data provider package will be there where we'll write uh we'll create one class data provider and we have other packages as well utility com.mystore utility this is another package and one more package would be the main package com dot my store base package base package base com dot my store dot b is where we'll create our base class so these are the different packages inside this src main java and inside this src test java will have only test cases inside this folder okay so what will write com.mystore dot test cases or test scripts you can write so click on finish inside this ssd test resources will have one folder you can go to others and folder next we'll keep test data inside this src test resources like this where we'll keep our excel sheet and what else we need we need one config configuration folder one second yeah folder name configuration configuration folder so that will come here will write config.properties over here to read the properties from properties file different constraints from properties file and we need one screenshots folder screenshot folder what else we need we need extend report as well so we'll create that extent reports later on and now we need one more folder for logo so we'll keep our application logo in that particular folder so click on finish so these are the different packages and folders i have created over here and let me give an example like how to create the class uh this base class so we'll create one piece class over here so we'll write like this class like this click on finish so like this will write and similarly we'll write action driver class over here data provider class over here utility classes different utility classes which we talked about okay and we have page objects so we'll write page objects like this let's say the first pages index page will write like index page like this okay so this is how we'll create different uh classes inside the packages so packages are already done so similarly we'll write test cases as well test classes from in on this particular package mystore.testcases so i think we are so far we are good guys from the next video onwards we'll start writing the script okay we'll write the base class and page objects so we'll go one by one okay so let me go over this so i think we are done for today guys uh in the next video we'll start writing the script from scratch from the index page will write all the objects okay so this will act as i mean page objects all these classes inside page objects will act as object repository as well so we'll write all the web elements inside the particular class where it belongs to okay then i am good so again i would recommend guys if you are new then please go over the previous videos which i have created because if you directly land on this framework series then it would be very difficult so please go through all the videos first like java for selenium and selenium webdriver is step by step so if you're new to channel new to my channel then please subscribe this channel and share my videos guys thank you for watching have a nice day bye bye hello friends welcome back to automationtestingcity.com this is selenium framework development part two and as you all know that we are constructing data driven framework with page object model design pattern so let me show you the agenda for today so as you all know that we have covered framework architecture in the last video and uh today we are going to talk about these different points which i have listed down over here and uh i will see the navigation of the application uh we have picked an ecommerce application i have shown you in the last video and i have picked some manual test cases i have already created i have picked some of the test cases which needs to be automated as part of this framework and the first step would be will update our form.xml and then we'll create config.properties file that will read some constraints that will be used throughout our framework and we'll create base class and action driver class as well and at last we'll write some page page classes whatever pages we have in the application and we'll write page objects objects will define our page objects inside and also we'll write some user action methods as well so this is what we are going to discuss today these are the points and in the next video we'll write script we'll start writing the scripts and and later on we'll do some other stuff like reporting things and lock 4g screenshot taking the screenshot for failed test cases and yeah the extent report the data provider data driven testing so all those this stuff will do one by one so this is what we have the agenda and guys if you are new i would recommend please subscribe this channel and click on bell icon to get the notification for upcoming videos so let's get started with the first point like application navigation and the manual test cases which i have already written so this is the folder i have created and here we have this framework architecture which we have discussed in the last video so here we have three phases we have discussed development fees execution phase and continuous integration fees and we talked about different components in a framework so this is what we have discussed in the last video now this is the test cases which i have already created so this is not typical manual test cases guys i have just picked some of the test cases from the application which i have listed down over here and we have expected result as well so i picked some of the applications just for demo to construct the framework and yeah here i have written the page classes as well so these are the different pages in the application which will go through and we have corresponding test classes so we'll write uh we'll create the script i mean for few of the test page classes not for all the uh page pages we will not write the test cases and corresponding we have test cases so these are the different pages guys so let me show you the navigation like how we'll go from one piece to another page and yeah how it goes further okay so let me show you the navigation so already i have opened the application over here so that is uh the url is automation practice.com slash index.php so this is the first page you can say main page or the index page and from here we have two options uh this contact us is there and here we have sign in we can search the product as well from here so let me click on this sign in so user will land on this login page okay so here from this login email address and password from here we can login into the application okay so this is login page and we have another option over here create an account so if you put our email address and create an account so it will go to create account page so there are two navigations from here so let's see the first one so if you log into the application click on sign in so user will land on this home page so here we have homepage i have written over here now if you see this account creation page is also there the next one so if i sign out and from login page we can navigate to just write any random email and create an account so user will land on this account creation page so this is another page so here i have written this account creation page so this is how our navigation will be and so this will be the landing page of login page and home page is also landing page of login page so we need to just understand the connection between the pages okay and yeah let me do the next one search result piece page okay so if you come back to the index page so this is my main page guys and from here we can search the product okay so that will give you uh when we click on the this button search buttons then we'll land on the search result page so let me show you t-shirt and i'm searching on product t-shirt and here you will see this is the search product search result page okay so this is the result of the product which we have searched and from here when we open click on this image the product and here you will see this is the add to cart page so here we have add to cart page and from here we'll navigate we can add this product into the cart so click on this the product will be added in the card product successfully added your shopping cart and this is the part of this add to cart page only this window and we need to click on this proceed to check out now here you can see this is the next page i mean uh this another piece so this is order page from here we'll place the order okay so this is the landing page of add to cart page so this is how we can link between the pages we can create the link and from here we need to just click on proceed to checkout okay previous page guys you can enter quantity and size and click on add to cart so this is how it will be added and you will see this order page and from here we need to just proceed to checkout and we'll have this sign in page because we have sign out from the application so we'll get this sign on sign in page if you already sign in then directly it will jump to address page so let me sign in and you can create your own account from here you put your email address and create an account you can give any email like this any dummy data so that will take okay sign in so it will land on address page okay so the next page would be address page and from here we can validate our address we can update as well add a new address and just click on proceed to checkout this would be another shipping page so another pages shipping page and from here we need to just check this terms of service checkbox and click on proceed to checkout will be land we will then on this payment page so this is the payment page guys and we we have to choose the payment method from here we'll verify the amount what is coming over here so we have two quantities so it multiplies this is the unit price okay and total shipping charge is two dollars so total is 35.02 so we'll validate this price as well and we can choose any payment method so let me choose this bank wire now here this is the after payment page order summary page will be there so this is the order summary the before the final confirmation this is the order summary okay and confirm my order so this is the last page so your order is order on my store is complete and this is the details so this is how the navigation of the different pages of this application so we'll write uh all the these pages whichever i have whatever i have listed over here in terms of java class and will write the page objects and yeah so we have done the first part navigation in manual test cases now let's update the pom.xml so we need different dependencies because we are going to use different uh things in our framework so we we have to uh we need to install different uh we need to download different jar files okay for that purpose we use since we are going to use the maven project and we have pom.xml so directly we can add the dependencies and we can download the jar files okay so let me show you how to do the how to get the dependencies so let's say suppose you want to get test ng margin dependency so simply search in google test ng mimo dependency and you will get this website mun repository dot com mama repository just click over here and you will get the dependency do so these are the different versions guys 7.1.0 is the latest one and here you can see the usages 357. so if you click over here the version you will see these dependencies so you can add this dependency in your framework so already i have one i mean now i'll take the dependencies from previous class instead of getting all these from my repository because it will take time so let me take it from the existing project which we have so simply i'll copy the entire form.xml and i'll put it in my project yes to all so this is the palm dot xml so here you can see we have selenium java which is the mandatory and just when you put the output all the dependencies just do control s so it will download all the jar files build the workspace and it will download all the jar files another we have test engine we need so here we have 7.0.0 so the latest version is 7.1.0 so we can update this 7.1.0 just make sure that the scope should be compiled and what is next to read the excel file we need apache poi dependencies so we have poi and pyo xml so these two things are required to read the data from excel sheet to work with excel sheet okay we have extend report we have commons io and this is for log 4g this is for web driver manager so this is how we we have different dependencies and this is related to compiler to run the maven build we have this build tag inside that we have to compile the project we have this maven compiler plugin and these are the different other plugins as well and we have sur fire plugin to run the maven test and we can configure our test ng xml as well in this sweet xml files so we'll discuss about these things later on when we run our project so so far i think we are good with palm dot xml as well so this is the project which i have created guys in the last video okay so we have we got this pawn.xml and we have created different packages over here action driver and this is the naming convention com.mystore.actiondriver we have base maestro.base class and this package inside that we have base class similarly we have data provider page objects utility and we have this test data inside src test resources as well and we have test cases in this src test java so we'll write our scripts in this package com dot my story test cases and here you can see some error so how to remove this error so just right click on this and we have an option here update the project because we have downloaded a different jar so sometimes it gives a click so we can remove when we update the project so here you can see the error is gone now whatever we have downloaded so that will come in this maven dependencies library so here you can see the different jar files here we have selenium java and test ng would also be there this is the lock 4g commands i o and here we have test ng as well test ng 7.1.0 so this is how you can download different jars and what is the next step so create config.properties file so how to create the config.properties file so already we have created the folder this is the configuration so how to create the folder directly right click on project and we have new option from here you can create the folder so this is what we have created in the last video now i'll create the file so here we have file option and what i'll give the name config dot properties so the extension of this file would be properties dot properties okay so this is how we can write you can give the file name click on finish so this configure properties will be created and here we'll give some constraints so let's say url will be constant throughout the project guys double quotes not required simply will copy the the base url of the application and put it over here and yeah it will take a key and value pair this file so this is the key and this is the value and here we'll write let's say username will give and password as well and we need browser so we'll give browser like this chrome username will write admin xyz.com and we need password so this is how you can create your config.properties file and you can give different constants which we are going to use throughout our framework so these are the common things which we are going to use for all the test cases so so far we are done and what is the next step we'll write the base class create base class and action driver class so base class already i have in the previous project so simply i'll take that because we need to read the properties file so if you don't know how to read the properties file then you can refer my previous videos guys already i have created on my channel if you go to my channel and here we have screenshot logs reports properties files so here you can go to this playlist and you can see this properties file and yeah so let me take the help of the previous project which i have created so here we have base class so i'll take this load config method from here so simply i'll copy this this is the method load config to load the configuration okay configuration nothing but this config.properties and so base class already i have created earlier so this is my base class simply put it over here and this is very simple guys to read the properties we'll create we need to create the object or properties class and simply inside this file input stream we have to we have to give the path of our config.properties file this is how we have given and simply load that file using this properties object okay and here we have to declare public static properties prop this is object name and we need driver as well public static web driver driver so this base class is the parent class of all the other classes as we have seen in the previous video in the architecture so here you can see this is the base class and all other will be like page objects and action driver will extends this base class as well as this test class okay so this is how you can write your base class and what is next i need one more one more uh method from previous base class which what is that we have launch app so simply copy from here so this is also very simple we have done so many times like how to launch the application so we are going to run our script in three different browsers so we have will pass the browser from here we have we have taken the i mean help of this prop object prop dot get property so it will read this config.properties and it will pick the browser from there so let me close the previous base class okay so this is how it will read the property from properties file and it will be the browser okay it will pick the browser whatever will give over here and that will uh will execute based on our uh if condition okay so browser dot contains chrome if it contains chrome then it will will create the object of chrome driver class and we'll uh execute our test cases in on i mean we'll launch chrome browser if it is firefox then firefox browser if it is i then i and here before we'll navigate to url let me do one thing the next thing is we need action driver class so that is very important so we have this action driver the second component which is very important so let me show you that one so already i have that action driver class guys so no need to worry about this i'll share this when we upload when i upload my project in github then at that time you can take this so this is very important uh one of the important the core of the framework is this action class and we have to import this base class from what happened yeah do control s yeah so this is the so this action class will extends base class and here we have different reusable methods which we are going to uh let's say we are going to perform different actions right we are going to perform different actions on web pages so for all those actions we have separate methods in this action class whatever actions user actions which we are going to perform let's say this is scroll by visibility of element so here i have written one separate method so these are the reusable methods guys which will be used in any project which can be used in any framework so this class will be common for all the projects so here we have click because here we what we have done is we have created the object of actions class over here and move to element so this click method will do that job okay we have this find element we have is displayed and we have given the proper message as well here some of the methods recently i have added so i have not written some comments over here but here you can see so these are very simple method you can go through it if you are not able to understand then let me know we have is displayed we have is selected is enabled so whatever actions which we are going to perform type so instead of using directly same keys first we'll clear it and then we'll use send keys so this is the type command type method so the custom method which i have created okay so this is what this action class all about we have select by send keys we have select by index select by value so this is about the select class select by visible text mouse over by javascript we need uh we need sometimes javascript as well javascript click so this is js click switch to frame so frames related so you can go through it once when i share this with you guys so there are different methods in this action class which will which will call from our page classes okay so this is very good uh uh library so let me close for now what i'll do now we need let's say we need a driver dot once again now we want to provide some weights over here implicit implicit weight so simply all these methods from actions class are static so how to call from base class so i'm calling the base some methods from base class okay because we have just defined the browser if else condition over here we need to navigate to the application okay so driver action dot implicit weight we have so we'll provide some implicit weight over here so driver timeout will give let's say 10 seconds we need page load time out as well so driver so this is how you can call the methods from action class directly and i'll put 20 seconds of let's say 30 seconds of wait page load time i will navigate to driver dot get url i think we have launched url as well but let's see uh this driver.get url and instead of direct i mean here what we have the object properties prop dot get property because we want to get the url from this properties file so how to get by writing this command these things okay prop dot get property to call this method and here we have to provide the key what is the key url so this is how you can navigate to the application so this is the url so all done i guess so this is about this launch app uh method so we'll navigate to url at last by getting the browser from here from the config.properties and then we'll navigate to particular i mean this application url so this is about b base class guys and what is the next uh so let's write some page classes and we'll write the page objects okay so what are the different pages we have so we have index login homepage so let me write some pages over here so already as we all know that we have created the different i've created different of packages over here so here this is one of the package com dot my store page object so last time we have created this index page dot java now we'll write page objects over here so let me open the application as well index.php let me sign out yeah so this is the index page the first page so what are the different web elements we have we need to click on this search okay and we have the sign in button uh product search and we have this logo okay and so let's inspect all these elements and write the objects over here so let me inspect this sign in anchor tag yeah now we have class login so simply we can write like this guys at the red class we can give login so this is how you can write the x path so this here you can see one one of one so we can use this x bar now how to write the page objects okay so we'll write the page objects using page factory method so how to write so we have annotation find by annotation and in bracket what we'll write what is the locator which we are going to use so we are using for now xpath will write xpath and in double quotes we'll put the xpath over here and just put enter and we'll write web element and what is this uh sign in button okay so he simply will write sign in button like this so this is how you need to write the page object in page class uh find by and in bracket expert the locator name and this is the expert of my web element and you can write this in single line as well but just for uh it looks good when you write like in a couple of lines in two lines okay now what would be the next one we have this search this logo is there so we can inspect this logo so this is the what we have yeah image tag we have so instead of this login class will write like this and here we have image so here you can see we got this image as well so we need to verify this logo is present or not so we can write a direct find y inside this x path will write like this and web element what is that my store logo so we can write like this maestro logo what is the next element so we have this search product box okay so this is how we can so directly we have this id so we can use this okay so this time we'll use id locator find by inside break bracket will write id is equal to double quotes the idea of our web element and we'll give wave element search product or search box will write search box so just give some meaningful name search box product search product box okay so this is how we can give and what would be the next at this button we need to when we put the product name over here we need to just click on this button so this is i think button yeah this button submit button so name we have name located as well so we can use this name this time yeah it is pointing to this button only okay i will write find by and inside bracket we'll use this time name locators and we'll put our the name of the web element and we'll write web element the search button okay so these are the four web elements we found and we have written uh in terms of objects okay so we have stored all these web elements in form of objects in our page class and this class will extends base class guys okay so this will be the child child of base class and yeah now we have to initialize all these web objects okay uh web element so how to initialize them so we'll use public this will use the constructor and how to write the constructor same name as class name and we have one class called page factory and init elements method we have okay and we need to pass driver and this so this means it will initialize all the page objects of this particular class when we create the object of this class index page whenever we call different methods from this class and at the time when we create the object so automatically this constructor will be called and all the object will be initialized so that's the reason we are using this constructor using this init elements method now we'll write some methods as well guys user action methods so so the first thing is we'll click on this sign in okay we need to click on this sign in button then login page will appear so simply will write public void sign in or simply give click on sign in click on sign in method so we are performing some actions so we'll right click on sign in so what is the locator we have sign in button the web element we have sign in button once again once again we cannot i mean we can call directly click method but we are using this actions class action driver so we'll use the action class dot click we have click method so we'll pass the driver and locator name what is the locator name sign in button so this is how we can use and it will choose let me just add this through the declaration so instead of using direct click method guys we since we are using this action driver class so directly we can call the methods from this action driver using the class name because all the methods of this action driver is static so this is how we can call we have this click i have shown you earlier we have click method okay so this is how you can call and this when we click on this sign in okay so we need to link this index page in this login page so how to link because when we click on this sign in we will land to this home login page so this will return the object of home login page but i have we have not created the login page so let me create login page login page sorry login page and always give this generate commands guys so that is always good practice here you can see the author name and you can write some comments over here like when did you create what are the changes you are going to make so it's always good practice to add the comments in your class when you create so login page is created and inside this will return new login page like this we can return yeah and the return type of this method would be login page so hope you understand the connection because when we click on this sign in it will land on to this login page okay so that's how we have written we return the object of this login page so this is how we have written written new login page because to create the object we use keyword new so this will return the this login page object what is the other action which we are going to perform on sign in page index page yeah so let's say suppose we want to validate this logo so how to write public void validate logo so we have this my store logo web element so action dot is displayed method is there because we are going to validate this logo so simply will pass the driver so since we are extending base class so directly we can use driver and what is the web element we have this my store logo see this so this is how we'll validate my store logo and yeah we'll write directly return action because this method will return is displayed boolean so we'll change the return type of this validate logo to billion boolean and it will throw declaration as well so this is how we can write uh we can validate logo and in test class we'll call this method to validate the logo now suppose you want to get the title of the page so how to get public void gate title get my store title i would give and how to get the title we have driver dot get title method directly so we'll give like this and it will return the string and let's say my store title so this is how we can give my store title and it will return my store title and simply one second we have to change method return type to string okay so this method will return the title of the page and what else we are going to perform on this index page search we can directly search the product from here so before writing the method for this search let's write all the page classes guys so that it would be easy to returning the corresponding the landing page so so far we have written index page in login page so i'll write some other pages as well like home page i'll write home page as well i'll create home page class home page i'll use the generate commands home page and what is the next page we have account creation page so let me write that account creation page creation page what is the next search result page search result page and what is the next we have add to cart page we have seen order page the next page so order page generate comments and what next address page shipping page double p shipping page shipping page and what is next payment page order summary payment page the next would be order summary page and last would be order confirmation page yeah let me close all first so we are working on currently index page where is index space yeah this is the index so so far we have written all the web elements and initialized using constructor and we have written three different methods now i'll write the fourth method what we are going to do here is we are going to perform the search operation on this particular web element okay this search web element now will write public void i'll write method search product search product and inside this what is the search product box so this is the web element of search product box we'll write once again we'll call action driver dot type we have type this type is nothing but the same keys so if you go to this one here we have send keys so first it it will clear the box and it will write if you have already something then it will clear and write and this will it will call internally the same keys method directly we can write like action dot action dot type and we'll provide the web element over here what is my web element we have see this is a search product box and what text we are going to send so let's say we'll pass as parameter string product name i'll give product name over here and simply put it the second argument of the type method and guys just see when we type this search product box and product name this product when we type over here and we have to click on this button so for that we have click button button already we have seen click method so this is click method driver and locator name what is the locator we have for click search button okay search button we have to click so this is the locator web element web element in fact okay not the locator web element what is the next thing so as soon as we'll click will write product over here let's say t-shirt and click on this button it will land on this search result page so already we have written this search result page over here yeah this search result page so it will return the object of search result page so we'll write like this return search result page return new with new keyword like this and it will we need to change the method return type to search result so this is how we can write uh the search product method so so far we are good with this index piece guys so what is the next page now let's write uh when we sign in let's write web elements and methods associated with this login page okay so we have this login page over here let's identify quickly web elements so we have this email address so what are the different web elements we have this email address username we can say username password sign in button and create account this email address okay so let's say let's identify all these five web elements over here so here we have id as email so we can use this so again we'll use find buy in bracket will give id is equal to email and i will i will give web element name as uh user name similarly for password as well so this time we'll inspect this password field and here we have we have will take name so we can give name like this name locator and put password over here web element password like this we can give what is the next guys uh we have this sign in button click on this sign in just submit button id we have type submit class this is the class so directly we can use the id no problem with that so we'll write find element and id is equal to web element sign in button okay so so so far we have written three web elements now what would be the this is the to create the account new account we'll inspect this web email address so we have to provide the email address over here so input type text we have id we have name so you can use anything so we'll use name find by name will provide this and will give web element um email will give email only email for new account like this will give email for new account and we have to click on this create an account button we have name submit create so we can use this name create new account button like this you can give so this is how we can return different uh we can write different web elements on login page and now we have to initialize all these objects so we have as we have seen in the previous index class so this is how we can initialize so simply i'll copy this one using the constructor same name as class name so this is how we can initialize but we have to extend so this class all the page objects or or you can say all the page classes will extend base class so simply will give like this so this is how we can initialize the page objects now we'll write some methods over here so what are the different methods we have we'll write two operations over here two user actions so first thing is user login and create new account so let me write method public void login method okay so how to login into the application you need we need to enter email address and password so from action class we have type method action dot type will provide the web element what is the web element we have user username and text i'll pass couple of parameters in this login method so username new name i'll give password would be string password like this so i'll point the union over here and like this similarly for password password as well guys so we'll call this type method pass driver sorry web element so what is the web element we have password and we'll pass the parameter as a string so this is username and password when we click enter username and password and click on sign in button so for that we have click method in action driver class so we will pass the driver and web element we have this sign in button yeah so we clicked on this sign-in now as soon as we'll click on the sign-in the user will land on home page okay so this method will return the object of home page okay so we can write like this and simply it will return change method written type to home page so this is how we can do the next would be this email address so how to enter the email address i mean when we enter the email address we need to click on this create an account so we'll create another method public void create new account we'll write create new account method and what we are going to do here is we have to enter email so we'll call the method type from action driver class and what is create new account this button or this one email for new account we have this web element and text so [Music] we'll pass the parameter string new email i can give like this and we'll pass this over here so guys whatever parameter we are passing so we'll pass this parameter in the test class we'll pass from test class okay whenever we call this method login method then we will pass the parameters in from test class okay so this will also throws declaration and this will return the object of search uh object or account creation page so already we have created this account creation page because as soon as we'll write uh enter the email and create an account it will land on account creation page so this will return [Music] account creation page so this is how we can write and chain method to return type yeah so so far we have covered uh index page in login page for now and what is the next page we have home page so let's quickly write home page as well and then we'll stop uh the session for today then we'll in the next session we'll write other page classes and page objects okay so let me write home page quickly so as when we log into the application yeah so what are the things which we are going to verify here let's say as per our test case in home page what we are going to do wish list test and order history so let's say we we are going to verify this order history and my wish list so these two will be simple over here so simply what i'll do find y and yeah let's inspect this wish list so simply will verify whether this wish list is present here on home page or not and this order history so i can use this copy method as well guys copy as xpath later on we can identity uh we can change this we can do like this as well let's write our own custom x path so we have span and span tag and text what is the text we got as my wish list [Music] one second let's inspect it again we have this let's find a i and a great class and what is the next span what is what does this is so let's inspect this wishlist so simply right click inspect so here we have option also guys uh directly right click and copy as xpath and do like this simply what i'll do simply delete all these things and here you can see so we have six elements my list and inside this i'll write text like this and it'll give my wishlist like this so you can got this like this or directly you can write like this as well your custom x path so we got this x path put it over here x path like this and web element what is this xpath my wish list so my wish list like this you can write what is the next we are going to verify this order history in detail so simply inspect this we will copy this as well and instead of this my wish list will put it over here so here you can see this is how you can inspect this my order history and details copy this x path will write find element inside this x path and we'll put it over here web element order history and details order history what is that order hitler entity order history let's let it let's keep it order history only so this is how you can write the web elements on this home page and now we need to initialize the video web page objects okay so we'll use constructor and instead of this yeah so we have to create the constructor like this home page and this is how we'll initialize and this class will also also extends base class okay and now let's write some methods so public public void validate what is that my wish list okay this is how we can validate you can write like this and how to validate so we have in action driver class we have is displayed so simply will pass the driver and what is the web element we have this my wish list and this will return boolean so simply i'll write like this return return keyword and change method return type to boolean so this method will return boolean and later on we'll call this method in our test class to validate this wish list okay similarly we'll write for public void and validate order history so how to write that order history so action class again we'll call uh is displayed method will pass the driver and web element what is the web element we have this order history and simply put semicolon at the end and this will throw the declaration as well so this is how you can write a home home page so we have two couple of i mean couple of methods over here validate my wish list and validate order history so we'll call uh as per our test case guys we have covered three pages so far and yeah five test cases we have covered i mean we have we have written some methods over here in test classes and we'll call those methods in test classes in terms of when we create the test cases okay so rest of the page will see in the next video guys because i don't want to make this video very lengthy so i think we are done for today login page we have return and index so we have covered almost everything like these four points and we are on this point so we'll cover the remaining ph classes and page objects in the next video thank you guys for watching have a nice day bye hello friends welcome back to automation testing insider.com so this is the third part of selenium framework development series so as you all know that we are constructing data driven framework with page object model from scratch so this is the third part of that and so let me have a look the agenda what we have done so far so in the first video we have already covered the framework architecture and in the second video we talked about the navigation the page navigation and we have written manual test cases which needs to be automated as part of this framework so we have already seen them and we have updated the pom.xml in our project we created a config.properties we have created a base class and action driver classes as well so this is what we have seen so far and we have created some page classes as well and we have written some page objects and user action corresponding user actions methods as well related to particular page object page class so this is what we have done so far and let's have a look the remaining pages and yeah before that uh let me show you one thing guys so i have created this page navigation workflow so here you can see so last time if i open this uh excel sheet so last time we have created page objects for index speech login page and home page so three pages we already done and corresponding we have written some methods because we need to test these test cases these are the test cases which we need to identify so for that we need user action methods so that is what we have done and yeah this is the simple understanding of this page navigation of e-commerce application which i have picked my store page navigation so first we have index page and we can directly search the product on index page so this is the landing page of index page from there we can go to add to cart page when we select the product and from add to cart will go to order page and if you are not login into the application then uh login screen will come and there you have to login the screen uh log into the application if you already logged in then this page this step will be skipped and you you'll directly jump from order page to address page similarly from there you'll go to shipping page payment page order summary and then order confirmation page so already i have shown you the navigation in the last video and from login page we have couple of more navigations uh we can go to this home page when we log in into the application we'll get the home page and from login page we have another option this is to create the new account so we have account creation page as well so this is how the navigation will be and this is easy to understand while creating the framework so let's get started with the fourth page which is account creation page so this this is my eclipse and here you can see last time we have created dot java we talked about this action class and base class also inside base class we have written couple of methods so this is to config load the configuration so we have load config method and we have launch app method to navigate to the application url to launch the application so we have this launch app method so this is uh about action class and base class and what is the third page account creation page so let me open this account creation page and now we'll start navigation from if you click on sign in then in this login page let me open the diagram as well so you can understand better yeah so from login page we can navigate to account creation page so from here we can go so simply you need to enter the email id and this action will be there in login page guys so already that part we have covered in the last page so here you can see we have written one method called create new account so from here we'll navigate to account creation page so when you click on this create an account now this page will appear account creation page now here we'll create the new account by filling all these details so for as part of our framework we are not i mean i'm not covering all these stuff let's simply verify whether we are navigating to this page or not so we'll verify this create an account uh i mean this page header is coming or not the title of uh what you can say the page is not the page title this is the we can say form title so let me inspect this so we can write x path like this so this is how you can write the x path for this text so simply copy this and using page factory method will write the i will find the uh web element okay so this is how we'll write and no need to write driver.find elements like that because we are using for page factory method and if you are new to page object model guys so you can refer let me show you which video you can refer on my channel yeah here we have page object model so couple of videos are there related to page object model basic model basic approach and page factory approach so you can go through that if you are new to page object model so here we'll write x path and simply i'll put my xpath over here and we have to store in web element so i'll give let's say form title that is the new page and this is the title of the page once india and we have to initialize the page objects using constructor by using a page init elements right we have seen in the last video so this is how we can initialize we have to create the constructor of the particular class in this case account creation page and this is how we have to initialize all the objects so by this constructor okay so and we have to extend base class so just remember guys all the ph classes will extends base class so this is how we we can do and we have to validate whether that this text is present or not so how to validate public void what we can write validate account create page whether user user is user is able to navigate to that page or not so simply we have this form title or from action driver class this actions class action class will call is displayed method we have is displayed method driver will pass driver and we'll give the web element as form title this is how we can validate and this will throw declaration we have to give through the declaration for this method and simply i'll write written statement return so in case if this title is present then it will uh give true result so that's why we have returned this boolean so this is about account creation page what is the next page now search result page so let me navigate to search result page so just come back to index page the first page so from here directly user can search the product okay so one second search result is already we have seen us search this is search result page right i mean yeah the next one is search result page so whenever we search anything product over here let's say t-shirt and click on this search button so this part already we have seen index page where we have navigated to this search result page and from here we'll validate this product okay and from here we'll navigate to add to cart page that will be the next navigation so we'll simply inspect this product and we have an option here like copy xpath later you can customize this x path so simply what i can customize like this so here you can see we got one of one so we can simply we can use this xpath and come to search result page and here again we'll write using page factory method find by inside that xpath is equal to this is my xpath web element i'll give product result product result uh yeah let's give product result only so this is product result which we got okay and i think one one element would be enough on this page because simply we need to click on when we click on this one you can add to cart from here as well but i'm not navigating from here we can when we click on the product which is uh showing here it will navigate you to add to cart page so from here will navigate okay so let me write the constructor to initialize the page objects so simply will change this class name okay so this constructor has same name as class name and this will extends base class this is how we can write and now we need to click on this product so when we click on this add to cart page will be displayed this is the add to cart page and product availability test so what we'll write and guys we need one method here because we here we have one test case related to whether product is available not or not product availability test so what how we can test public void is product available like this yeah so we have from action class we'll call is displayed and we'll pass the driver and what is the web element product result why i am writing this method because we have one test case related to this page search result page so this is product availability test so that's why i'm writing this method and this will return we have to do and here we'll return this uh method will return boolean so like this okay later on we'll use this method to verify whether the product is available on that search result page or not and what would be the next navigation we have to click on this when we clicked on this one it navigates to add to cart page so we'll write method for that public void what we can say will write click click on product click on product so this will navigate you to add to cart page so how to click so we'll use action class class name dot we have different uh methods over here here we have click method so we'll write driver and what is my web element this is my web element so when we click on that product result and this will throws okay exception throwable i mean throws throwable and it will navigate to add to cart page so simply it will return one second new add to cart add to cart page correct when we click on the product it will navigate to this add to cart page so from here change the method rate and tap to add to cart page so this is about search result page now we'll write page objects for add to cart page now so open add to cart page now now we are at add to cart page so simply what are the different fields we have web elements we have this quantity size and add to cart button okay and when when we click on that uh one window will appear from there we have to again check out uh the product okay so let's inspect this first quantity so for quantity we have this id we can directly pick this so again we'll write find by and inside this id like this web element what is that a quantity quantity you can write like this and find y for the size let me inspect the size so we have a name we can choose this name and this is drop down guys so i'll show you the method in action class so name will take like this and web element that is size so these two are done now what would be the next add to cart button so simply select this add to cart and here we have this so simply copy as xpath letter will or directly will write our own xpath so we'll go to button one second let me inspect it again add to cart copy this text and spawn tag said that text like this we can do we got one of one correct so this we can take this x path and that find by name not name x path like this and web element what is the web element add to cart button add to cart button this is how we can write the web elements we can look at the web elements and now we'll read need this constructor correct to initialize all the web elements so simply we have to change the constructor name as class name so so far we have done and yeah we forgot to extend this class so so far we have done guys uh now what we'll do we'll uh create i mean we need to click we have to select the quantity so we'll write one separate method for that public void we'll write all the page actions right user actions what we are going to perform so we'll we have to select the quantity public void select or enter quantity enter quantity so how to enter the quantity we have in action class we have type method what is the web element quantity and text so what is the text here put in form of in the form of string parameter will pass size and simply will use size here i would parameter like this and this will add through declaration we have to add so this is for enter quantity guys and similarly we'll do for right separate for select to select this color i'm sorry to select the size public void select size like this and in action class we have one method select select by visible text we'll use that we have different methods in action driver class so we have select by visible text so that is the simplest one we can select this a size or m or large so let's pass the size as parameter sorry this one is quantity sorry guys this is quantity and this would be size and here we'll pass the size to this and what is actually we have to we have to change this to one one like this yeah we cannot keep the same as web element we have taken the same the parameter so we have to change the different value the parameter name okay and here we have string size and element size okay here also size one size one like this and this will actually that is different through declaration like this so from drop down we'll select uh particular size will pass as parameter so this is about to enter the quantity and select the size we can select the color as well but i'm not covering this as of now let it be default only and will click on this add to cart so for that we'll write separate method public white click on add to cart and here we'll write action class dot we have click method driver will pass the driver and what is the button name we have add to cart the element name and this add through the declaration so these are the different user actions on this add to cart page guys uh so we'll click on this add to cart so what will happen when we click on this add to card one new window will appear and from here we have to verify let's see we have if you have test case so whether so we have add to cart test uh in test case so we have to verify when we click on this one this is successfully added or not so we can verify this message or this arrow this right button okay so let's take this so simply i'll take copy as xpath put it like this and what we can do we'll delete all these so we have two h2 over here h2 tag is the first one and from there we have to go to i yeah this is fine so we can select this part that is also fine so we can take this x path and we'll write one method public void validate add to cart whether user is i mean whether a user is able to successfully add the items into cart or not okay so so this part will verify add to cart validate add to cart and action dot is displayed and will pass driver and what is the element element we have sorry we have not written the element that find by xpath so this is the x path of this right button okay right let's say yeah this i will write web element and add two card card message we can give like this add to cart message and simply will pass this here in our is displayed method semicolon and through declaration and let's return that the boolean value so we have to change the method to return type to boolean so this is also done now we need to click on this proceed to checkout one more method we need to write so public void click on checkout okay but before we have to we have to inspect this so let me so how to write the xpath for this one ctrl f span tag and inside that text is equal to proceed to checkout let's see if we are getting that or not so we are not getting one second guys [Music] pause it to check out proceed to check let's use contains like this and here we'll write contains to give one more packet over here now here you can see so this xpath is fine here you can see one second yeah it is highlighting this proceed to checkout so we can use this x path and here we have to write the find by the page factory for that add to cart button sorry proceed to checkout and here we'll write web element proceed to check check out button like this will give and we'll use this now we need to action now guys already we have seen uh there i have seen this because for this to click on this one we need the javascript uh click ok so we have separate method in this action class so we have that js click so we can use this we'll pass the driver and element so this is my element so let me show you this uh throttle declaration this js click click js click method so this is from action class so it takes two parameter web driver and element and here you can see we have used javascript okay so we'll use also need to click on this one we need javascript this is what we have done and when we click on this proceed to checkout it will navigate to this summary page what is the next page i took order page so this is the order page okay so [Music] yeah so what we'll do so that will return the object of order page correct order page so like this we can write and simply change the method return type to order page so this is what we can do we can write web elements for add to cart page and different user actions we can write in the form of methods now what would be the next page we have order page here so we'll verify few things in order page on order page so let me open the order page now this is the order page write some using page factory will first of all we need to extends class and now let's inspect some web elements over here so we need to click on this proceed to check out guys but before that do we have any test case so price test we have to validate the price on the total price okay so what we'll do how to validate the total price so first we need to validate this unit price and then we'll do some calculation on our script and then we'll compare so for that we need two methods to capture the we'll write two methods okay so first we'll get the this unit price and the second method will get this total price and in the test test class will in test script will compare these two based on the calculation okay we'll add a couple of quantities to quantities over here and add this total shipping charge as well and that will give us this amount total amount so that's how we can validate so for that we need this unit price and this total price so how to get this unit price and total price so so let's inspect this one unit price first so this is the copy as xpath like this we can get but what i'll do i'll write my own customize xpath it's better to write so we have this class td and at that class we have this card unit and after that we need to navigate to span span tag and again one more span so here you can see so this is how you can write your customize export and simply will write x path like this and here we'll put web element a unit price unit price similarly for the total price we need to validate so let's inspect the total price so this is the id it is already given guys so let me if you search with this id we got seven sorry i think that is fine so we can see like this span tag and id is equal to like this so already we have one so either we can use directly id or this x path so let's use directly id this total price so simply what we'll do instead of xpath will use id and i'll write id over here and this is the total price total price of the product so two elements we have identified now let's identify this procedure check out as well proceed to check out instead of will give text i think we need contains contains method text and inside this like this so you still have couple of elements yeah this is the correct one so we'll navigate from anchor tag anchor tag and then span tag so i think this will give again it will give couple of um let me copy as xpath put it over here this is how we got span and text like this we can connect you like this yeah i was writing some wrong x paths so this is how we can write the x path for this proceed to check out and simply find by and x path of that particular web element uh this proceed to check out web element proceed to check out like this we can give yeah this is done now we need a few methods to couple of methods to compare to get the unit price and to get the total price so how to get the unit price so public once again first of all we need a constructor to initialize all the web elements so it simply will replace this will give this order page as class name so this is the constructor to initialize all the web elements like we we did for previous different page classes i will write public void get unit price okay so how to get the unit price so this unit price you want so what will do action not will not use action driver dot one second guys we'll directly use this unit price dot get text because that is web element so we have this get text method and that will give me string result correct so let's say this is you need price you can write like this oh sorry we cannot have the same name yeah like that this we can have we need price1 unitprice.gettext now we need to now we got the text we have to convert we have to remove this dollar symbol so how to remove this okay so unit price dot replace all method we have replace all and regular expression we have to give guys so for that i have this replace all the special character and so we have one special character over here right dollar so that will replace with blank okay so this is how we'll get and this will give you string let's say you need i'll give this time unit and now what we'll do got the unit price now we have to convert that is string that is still a string right so we have to convert that into double so how to convert we have double class and what is the method we have parse end parse double and we'll pass that unit method sorry unit string and this will give you double as value as double so [Music] final you need price we can give and simply what we'll do will return this final unit price in this method and one more thing guys uh we got we'll get four uh or this one one six five one because it will remove this dot also so what we'll do let's say we'll get one six point five one correct uh sorry once we'll get one six five one one six five one but we want one six five one six point five one so we'll divide that into hundred so we'll get sixteen point five one simply will return and will do like this and this method will return double okay so this is how we'll do and similarly for the total price also we'll write in the same way and gate will write total price to get total price and inside that simply change total total price and final total price final total price or final price yeah final total price you can give and simply replace this with diot over here like this so hope it is done so this is how we'll get the total price and this is for unit price so two methods we have written now what is the next method we want now we need to simply click on this proceed to checkout because to validate the price we have test case right to validate the price so for that we have already have got two methods over here get unit price and get total price so that these two methods will get the unit price and total price respectively now we want to click on this and later on we'll use these two methods in test class in our test method to compare the prices now we need to just simply click on this proceed to checkout so for that we'll write public void click on checkout and simply we have in action class we have click method so simply will use that driver and locator name already we got this proceed to check out so simply will put locator name over here and add through declaration and this will return you when we click on proceed to checkout let me click on this one so this will return the sign in page okay the landing page of that order page would be signing page say sign in page right so login page so simply i'll return return what here simply return write written statement over here login page like this we can write and instead of void will give login page as date return time so this is uh about order page now here we have to sign in so later on we'll call in the already because we have sign in method we have already created sign in now what would be the next step now here what we'll do guys in sign in page we have one more method let me open the login page not signing this login page so here you can see this login returns the home page now we'll write method because here we have to sign the application that will return the address page right so simply what i'll do i'll create one method one more method login method this time i'll give login1 and that will return the address page because in this flow if user is not logging logged in into the application earlier and if he starts with the index page then he has to log login into the application after this order page right this sign-in option is there this login page so that's why i'm returning the object of this address page so once we login into this application it will land on this address page correct so that's why i have written inside this login page one more method login one that will return address page and will change the return type of this method to address page okay so this is because we have two navigation so this will land to home page and this will land to address page now in this address page what we are going to write we can validate the address or we can update the new address so for now what i am doing i am i will just click on this proceed to check out so we have address page let me open this open the address page so this is the address page and simply i'll verify this proceed to checkout and ctrl f span tag and inside this text like this we can get this proceed to check out so this is the x path of proceed to checkout button like this you can write web element web element proceed to checkout like this we can write web element and this page will also extends base class okay and in the same way we'll write a constructor to initialize the web element copy from previous class and put it over here and we need to just replace this login page to address page okay so to initialize the web element and what method will return over here because we are not going to test anything on address page so here we don't have any test case so simply what we'll do we'll write public void click on checkout click on checkout method is there we'll write okay and simply will click on this proceed to checkout so from action class we have click method will pass the driver and simply will provide the web element this will then we need to add through the declaration and this will return the next page okay so when we click on this proceed to checkout what we'll get will get this shipping page so shipping page already we have created so that will return new shipping page okay guys and change method return type to shipping page so we can change the method return type to shipping page so this is about a ship address page and now next would be this shipping page so open this shipping page and yeah so we here we have two things we have to this terms of service we have to check this check box and yeah we don't have any test keys for now so simply we have to click on this check box and click on this proceed to checkout so let me inspect this check box first so this is very easy we have id cgv so we can take this and we'll write fine by inside this id is equal to this one web element let's say terms i would give terms and what is the next one find element sorry find by and we have to inspect this one okay so let's see if it is working it's not working expect this one proceed to check out why it is not working so navigate from button now let's use contains contains whether it will work or not we'll see contains and what happened proceed to check out we need one bracket over here like this so we have two of two things over here which i will go navigate from button now yeah so this is how we can customize your xpath so i we have this button so i navigated to this button tag and from there span tag from span where we are searching this text proceed to checkout so this is how we can get the xpath expert i'll write here web element proceed to checkout button and we need to just extends base class and here well what we'll write we need to just copy the constructor and simply replace the class name this method so this is constructor to initialize the web elements now we'll write public void click on check what is this proceed to checkout click on proceed to check out and simply what we'll do we have in action class we have click method we'll pause the driver and the element which we have we have written here like this we have to add through declaration and this method will return the next page object so when you click on select this checkbox once again guys we need one more method over here public void click on terms or check the terms check the terms we can write like this and yeah okay so we have in action class we have click so that will select that check box we have this terms over here so this is what we can write and that will add through the declaration and let's say a little bit like this only let it be void only and here this will return the new next page when we check this checkbox and click on proceed to checkout so that will navigate to the next page so right now we are writing a shipping page right so what is the next page we have payment page so that will navigate to the payment page so this is the payment page this payment page and here we'll create two payment method and when we select any of the payment method then it will get to the next page okay so for this what will it will return the payment page object and return type we need to change to payment page so this is about shipping page now we'll write payment page let me inspect these two payment methods so here we have p by bank wire so we'll write the xpath anchor tag is there inside this will search the text p by bank where we have to use contains like this and remove the white spaces yeah here we go so we got this the first payment method p by bank wire so we'll write find by find by and we'll write over here xpath export correct put the xpath and web element this is pay by bank wire so bank where method will write like this and second simply let's copy this second would be check so let me let's copy this and reuse that so what is the next pay by cheque so pay by simply right check i think this should work yeah here you can see so this is the correct x path so simply will replace this x path over here so this is for the second method and we p by check method so we have written a two web elements over here and this will extends base class like this and simply we have to initialize our web elements so we'll use constructor like this using init elements in page factory class now we need to click on any of the methods so let's click on this one p by bank pair so for that we'll write public void click on payment method and action dot action dot click we'll pass the driver and this is the locator web element we have and this will add through the declaration and when we click on this payment method let's say click on this one the next page would be order summary page so this would be the order summary page the next page would be order summary page so here it will be the summary of the page so what i'll write return order summary page like this and new keyword we have to add yeah and we have to change the return type of the method so this is about payment page guys and what is the next order summary page that's extends base class now i will write the order summary simply we need to click on this icon for my order button so let's inspect this what is happening oh it is already clipped let's go to the previous page we will copy this text let me try to put it over here whether it will work or not and span tag yeah so this is working this x path so simply we can take this x path and here we'll write find by xpath put it over here and web element confirm order order button so that is confirm order button so write meaningful name of the web element like this confirm order button and yeah that is the only thing we'll write the constructor that order summary page simply will write constructor like this public order summary same name as class name and using init elements we'll initialize this page object okay and in this page what we are going to do yeah we need to click on that button public public void click on confirm order order button so yeah so this is the method and simply will in action class we have click method we'll pass the driver and this is my confirm order button so simply i'll put it over here and it this will add through declaration yeah so this is about this order summary now when we click on this one so it will return the last page guys so what is that order confirmation page so we'll write like this order confirmation page that will be the landing page of this order summary page and we have to change the return type of the method to order confirmation page so this is about order summary page and yeah when we click on this some error is coming guys so let me go back let me try one more time i think we have to go back to the first let me try again with new order click on product add to cart post it to checkout proceed to check out so here you can see since we already signed in so that's why it directly jumps to this address page so proceed to checkout select this terms proceed to checkout and this would be payment page and when we select the payment method it will go to this confirmation and when we confirm the order so this would be my last page okay so what is the last page order confirmation page that will also extends base class and what we are we need to do here is we need to just validate this method message simply inspect this message this message guys so like this and copy as expert yeah so this is the message but what we'll do we'll write our own just copy this message and let me get to p tag we will write contains method contains inside this text where text is this but we cannot directly jump with the next there is strong this is strong tag is also there so this is how we'll get simply copy this x path right find by write x path and this is my x bar and we'll write web element so we can write over here confirm message you can write like this confirm message and simply we need a constructor as well for the last page as well to initialize this web element we can do we can create the constructor like this and simply we need to validate this uh confirm message public void validate confirm message and simply so action dot is displayed method is there we'll pass the driver and what is the web element once again we'll do one thing with this confirm message we'll get the text okay and that will give that will give a string value confirm message like this we can write and we'll return that message confirm message okay this is how we can write simply this the return type will be changed to string so this is how we can write the validate confirm message method and later on when we write the test case we'll compare whatever text we'll get over here and we'll compare with the expected value so i think we are done for all the all the page classes guys we have written the web elements and corresponding user actions method so i think this part is also done from the next video onwards we'll write the test cases we'll write the test class so all these page classes are done and where is the test cases so here we have we'll write our test cases inside this folder src test java so thank you guys for watching have a nice day bye bye and if you're new to my channel then please subscribe it thanks a lot bye bye hello friends welcome back to automation testing insider.com this is selenium framework development part four and as you all know that we are constructing data-driven framework with page object model so this is the fourth part of this series and guys if you are new to my channel then please subscribe it for upcoming videos so let's get started with the agenda so we have covered so far three sessions so this is what we have covered in session one what we have uh covered is framework architecture in the second uh session we talked about the navigation the page navigation and we have i have shown you some manual test cases which needs to be automated as part of this framework we have updated our form.xml we have created config.properties and we have created base class in action driver class and in section session 3 in the last session we have created the page classes and we have created page objects and corresponding user action methods okay so that will be used when we write the test cases so this is what we have done so far and now today we'll see we'll create the test class and we'll write the test cases okay so already i have written over here different test cases over here so here you can see we have around 10 test cases and we have these are the expected result of all these test cases and so far we have covered all the ph classes we have written all the page classes page objects everything is done and we have written the corresponding user actions method as well and these are the test classes which we need to write and corresponding we have some test cases so let me go over the this project directory and last time we have discussed the page navigation so we have written all the objects uh for all the pages guys uh whatever we have covered so far uh index page search result page ad card order page and we have seen that how one i mean user can navigate from one page to another p and how returns the object so you can easily relate when we write the test case like what is the usage when we land to the uh the next page the destination page and what is the usage when we return the object so you can easily return easily relate when we create the test cases okay so let's get it started with the test case so let me open my project so this is the project in eclipse my project my store project and so we have action driver class already we have implemented we have base class as well and data provider and other stuff we'll see in the coming videos and this is the page objects page objects package where we have created all the page classes okay and inside this we have src test java and here we'll write our test cases okay so what would the first test case test class is index page test and we have couple of test cases related to this index page test so let me create index page test first and always select this generate comments and you can write some comments over here and what and let me go over the base class for now i mean just quickly so this is what we have created in the second video base class so this is the load config load config method and we have given annotation before test so this will read before uh we'll start the test and it will load the configuration file okay and we have this launch app method and in second video i just copied from copy and paste from previous class so there is little bit changes required in this launch app method so i did those changes so yeah so here you can see we have used a web driver manager to launch the browser okay so we have set up the chrome driver using web driver manager and yeah we are getting the browser from config.properties file and we are storing in string variable and simply we have if else condition and let's say if you get chrome browser chrome from properties file then we'll set up the chrome driver using web driver manager and simply will launch the browser using this chrome driver we'll launch chrome browser okay so this is how we'll do based on the browser name and later on we maximize the window so we have applied implicit wait of 10 seconds here and page load timeout 30 seconds and this is uh to navigate to the url to the application so this is about base class so let me write a couple of test cases so public void i'll write setup method guys setup method and i'll give annotation before method okay and all the test classes also extends base class okay so here you can see in the architecture which we have already discussed in the first video so this is my test component test script component where we uh i mean store all the test classes this will extends base class okay so this is the link between base class and our test classes so let me come back and here what i'll write so before whenever i'll execute any test case so i always launch the application correct so simply i'll call this launch app method from this setup method simply we can launch we can call this method no need of because since this index page test is extends this base class so simply we can directly call this method and what would be my second method let's write the second method method as well what public void tear down tear down and i'll write driver dot quit so this driver is from base class so directly we can access this and dot quit so and this will give the annotation after method so you can keep this as in in top on top or you can keep it at last as well that doesn't matter now we'll start writing our test cases so public void what is the first test my store logo test okay so let me open the index page as well index page class so page objects we have index page so if you remember we have written couple of methods over there validate logo and store title so these two test cases belongs to those two methods user action methods okay so simply what i'll do public white verify logo i'll write one test and what i'll do now we need to access this index page okay and there is no connection between there is no connection between test classes and page objects component okay there is no connection between them so what we'll do will create the object of index page when we when we want to access the methods from index page so we have to create the object of this index page correct so what i'll do i'll create the object of let's say index page i need to create the object like this and then and we have to import my this from page objects and then we can call those methods so what is the method validate logo and add through the declaration so guys i may need this index page object so what i'll do i'll write on top of the class this test class i'll declare like this so that i can use this for all the test cases so this for this one test case we have to add test from org.test.engine.annotations and similarly yeah here and we have to remove this index page from here so directly we can use this index page from what we have declared at top and this will return boolean result correct boolean let's say flag or will give result result and now we'll put assertion over here because without validation your test is nothing of is of no use so we have to verify whether this logo is present or not so how to verify as a dot assert dot asset true we have this method asset true in a certain asset class okay so simply will write this result over here okay so this will give the result based on whether uh if you get the logo on that particular page so this is how we can write the first test case and now let's write public void what is the second test case store title verify title so this is how we can write the second test case and we need again this index page so now no need to create the object again because already we have created the object in the first test and yeah we are using uh on top of it okay this index face so directly we can call the methods uh what is the method we have let me what are the different methods we have this one get my store title correct so this will give us a string type of variable and i'll give title like this i'll store in a title variable now now we'll put assertion asset dot asset equals and what is the actual so this is the actual result you can give actual title over here instead of title actual title and what would be the expected so this is index page guys so here i'll open let me close all of this and one automation practice dot index slash index.php and let me see the vp source what is the title of the page so this is the title of the page my store okay so simply we can write here or you can store in a separate variable and you can compare you can put that variable name over here so or directly we can do like this so this is how we can verify the title and simply will give address over here so this is now so our first test class is ready and we have written couple of test cases my store logo test and my store title now let me try whether it is running correctly or not so what it will do first of all when we when we run our test so from base class this method will run first this load config because this is before test we have given the annotation so this will load our properties file and later on based on our before method it will call this method launch launch app so it will go back to this base class and it will uh run based on the browser so let me show you what browser we have in config.properties file so let's change it to chrome for for the first time okay and yeah so yeah so it will launch the browser based on the browser name and later on this all the test cases will be executed we have couple of test cases two test cases those will be executed and then last lastly it will execute the teardown method so let me run this so slowly we'll do one by one all the classes guys uh will run separately and at last once everything is done every test class is ready then we'll run together all the test cases so currently i'm running individual test class and later on we'll configure testng.xml and will run the entire test suite now here you can see the first test case got executed now it browser is launched for second test case now this is the second test case so both tests got executed and here you can see the result verify logo verified title so we have couple of test cases both got executed successfully and yeah so this is how we can execute our test class so both of our test cases got passed now we'll write the next test that is login test login into the application so for that we need we need to create login test login page test class so here i'll create login page test click on finish let me close this and configure properties as well and another thing i'll show you let's run on different browser let's say suppose i want firefox so let's see whether it will run on firefox or not so that that is also that's that is also we need to check and let me run it again on firefox whether it will run or not now here you can see firefox browser is launched and yeah it will navigate to that automation practice website and then it will get the logo and the title and it will close the browser this is the second test case yeah here you can see so we have two test cases two test cases got passed so it is perfectly running on every browser i mean so far we have covered chrome and firefox so we'll see i sometimes uh later okay so let me close this one and this this is what we have created login page test so these two methods will be common setup and teardown so simply i'll copy from the previous index page test okay and now and we have to extends the base class this base class okay guys now we have to uh login test we have to create the login test so public void login test like this we can create now again we have to create the object of index page correct so we'll copy like this we'll put it over here and at top i'll give index page and index page like this correct and now in this index page we'll call click on sign in correct when you go to index page index page we have the sign in option so i'll call this sign in option it throws we have to add through declaration so when we click on this sign in so this p this login page will appear correct and uh yeah and will store when we you can see one second let me show you and this is click on sign in and this will return the object of login page so what we can do here we can store this in login page object okay and at top will define login login page like this and here login page the object so this is how and we have to import this login page as well so this is the beauty of the page object model guys and this is also called the ph channing model because each page is related with another page the landing page so this is what we can do when we click on the sign in button it will lands on this login page so we'll return the object of login page now using this login page object will call login method we have if you remember let me show you this login method so that login method is from login page class correct so we have this login method so simply we can call this login method and here we need to put a username and password so let's so we'll take the username and password from config.properties correct so this is configure properties so we have username and password so how to give the username and password we have this prop object of from properties class and great gate property correct and what is the key username so simply will give this key over here and similarly for password drop dot git property and what is the key for that password and we have to give in double quotes like this and this should be also in double quotes correct like this and so we are calling this login page so this will return what this will return this will return the object off once again this will return the object of home page class correct let me show you that if you go to this login page so here you can see it will return the home page because when we click enter the username and password and click on sign in it will land on home page so that's why we have written like this home page and on top we'll write home page and we'll write like home page like this object and now we need to verify whether is whether user is successfully logged in into the application or not so how to verify let me log into the application first we'll do one what modification on this page guys okay on home page so now we got the home page object so what i'll do in home page let me open home page here we'll create one method public void gate url or i would say current url okay so that we can identify what is the url at home page so at home page home page we are creating one method called get current url and uh so simply will call driver.gate current url like this and we'll store in a variable or simply we can return like this let's store in a variable that would i mean look wise it will be good okay so string current url or home page home page url like this and simply will return this homepage url correct and change method type to return string so we have created one method gate current url that will return the url of home page in the home page we have created this method now what i'll do so we got here home page object from here we'll call that method get current url correct so that will give me the url so that i'll give like actual url actual url and this would be a string and now what i'll do i'll put assertion over here assert dot assert equals and what is the actual this is the actual and i'll put one expected url as well here i'll put expected url expected url now we'll see what is the expected url at home page so we are at home page so this is the expected url of home page guys so simply will copy this and we'll put it over here so this is the expected url of home page and simply will put in absorption so the assertion will compare the actual verses expected and which will give the result based on the whether it will match or not so let me try this test and here we'll put a thread test annotation so let me try now this login page test whether it is working fine or not so right click and run as test ng test so it is running on firefox so it will launch automation practice.com on the index page first and then it will click on that sign in sign in is clicked entered username and password but it is filled white is filled let me try on chrome i think we need to put some weight as well so we'll see that let me try on chrome first and we'll see what is the exception is coming i think it's because of the timing issue uh synchronization we have to put some weight over there well it is perfectly fine on chrome browser so let me try one more time on firefox white is giving error again it is failing so i'll check this later on guys uh why it is failing on move target out of bound exception so we need to check i think some pixel related uh problem is there so let's run on firefox chrome for now and i'll see what is the problem later on because if i see the problem it may take time so i'll try the synchronization and then let's try with the let me click on sign in [Music] here i'll put bit action dot we have fluent weight in action class so what is the element will provide this sign-in button and timeout 10 seconds click on sign in on login page as well login is not required so let me try again if it is not working then i'll check it later on i think some other problem is there so i'll check this guys later on move target out of bounds exception report with the height and yeah some pixel related problem i guess so i'll check this later on so far it is working fine on chrome browser so i'll change this to chrome and now so this login page test is also done now what would be the next uh this home page test okay so we have wish list wishlist and order history on this homepage test so how to test that so our login page test is done guys so let me try to run this and i'll put a chrome is there so guys our login page test is done so let me try to run this so i'll run it on chrome browser and i'll see whether it is running fine or not so let me run this right click run as test ng test browser is launched it will navigate to automationpractice.com and then it will click on that sign in and it will enter username and password that email address and password click on sign in successfully signed and close the browser so login test is passed now what would be the next we have home page test as well so what i'll do i need to create another test class home page test home page test i'll create and i'll select generate commands and what i'll do again we need a couple of these two methods launch setup method and teardown simply i'll copy and i'll put it over here homepage test and this class also extends base class like this now at home page what are the things we need to test wishlist and order history so i'll write couple of method public void verify or verify this list or simply i'll give this list test and here i'll give the test annotation now how to go to home page so first of all we need to login into the application correct and then we'll go to login page i mean home page so what i'll do how will navigate i'll tell you so first of first of all we need the object of index page when we launch the application so we'll need the object of index base so i'll write index is like this and here i'll create the object of yeah i'll create like this new index page like we did in previous test class like this we can do and then sim simply we need to call the associated method so we have sign in click on sign in method and this will return so here we can see let me sign out and yeah so this is the index page guys so here we need to click on sign in and then login page will come so this will return the object of login page simply we have to create here login page login page object login page like this add through the declaration and this login page when we got this login page then we need to call login method correct so username password we have seen in the login page test so simply i'll copy that that part let's copy the entire this line and i'll put it over here and this will return the home page object when we log into the into the application correct so here we'll create home page object this is the object of home page we have to import homepage from com.mystore.page objects correct and this will yeah this login method will return the homepage object correct so that's why we have written like this and in home page homepage we have those two methods validate my wish list so i'll call this and yeah so this will return boolean result whether this is available or not okay so i'll write boolean or result like this one variable and simply will put the assertion assert dot assert true and will put the result like this so this will verify whether this wish list is available on home page or not similarly we'll write another test case so all the steps would be same except the last so this i what is the next case order history details test so simply i'll give the method name like this and instead of calling this wishlist we'll call validate order history correct so we have this method so we'll call this method and return type we have to change to [Music] oh sorry we here we did not one second [Music] we could not return earlier so here i'll give return type yeah so this order history also returns the boolean value if it is available now come back to this home page test so this is done so yeah so both that method is ready test cases now we can run this so let me try this home page test as well so we have couple of test cases here as well run as test ng test entering username and password click on sign in so it is verified we navigated to home page and verified those order history and this list so this is the second test case yeah this is for the order history yeah so both the test cases got passed so this is how you can write the test cases so three test cases we have written so far and you can put the assertion like this and in the test case you can give the priorities and other stuff as well as we have seen in the test ng tutorials so if you are new to test ng guys you can refer to my youtube channel where you can see all the test engine related tutorials and if you go to playlist we have test ng related as well this is test engine framework tutorial so you can go through this so so far we have covered five test cases and what is the next account creation page test so let's write this one as well this one today and then we'll close the session for today and then we'll write four test cases in the next video so let's write this account creation page test account creation page test will write we will create another class account page account creation page test like this so how to navigate to this account page creation so this is the navigation so let me click on sign in so when we click on sign in from index page here we got this create an account page so this is login page correct from login page we can we have to enter this email address and click on this create an account and there we'll get create account creation account create page so what we'll do simply will call first we need to write couple of methods setup method and teardown so we'll write as it is as we have written from for previous test class extends base class this is done now here what i'll do i'll write public void uh from index page right we have to go to what is the test here we have to write create account page test so let's simply or simply will give verify account create account create account page test like this we can give now again we need object of index speech guys because we are navigating from index page so simply will create the object of index page and at top we have to define the declare the index page object like this so that it can be accessible for all the methods whatever we are going to use in this particular class now using this index page we'll call click on sign in so this is the first thing and this we have to add through declaration and this will return this will return the login page correct so login page login page object it will return so from the previous test simply let me copy these three object and i'll put it over here like this and automatically the import statement is added now so when we click on sign in it will return the login page and from login page what we'll do this login page will call login method correct and from previous class itself i'll call i'll copy this entire line and i'll put it over here and this will return this login method will return homepage object and from home page once second no no we no need to call this login method sorry guys uh we have login page there we have we need to call uh we have to enter this email address so what is the method we have this create new account method is there and here we'll pass as parameter email email like this sorry no need to pass from here directly we have to give over here so let me give some random email like this so now this method will return this create new account will return account creation page object correct so account creation page object we have to this will return the account creation account creation page object okay and at top we have to write account creation [Music] page object what is the object that is the object we have given and this is not required this homepage is not required account creation page object we need so that's why we have written like this and this will create the object this method will give the object of account creation page and simply will call one method validate account creation page correct and this will give you this method if you click on this method we have here we have this validate account creation create page on this account creation page correct so this will give you the boolean result so when we enter this email address let's say anything gmail.com and click create an account so this account creation page will appear now we are validating this form title okay so whether it is displayed or not so here we have given we have created this method on account creation page so simply this will give you the boolean result that's a result and here we'll put assertion assert dot i said true and will give result like this correct so this is uh about account creation page test which we have written over here let me try to run this whether it is running fine or not so right click run as actually we have to give at the red test over here annotation we have to give now we need to just execute this account creation page test so it is running successfully till now it launches the browser navigate to this automation practice.com and it will click on this sign in button sign in button now it will enter the email address here you can see click on create account it is not clicking on yeah so so we i think we forgot to click on validate account create page this create new account here we forgot to click on the button okay correct create new account button we forgot to click so here we have to write action dot click driver and what is the locator name this is the locator name correct because on let me go back to the previous page i'll explain what is the problem so in this sign-in page if you click on the sign-in page okay and here when we enter the email and then i forgot to click on this create an account and this is related with this login page so in this login page we forgot to add this line of the code okay click operation so until analysis if you don't click over here you will not navigate to account creation page so that's what we forgot already i have created this web element at top here but i forgot to click on that so that's why we could not navigate to that page now let me rerun this i think it should be fine now run as test engine test browser is launched navigate to automationpractice.com it will click on the sign in button and then it will enter the email address and click on that create an account and here you can see it is successfully passed so we have one test case that is successfully passed so this is how you can create the test classes guys different case test classes and this is the beauty of page object model we have to just create we need to just create the object of one page and since all the pages are interlinked with each other as we have seen in this diagram correct when we yeah so all the pages when we land to the landing the corresponding page the landing page so that will return the object of that page so that's why it is it is called as page training model as well so all the pages are interlinked with interlinked with each other each other so the design would be very easy to understand so here you can see we have created the object of just this index page and when we call the click sign in method it will it returns the object of login page and when inside login page when we call this create new account method then it returns the account creation page object correct and on that page we have to just call this method and later on we put the assertion to verify the result so this is how we we have done so far so yeah so we have created uh six test cases today two from index page test one from login test login page test two from home page and one is from account creation page test and later four test cases are remaining so these are some big test cases these end-to-end tests guys so we'll cover these scenarios in the next video okay so far we have uh we have created four sessions on this so yeah so next video will cover the remaining test cases and later on we'll move towards the the other parts like uh the data driven testing will parameterize our test and then we'll add some reporting reporting features as well log4j also we are going to add listeners and some other stuff and then continuous integration will be started so thank you guys for watching have a nice day bye bye and if you're new to my channel then please subscribe it for upcoming videos thank you so much bye hello friends welcome back to automationtestinginsider.com so this is the fifth part of selenium framework development series and we are constructing data driven framework with page object mode design pattern so let me show you what what are the things we have done so far so this is the this is what we have seen so far session wise so right now we are at this level we are creating the test class and writing the test cases whatever test cases i have picked and we have done till here and we are at this step so let me show you this in this excel sheet where we have uh written all the test cases so so far we have covered uh six test cases three two from index page test one is from login test couple of test cases from home page test and this account creation create account page test so six test cases we have already done and we'll write uh we'll write the script for four remaining test cases okay so product availability and add to cart price test and end to end test so let's get started uh so eclipse is already open so this is the project which we have created for this framework and now i'll start writing the test classes so what is the next test we have this search result page test okay so we'll create a test class for this this page search result page so corresponding will write will create a class called search result page and i'll use generate so that you can add some comments over here now what i'll do i'll open any other existing test class login page test so these two are common guys for all the test classes before method and after method so simply i'll copy and put it over here copy and paste and since all our test classes extends base class so simply i'll write extends base class over here so that we can access all the properties from base class so this is done and what is the next we have to verify this product availability test so let me open the application automation practice so when we search any product let's say i am searching this t-shirt and click on this search product by the search button and here you will see the product will be displayed over here so we have to verify whether uh it will show some results or over here or not okay like this product so we can when we select any i mean search any particular product so that should be displayed over here so that is what we need to test for as part of this test case so simply i'll create one class public void [Music] product product product availability availability test and here what we need to do we have to navigate from index page as we have seen correct this is the index page from there we have to search the product so simply what we need to do we have to create the object of index page correct so let me take one reference file variable of index page and we have to create the object of index page okay so how to create the object inside this method will create the object new using new keyword and index page so this is how we can create the object and using this method we'll call the corresponding methods which we have created inside this index page class so first of all we have to search the product correct and what is the product let's say t-shirt for now and right now guys i'm hard coding the values later on when we apply data driven testing then we'll pass the data from excel sheet okay so right now i'm just putting the data over here so this t-shirt and so when you search the product so let me click on this search result uh so this search result page will be displayed correct so what we'll do will create the object of search result page over here search result page result page like this and this is the reference variable so yeah this method will return the object off here you can see search result page okay so if you go here you can see this is the object of search result page so this is the return type of this method so simply what we'll do will assign okay so this will return search result page object so from here we can call the corresponding method so is product available this is what the method we have created inside a search result page okay so these are so this will identify whether product is available or not so this will give you the boolean result this will return boolean results so simply what i'll do i'll store in a boolean variable let's say result and equals to and simply and then we can put a set statement a set true and will give like this result and we have to give a direct test annotation for this method and import the test annotation from testng now i think our class is ready this search result page test we can run this so let me run this run as test ng test so hopefully it will run successfully let's have a look browser is launched now it will navigate to the url automation practice.com now it will search the product and then product is displayed so here you can see it verified correctly the product so our test case is passed product availability test spelling mistake is there i think it is fine availability test so this is fine so this is about the seventh test case now we need to test add to cart so whenever we search the product and from this page uh search result page we have when we click on this so either you can add to cart from here or you can simply open this product so this will navigate you uh you to this add to cart page from here also you can add the cart because because from here we can select the size quantity and size and everything color and then you have to click on this add to cart so it will be added in add to cart page so let's write scenarios for this add to cart page test so simply we have to create one more test class add to cart page test generate commands and simply uh we need few things from previous like before method and after method so simply will put over here and we'll have we need to have objects of index page in search result page as well so simply will put them as well and this class will also extends base class correct now i will write one method public void add to cart test and like this and we'll create the object of index page class so simply we can create the object like this index page like this and we have to call few methods from index page so what are those method first of all we need to click on search product and here we'll search any particular product t-shirt and then this will give you the object of search result page like we did last time we have to add throws declaration and using this object what we'll do we need to click on product right so we'll click on product and after clicking on product what will happen it will navigate you to this add to cart page so simply will add to cart page like this so yeah so we'll create the reference variable of add to cart page okay so this will return this click on product will return the object of add to cart page so here you can see this is the object of add to cart page so this is the beauty of page object model guys so all the pages are linked with each other so simply we need to just create one object of the first page and later on since all the pages are interleaved with each other so whatever landing page we are going uh we are landing on will return the object okay so in this case there is a this add to card so in this case when we click on this product so it will give me the add to cart page object and using this object we can click on add to cart button here we have add to cart button but before that we can select we have to select the quantity and size by default it will show you one n s small size so we can select uh enter quantity as well enter quantity so i'll give quantity like let's say two quantities we want and select size so let's say i want m size and after that we will click on the add to cart and what will happen when we click on this add to cart one window will appear success message it will display so we need to verify this success message so for that already we have written method inside our add to cart page so simply will call that method validate add to cart so this is the method guys so let me click over here and this is the method of that add to card message okay now we are done and this will give you the boolean result so we'll store in boolean variable result like this and later on we'll add the asset statement i said true so without assertion your test is nothing guys so we have to because any any anyways we have to verify the result right i mean uh your test we have to validate your test so for that we need to add the asset statement so simply will provide this result and if it uh if it is true then it will pass the test case otherwise it will fail so this method is ready our add to cart test so yeah i think this class is also ready everything is fine i can run this so let me try to run this whether it is running or not successfully so browser is launched and it will navigate to automation practice.com and it will search the product t-shirt and click on search button and again it will click on the product enter the quantity add to cart but we got one failure what is the failure expected true but found false so if you see when we click on this one add to cart it will take some time so i think some timing issue is there so when we need to synchronize our test so what we'll do when we click on this one add to cart so we have to wait to i mean this match we need to wait for this message to be appeared on screen correct this match message like product successfully added to your shopping cart so what we'll do we'll put some weight to cart yeah before displaying this message we'll put fluent way some weight mechanism okay so so we have different weight mechanism inside our action driver class so we have explicit weight we have a fluent meat okay so we can let me use fluent weight for now and element what is the element so this is the element add to cart message and timeout i'll provide 10 seconds so i think this will fix the issue the synchronization issue which we got so let me try to rerun it again right click run as test ng test so browser is launched it will navigate to automationpractice.com and index page will appear first and it will search the product t-shirt product will be displayed and it will click on the product enter the quantity size now here you can see so this is successfully passed add to cart test so this is how you can put weights in your script and it's always good practice if you add weights in page classes okay not in your script the actual script in this test class instead of putting over here you should put in page class okay so so this is also done so we have we are done with two test cases today now let's verify this price test so we are selecting some product over here so we have to verify in the next page add to cart and we when we click on this proceed to check checkout it will navigate you to order page okay so from this page we have to verify the price let's say we have this quantity uh this is the unit price for one product or unit price okay so this will show you the one one product price and this is the total price because here we have quantity seven and it will add this total shipping charge as well that is two dollars so we have to verify the total price and based on our calculation so if you remember already we have created method related to unit price and total price in our order page page class okay so let's write test for this price test so order page test i'll create one more test class order page test click on finish and simply what we'll do from previous previous add to cart page we need a few things simply i'll copy paste because anyways we need these [Music] variables as well the objects okay and it will extends it will extend the base class as well order page test now what we'll do will write public void verify product price or i would say verify total price total price okay so verify total price now what we need we need to create the object of this index page so simply create the object of index page first of all and then let's copy paste the entire code from the previous class this add to cart test because we till here we need to navigate so simply i'll copy from here and yeah i'll i can put it over here till here and this will add through declaration yeah so we'll enter the quantity select size and we need to click on add to cart click let me go back and we have to click on this add to cart and after that this window will appear this message will appear and we have to click on this proceed to checkout so that will be inside add to cart page only so click on checkout correct and as soon as when we click on this proceed to checkout it will display this order page okay so we need this will return the object of object of order page class so here we'll write order page we'll create a reference variable and this will create the object of order page like this we can write and after that we need to call methods we have two couple of methods we have created unit price and what is the second one dot get total price correct so we have two methods to get the unit price and total price on this order page this unit price and total price and let me show you that method so this is the method guys this is the unit price related and this is for total price now what i'll do where we have this fluent weight here i'll remove this yeah and order page what i'll do and this will return the double value so let's say this is you need price and this would return double as well and this would be total price total price right and what else we need to do we need to perform some operations on this operations or calculation on this unit price to get the value as total price so what is the calculation we have to multiply by the quantity and then add the shipping charge so let's uh like a total expected price we'll do one calculation expected price so how we'll do that unit price in two into size right so right now i'm hard coding this one so we can keep bracket like this and we'll add two dollars over here so like this we can do correct the calculation you need price into two and then we'll add to two dollars again so this is how you can do the calculation so later on we'll uh uh make it dynamic later on uh probably from the next video when we talk about the data driven testing right now i'm hard coding because i have taken quantity 2 over here so that's why i have given her coded value 2. now we can put simply assert asset dot asset equals and we have to give this expected value and this would be my total value so this is how we have to give we can give and it will verify so hopefully everything is fine it made through the exception guys uh so when we click on this checkout button let me go back so when we click on this add to cart so after this add to cart we already put the wait to see this message and when we click on this proceed to checkout proceed to checkout and this click on checkout after that we need to put the weight because this will again take time to get the order page correct so what we'll do click on check out and yeah after this we'll put one weight fluent wait let's see whether it will work or not yeah proceed to check out and time out let's say 10 seconds one second if we click on this add to cart this message will appear and after that we have to click on this proceed to check out i think we should put this before no no this is fine so let's see whether it will work or not and then we'll see what if you get any problem so i think it should work so let me run this this class is ready so let's just run it run as test ng test so browser is launched it will navigate to automation practice.com it will search that t-shirt and enter the quantity size here you can see your shopping cart is empty some problem is there i think it's still running it will throw an exception i guess definitely because shopping cart is empty let's not wait what we'll do what is the problem we'll click on checkout first we'll click on add to cart and we'll click on this checkout yeah here you can see this click on add to cart and for this message we already applied this at the beat we click on this one we should wait some time i mean we should give some time over here and then we'll get this page what we'll do will put the weight in let's give before this method but i think this will not work because the flame fit will no no this will not work we have to wait uh order page test this get unit price so to get the unit price we'll wait over here let's write weight over here action dot fluent weight and this is the unit price and i'll put 10 seconds of weight here now let me try again so hopefully this time it should work to get the price we have to wait for some time then it will go to that order page so i think this should work this time let's see it will click on the project product and enter the quantity i took card no it is not working so i think this will not work let's remove this not this one this unit price will not work something we are missing over here so click on product enter quantity size till now here it's fine click on add to cart page is also fine and later on we have to click on the checkout that will give this order page object click on checkout let's put a wait before clicking on this pro proceed to checkout but that will not work i guess let's try that scenario as well fluent weight so let me try so it will click on product and enter the quantity add to cart now it will click on proceed to checkout now this will work yeah yeah this is fine guys this is working now here you can see one test case one passed zero failed so we have to pay put the weight over here this fluent weight before clicking on the javascript uh that button we have that proceed to check out okay so here we can apply this fluent weight so it will wait to appear that i mean when we click on that okay so what is the next get unit price here there is no so let me try to run this this class is ready guys order page test so let me try this so it will click on the product and enter the quantity size and then add to cart and here you can see your shopping cart is empty so something is wrong we have to apply the weight so what i'll do one failure so here you can see cannot find element using this x path so the i think the problem is we have to put the weight properly after this and when we click on this add to cart now try to cut this click on checkout so let's put weight over here and then we'll see whether it will work or not so we'll put fluent and what is this proceed to check out and time out 10 seconds okay so hopefully this will work this time so let's have a look so browser is launched it will navigate to automation practice.com and then it will search the product t-shirt and click on the search button and it will click on the product enter the quantity size add to cart click on proceed to checkout here you can see now it is fine i guess so i think everything is fine we got this verified total price successfully executed so this this is how you can put the weeds on your taste on your page class whatever we have done the user actions so till now we have done this price test as well so far we have covered all these uh tests now what is the next scenario is end to end test so let's write end to end test and one guys uh one one thing we have to remember guys uh uh no need of uh the let's say we i mean uh the test case name should not be uh i mean it's not necessary that it should match with the uh test class name okay so we can keep any name so we'll write one test which does not belongs to any of the test class so we'll write one end-to-end test where we'll search the product and will add that into cart and will proceed for the payment so that is what we need to check [Music] for the last test so let's create one end-to-end scenario so i'll write one class over here and two and test so end-to-end test generate commands like this we can write and simply will copy few things from previous test so we need all these objects so simply i'll copy till here before method and after method also be required so we'll put it over here and this end to end text test also extends base class so so far we are done and write public public void and to and test and to end test like this you can write the method name now we need the first page we have to create the object of index page so we'll write the index page we'll create the object of index page and now from the previous class we'll copy few things because anyways we are following the same procedure so from here we can copy till click on checkout till here we can copy for this end to end test this will add uh through declaration so we reach till here this order page okay and from here we have to call click on checkout method again okay so here we have click on checkout method proceed to checkout so we'll click on that so when we click on that so address page will appear so already i have signed in guys so if you click on that address one second let me show you again so this is order page when we click on proceed to checkout it should navigate to sign in page so since i have already logged in so it skip this part so what will write because we are signing for the first time when we run our script so this will return the object of login page so we'll have reference of login page as well over here login page and we'll write login page like this will use this reference variable and using login page so this click on checkout let me show you here you can see it returns login page object so using this login page will uh call one method we have if you remember we have created two login methods login one and login login and login one so this login will return home page object here you can see and this login one will return address page so here we can provide username and password so let me hard code for now or we can take it from configuration file which we have done correct so i think we have done the same test in login test like this so i'll copy this because we have to get it from properties file so prop dot get property username like this we can give simply we can give the parameters over here like this and this will return the object of address page okay so here we'll put address page like this you can give and we'll use this reference variable and i'll put it over here and from address page we'll navigate to the next page what is the next page from address page so let me click on this proceed to checkout and from address page we have again proceed to checkout so we'll click on this proceed to checkout click on checkout and this checkout will give you the next page object so this is shipping page so we'll return the object of shipping page over here so simply i'll write shipping page and we can write like this shipping page and i'll use this variable name reference variable and i'll put like this okay so this click on checkout button will i mean method will give you this shipping page object so put it over here now we have couple of methods on this shipping page we need to click on this terms and condition and click on proceed to checkout for terms check the terms sorry we have one method called check the terms and the second method is click on proceed to checkout button okay uh method we have related to this one proceed to checkout so when we check this checkbox and click on this proceed to checkout we should navigate to this payment page so we'll return the object of payment page so simply i'll write payment page and payment page like this the reference variable i'll select this reference variable and put it over here so this method will return the object of payment page and using this payment page object what is the next page we have couple of this methods payment method so simply will click on that payment method click on payment method is there so if you see that will give you the object of order summary so we'll write the reference variable of order summary over here order summary and here it will write like this order summary we'll use this reference variable yeah so this action will give us order summary object and using this object we'll call what is this click on confirmation button so let me show you if you click on this one we'll get this confirmation page okay and we need to just confirm the order so let me show you what it returns so order confirmation page it will return okay so yeah we'll create a reference variable of that order confirmation page order like this we can give and simply will change this to small so and we have to import this order confirmation yeah so we have to use this order confirmation page object simply put it over here okay so this will give you the order confirmation page object and a last we need to call validate confirmation message on the last page so if you click this i confirm my order so just click on that so you will get the the last message like your order on my store is complete so [Music] we need this message to verify and this validate confirmation message will give you a string variable i mean it will return a string so that we can verify and i'll store in like actual message i'll try it like this and string expected message i can write like this and i'll put my expected message so this is my expected message guys uh this is coming on the last page once where our order is done so your order on my store is complete so this is how we can give and then we'll simply will put a set statement asset equals so dot assert equals and what is the actual message so this is the actual message and this is the expected message we have to give so i think this is the entire uh script end-to-end test so let's see whether it will work or not uh if you see uh we need to check whether we need to put the weight for uh any particular action so let's try i'll put uh at the rate test annotation over here now this class is ready end-to-end test so let me try this right click run as test engine test so let's see whether it will work or not so browser is launched now it will navigate to automation practice.com and it will search the product t-shirt now it will select quantity add to cart it will click on proceed to checkout now this order summary page it will clicked on proceed to checkout here also it will click on enter the username and password on login page click on sign in this is the next page address page click on proceed to checkout check the terms of service and click on proceed to checkout so this is the last page confirm my order so it will click on this confirm my order this is the last way so yeah this is congratulations guys this is the entire uh end to end test so here you can see end to end test is passed so this is fine everything is working fine now we we have done some hard-coded values we have provided like size and this quantity so in the next video we'll do the data driven testing where we'll provide the data from excel sheet test data from excel sheet and we'll use a data provider as well so so far we have covered all the test cases there are 10 test cases and i'll show you also like how to run the all the test cases together using testng.xml and later on we'll proceed the logs and extend report and then some other reporting features and then later on we'll put our project into github and we'll do the do the continuous integration part using jenkins and all so so far we have covered all the test cases and let me show you the next thing yeah so in the next video we'll talk about the data driven testing data provider lock 4g and if possible we'll see the extent report in the next video only or otherwise after that we'll see that okay so this is all for today guys so thank you for watching have a nice day and if you're new to my channel then please subscribe it for upcoming videos and click on the bell icon to get the notification for those videos thank you so much bye nice day bye bye hello friends welcome back to automation testing insider so today i'm going to talk about selenium framework development part 6. as you all know that we are creating data driven framework with page object model design pattern and you can call it as hybrid framework as well now let me show you the agenda like what are the topics we have covered so far and what are the topics to be discussed in coming days so these are the different topics guys we have already covered session wise uh here i have listed down and we are at this point we have created different test classes and we have written the scripts as well so we are done till here now today i will talk about the log forge implementation in our framework i'll talk about the data driven testing like how we can supply the data from excel sheet so if you remember we have we have been using the hard-coded values till now now i'll show you how we can parameterize our test and uh i'll we'll talk about how we can run our test cases using testng.xml suite file and i'll show you how we can group our test cases in different groups like smoke sanity and regression so this this is what we are going to implement and cross browser testing will implement the cross browser testing in our framework like we can execute our test cases into different browsers uh firefox i and chrome and at the same time i'll i'll talk about parallel execution as well so these are the different things which we are going to implement today and uh in next session we'll talk about the extent report listeners and screenshots and source code management where i'll push the project to github so you can clone the project from github repository so this is what we are going to see in next session and at the last last session we'll talk about the continuous integration like i'll show you how we can run our project with the help of jobs jenkins jobs how we can configure our project in jenkins and i'll show you how we can send the email through jenkins how we can send with attachment and everything and i'll show you some tips and conclusion of our framework at the end so this is what we are going to discuss uh going to be discussed in coming days so but today we'll focus on this these things so let me start uh so i'll open this folder where i have some artifacts like this framework architecture so this is what we have discussed in the first session and here here i have created different test cases now here you can see guys i have created uh i have divided them into different groups so here you can see smoke sanity different groups right regression so you can see here for smoke testing we have six test cases sanity three and regression three test cases are there so we'll implement uh how we can divide our test cases into different groups in today's session as i have talked about earlier here i have listed on the topic grouping of test cases and yeah so actually i should have done all these stuff earlier after writing couple of test cases but since we have only 10 test cases so that's why i prefer to write all the test cases first all the page classes and test cases first page pitch classes and test cases so this is what i have done now we'll implement all other all other components like log4j data driven testing and all these stuff today and guys i have done little bit change in the code in the script in my framework because of this parallel execution so let me show you like what what are the changes i have done so if you see this is the project my project my store project and let me show you that a base class so if you remember we have declared our web driver like this public static webdriver driver but since i am going to explain this parallel execution as well so that's the reason i have declared a thread local driver as well i mean thread local driver i have created the object of thread local driver thread local class so this is the my driver this is my driver but we need to get the driver so that's the reason i have created one custom method this gate driver method so this gate method will return the driver i mean get the driver and will return that web driver okay so whenever we use a driver instead of driver we are going to use get driver this method okay so this is what a little bit change i have done in the framework for parallel execution so let me show you like what are the changes and to initialize the browser to uh instantiates the browser what i have done here is instead of writing simply driver is equal to this is what we have written earlier right to create the object of chrome driver suppose i want to launch the browser for chrome driver so instead of writing like this i have what i have done is driver dot set is using set method we have set the room driver object okay so this is what we have done and similarly for firefox and similarly for internet explorer as well so this is uh another change and instead of using driver in other classes let's say each classes let me show you one of the page here you can see instead of using driver over here because these init elements will pass couple of parameters like driver and this this keyword so instead of passing the driver i'm passing gate driver as i have explained earlier like we have created one custom method gate driver so that will return the object so that's why instead of writing driver only i am writing get driver here you can see also in is displayed method i am passing this gate driver because ultimately this will return the driver so these are the things which so i have done the changes for all the pages guys because earlier we have written the script using driver only so instead of driver i'm using get driver so this uh these are the changes i have done offline so just i wanted to inform that uh the changes now let's talk about uh how we can implement the lock for j in our framework so for that already i have written the steps so i'll uh i'll keep all these artifacts in the framework in the next video as i have explained like in the next video i'm going to push the changes in github so before before that i'll i'll make sure that i'll uh keep all the artifacts like project architecture the steps for log4j and this test data i'll keep in the project path okay in the project directory so let me show you these steps i think so clearly i have written some steps for log4j like how we can implement this so first thing is add log4j xml in project directory so already i have that log4jxml let me show you that one in previous project so here here we have a log for xml so simply i'll copy this and i'll put this in my project directory so just select the project and click on paste so here you can see this log4j is coming over here so this is very simple uh if you don't know about the lock4j uh i have already created video on this log4j like how we can write the logs in your script okay how we can get the logs in on console and log4j file how we will get so for that if you go to my channel so here we have one playlist guys if you go to this playlist you will find this screenshots log reports properties related playlist so you can visit here you can just go through it and you can learn about the lock for j and guys if you are new to my channel then please subscribe this channel and click on bell icon to get the notification for upcoming videos and about this blog whatever i'm writing to get the updates this is the blog automation testing insider.com so what you can do is you can follow me from here we have this follow button so when you follow this you'll get all the updates yeah so this is log for the xml i put in my project directory so what it does is this will this is just to write the logs on console and this is to write the logs on file so here we have file lock for the dot log now what i'll do i'll create one folder in the project directory i'll give name like log logs and click on finish so here we have logs folder and here i'll give the path like logs slash forward slash and logic dot log so when we run our script it will create a file log for the dot log so it will write the logs in this file as well as on the console so this is about the log4j.xml what is the let me save this and close this what is the next step we have to take add log class in utility package so we have in the previous project itself we have that log 4j we have this log class so simply i'll copy this and i'll put in my utility package which i have created in the first video if you remember com dot my store dot uh utility so simply i'll put it over here and if you open this log so this class is very simple we have created the uh we have used this logger class to initialize to initialize the log forger logs uh to initialize clock virtual logs of this log class okay so simply what we have done is uh we have used this gate logger method and this is this this will return this log class okay and here we have created some custom methods start test case where we have written this log dot info it will write the logs similarly we have n test case we have info for information for warning error fatal and debug so these are the different custom methods we have created and we'll call it from our test case now let me show you the next step what i have done what we need to do configure before suite at base class to configure log4jml so we need to configure we need to make the connection between like how we'll read this log4.xml so that's why what i'll do before we list we start the suite what i'll do let me go to this base class and here i'll create one before sweet method and i'll give annotation before sweet and simply i'll copy paste this line of code so what it does is let me just mouse over on this dom configurator class use this class to initialize the log4j environment using dom tree so it will initialize this log4j.xml okay so this will initialize the log4.xml so we have written this before sweet so after sweet is not required as of now so i'll keep only before sweet now what i'll do what is the next step and simply we need to just call the methods in test case from log class so in log class we have all static methods so simply we can call the methods using this class name using this class name right so we'll call all these methods from our test script so let me implement these logs uh whatever logs we have for one of the test case one of the tasks let me open this so these are the different test cases i have so let me implement for login page for login test will implement this so simply will use this log class log dot start test case we have right and simply will provide the test case name over here like this so this is what you can do and uh yeah here you can write log dot we have info method so you can provide some information over here like user is going to click on click on sign in sign in like this you can now here you can what you can write is log dot info after clicking on that sign in user will try uh enter username and password simply you can write enter username and a password like this you can write enter username and password and yeah before this log dot info so these are the different logs you can write while uh writing the test cases okay so this we i should have done this earlier but since we have uh i have explained earlier like we have only 10 test cases so that's why i written all the tests test cases first and then i'm implementing this logs but ideally we should have done this log implementation earlier so that while writing the test cases you can simply call all these methods and you can write your logs so right now i'm writing verifying the fine weather uh waffling if user is able to login and here we can what you can write if this is success then login is success we can write like this login is success and simply we can call one and method and test case so here we'll provide this login test now everything is done guys uh let me just run this test class so i'm writing i'm just i mean we have different test cases but i'm running this only this login page test okay so let me run this whether it will log the information or not we'll look into it browser is launched navigated to automation practice.com and it will click on that sign in button click down sign in it will enter the email and password and click on sign in user is successfully logged in now here you can see guys uh one test case one pass here you can see this login test is passed now if you see the console we have this beautiful uh logs over here like here you can see login test start user is going to click on sign in enter username and password and these are the some logs from action class which we have implemented so based on the user actions okay and verifying if user is able to login or not login is success finally and this is login test and method okay so whenever you get any failure or anything so you can easily track using these logs so this is the purpose of capturing logs in your test so this is about locks guys and i'll implement if possible i'll implement all the logs for other uh test cases as well so for demo purpose i think this should be fine for one test case now let's talk about another topic what is that data driven testing how to implement the data driven testing so for that already i have written the steps as well for yeah this is for data driven testing actually here i should write data driven driven testing and data provider so first of all what we need to do is add excel library in utility package okay so this is what we are going to do so simply what we are going to do here is from the previous project itself we have this excel library so just copy this and put it in the utility for the right utility package so this is utility package so i'll put it over here so this is new excel library and guys uh regarding the excel sheet also i have created a separate videos on data driven framework so please refer that if you if you have doubts over here excel and data even framework in this playlist so clearly i have explained everything over there now let me go back to the steps so add excel library in utility package we have which we have already done create a folder and add testdata.xlsx in that so already if you remember in the first video already we have created one folder let me refresh and here we have src test resources so here we have created one folder called test data now what i'll do i'll keep my excel sheet over here so let's use this excel sheet only this stage data and i'll put it over there simply copy and put it over here let me close this otherwise we'll get confused because this is in different path so here i have put the excel sheet as well what is the next step we have to take create a package for data provider and add data provider class there and create the object of excel library class create a package for data provider okay so now we need to create a package for data provider so already we have created the package in the first class first session so com. my store data provider package over here in inside src in java so simply what i'll do i'll create one data provider class over here so give you can give like data provider one data providers like this because data provider is itself a class so you can give like data providers so i have given name like data providers and what we need to do after creating this class if you go these steps add data provider class there so already we have added and create the object of excel library class so how to make the connection with excel library how it will read uh how it will take the data from this excel file excel library right so so in this excel library if you go over the previous session i have explained or already this new extra library so here we have couple of constructors so this is default constructor and here we have uh parameterized okay so i think we need to we have to [Music] uncomment this and here we have path we have given over here so in case if you are using the by default uh x constructor this if you create the object like this normally without any parameterization without any parameter then simply we have to provide the path over here so i'll provide the path excel path over here so simply right click on your excel file and you will get the path till here you have to get the path over here because all other will be like i mean this is the project my project and from src test java you have to capture the path and this will get the your project directory and simply will put it over here like this i think it is done this should be fine do control s and what we need to do is in the data provider we have to create the object of this new excel library so let's create the object i'll give name like obj and new like this yeah and we have to import new excel library this is done now we need method guys data provider method so i have simple method over here this is the method i have so let me copy this and put it over here and we have to add this data provider annotation from orgy.string.annotations so simply add that data provider it is being added now what will do yeah so it is added and here we we need to give the data provider name so let's say we are going to implement for this uh login page test login test okay so here you can see we have hard-coded the values right uh username we are getting it from we have not had credit for this particular uh test we are getting it from uh configuration file but right now i want to get it from excel file so how we'll get that so here what i'll give i'll name let's say i'll give name like credentials i'll give name like credentials and which data i'm going to read which excel sheet okay what is the worksheet so we have to provide the worksheet over here and another thing is because excel sheet path already we have given over here correct and simply we have to give the worksheet name over here and about this class uh this particular data provider method already i have explained in the previous video guys so please go and watch the previous videos excel and data driven framework if you have missed that okay and do not worry guys i'll provide all the links related to different previous videos in the description box of this video so let me go over the excel sheet not here this excel sheet so right click properties and we'll go to that path and i'll open the excel excel sheet from here so this first worksheet is for test cases so second i'll for a second the worksheet i'll write credentials credentials like this and simply i'll copy this worksheet name and we'll put it over here like this it will get the total row count get row count and this will get the column count this method will get the column count and we need to get the cell data so we have to give in this get cell data method we have to give the name of the worksheet name of excel sheet okay so and let's provide uh the username and password username and password like this you can write and let me give what is the username we have we can get it from earlier we have given in this configuration file right so simply i'll give this username and password is administrate one two three so we have provided a username and password in this credentials worksheet now what i'll do let me close this and here we have given the credentials uh data provider name here now we need to go back to our test case this login page test and here we have to write the data provider name we have to provide the data provider name over here so this is the attribute data provider and in double quotes you provide the data provider name in this sorry what is the data provider this is the data pointer name credentials which we have to supply over here and this should have the same name as we have given in the data providers class okay in this gate email data so instead of get email data get credentials credentials like this simply i have changed this method name and whatever data provider name i have given over here credentials that should have that should be there in this test class as well data pointer and this and how it will connect with that data provider class right so for that no need of comma i guess so we need we need comma yeah data provider class now we need to read that class right so this is what another attribute we have data provider class and data provider dot class okay so this will give you the one second once okay and here we have to provide the data providers class like this like this the class name the class name what is the class name we have data providers so that we have to give over here now what we'll do it will read two values right username and password so simply i'll provide a string username and string password and let me comment this this line and i'll copy the entire line so earlier we are getting the data from configuration file now we'll get it from from excel sheet okay so how to supply the data in this login method we need uh this unnamed and what is the password this password okay so this is how we'll get the data whatever we'll get from data providers and that will get uh take by this login test okay and we'll supply to this login method so i think all done let me try to run this i think it should work so let me run it browser is launched navigated to automation practice sign in now it will sign in with username you here you can see and click on sign in it will close the browser now here you can see why this is second time uh we have given a second rows as well so that's why it is reading the second rows but there is blank there are blank values in that second row so simply it won't give anything here you can see yeah so that's why we have uh it runs two times so this is how you can parameterize so let me show you yeah here you can see in the first iterate we have given admin xyz.com and admin one two three which is correct username and second time you here you can see blank blank okay so let me do one thing i'll provide some random value over here at the rate dot com and i'll give the password like anything so this is how you can if you want you can try multiple times as well so let me close this and rerun it again so one is for valid test and another one is for invalid uh credentials so we have two test cases so this is how we parameterize our test browser is launched now it will navigate to it will click on this sign in button it will enter username and password the first set of username and password correct username and password click on sign in and yeah second time also it will run this time invalid credentials here you can see so we got error as well authentication failed so this is how you can parameterize your test guys data provider you can you can parameterize you can provide uh i mean you can apply data driven testing in your framework so for the rest of the classes test classes i'll do offline because otherwise if i apply uh it will take so much time so i'll show you in the next video after doing this so i'll create separate data provider methods for all of the other let's say let me show you like this account page creation is there so this will take one uh one parameter one email one data right so i'll create what i'll do i'll create let me open this excel sheet so i'll create separate uh worksheet i'll provide like email or something and then the rest of the procedure will be the same i'll create one more data provider method over here and i'll give some name like get email or something and then we'll get the email from that excel sheet okay so this this is what i am going to do offline for all the test classes whatever we have provided a hard coded values okay so now let's go back to the uh the steps naughty steps the excel power point now run all the test cases using testng.xml so how you can run most white is giving let me if you get such errors then what you can do is marvin and update project we have we got one error red color i think it should be gone by updating the marvin project yeah here you can see now error is gone now let's talk about the next thing which is uh run all the test cases through testng.xml so here we have all the test cases guys all uh all the test classes so simply right click on this uh what is giving again error you is anything missing over here okay we have to close this sorry i forgot to close the excel sheet so that's the reason i'm getting this error so again do this update maven it should be gone yeah here you can see now what is the next let's close this how to create the testng dot xml correct uh run all the test cases through test engine.xml so simply what you can do here is you will select all the test classes from here select the package right click and we have test ng convert to test ng so yeah this is how you'll get and the suite name test name so simply i'll give here i'll give testng all xml okay so click on finish so here you will see testng.all xml so we can run our test cases using uh from this testing dot xml guys so let me run it it will take two three minutes so whether let me open this so here you can see all the classes are there and the sweet name is this sweet okay the test name is test we can give test all and it will run all the test cases whatever we have inside all these classes so let me run this i'll show you using this design.testng.xml and if you don't know about the testng.xml also i have a separate playlist so you can go through the testng xml as well and later on after running these two things we'll talk about the grouping of test cases and uh cross browser testing as well so let me run this it will take some time probably i'll pause this video if it takes more time okay so let me run this run as test ng suite so it will execute all the test cases so let's have a look you hmm you you you uh yeah hello guys so [Music] everything is run uh successfully like we have to execute our test cases but there are some failures uh there is power off in the middle so that's why we got some failures as well and there are 11 test cases why because for login test we have couple of test cases so that's the reason it runs twice the login test here you can see this for admin and this is the user we have given so let me remove that otherwise we'll get confused i'll remove that user name and i'll simply i'll delete the entire row and save this so here you can see all other test cases are passed the most importantly we have this end-to-end test cases passed so anyways we'll see that failure and the reporting features in the next video in the extent report so this is how you can run executive or test case using testng.xml now the uh one more thing is how we'll do grouping of our test cases okay that is the next point which we are going to discuss grouping of test cases smoke sanity and regression so how will do but before that uh let me do one more thing if you see let me open the base class yeah here you can see so if you see we are reading the browser from uh configuration file right configuration properties from properties file so instead of reading from properties file will do one thing i'll add the parameter parameters annotation here and will read the uh browser from properties file so we'll supply the browser name in the xml okay and based on that it will execute our test this launch app so what i'll give i'll give name like a browser name over here i'll give the same name like this or let's say browser only and i need to have one parameter this parameter so this uh will take little bit of uh effort to change all over this launch app so here i'm passing this browser stream type right browser and simply i have commented this line to get the browser from property file now we have to do some changes over here if you go to this account page now here we need to pass the browser string browser and we have to pass this browser in this launch app because this will take this launch app will take one parameter right this browser name so whatever will uh pass through this xml it will uh get based on the parameter okay so we need to change uh the entire this before method in all the classes guys so simply i'll copy this simply i'll copy this and put it over here this before method i'll put it over in end to end so i need to just make the changes in every test class sorry you have to change this before method like this so let me close all the and open this base class so we have one parameter in this launch app method okay see this parameter so we'll pass the parameter from xml and based on the parameter name it will get the parameter name okay it will take like whether we'll pass chrome firefox or i it will execute accordingly now what i'll do let's create let's do the grouping so already we have written the test cases we have divided them into different groups so if you see we have divided this my store logo test smoke and smoke group we have given so index page test so let me open that index page test first here so how to give the grouping how to provide the group so simply you have this bracket in the test and we can provide a smoke group over here so okay so my store local test we have this verify logo and verify title yeah so simply will provide groups over here and i'll provide this is smoke right so we'll provide simply smoke i'll copy this group from here and i'll put it over here because these two belongs to the smoke group now i will go to login test this login test sanity and smoke go to login page test and and one more thing guys we have to let's do that later on yeah so credentials so here we have to provide groupings as well groups what is this login test so login test is sanity and smoke okay so how to provide a sanity and smoke booth so we have curly braces curly bracket and here we'll provide smoke and sanity like this you can provide so this is done uh login test is also done smoke insanity we have given here you can see and next grouping is smoke for uh homepage test so let me open the home page test as well and i'll provide the groupings over here as well so this is smoke group so this is what we have given the smoke group and here as well smoke group for this order history and this wishlist test for both we have provided smoke group next is sanity create account page test account creation page so we have account creation page and here we'll provide the what is the group name sanity so simply will write sanity over here what is the next product availability test so which page it belongs to search result page we have the search result page and here we'll provide smoke so smoke is given over here and add to cart so that will be add to cart belongs to add to cart page test so add to cart page test and here will provide will provide regression and sanity so for that we need a bracket so what is that regression and sanity so we need a regression comma sanity like this we can give and what is the next thing is price test is regression so price test belongs to which test class order page test so we have this order page test and here we'll put order page test and this is this should be regression test okay and last end to end test is regression so simply i'll copy this and i'll put [Music] where is end to end so this is my end to end test so this should be regression simply i'll close all the things and one thing we need to do here is for all these sweets whatever annotations we have we need to provide the groups guys so for all the groups like this which whatever it belongs to so we have divided three groups in our uh our test cases right so we'll provide all the groups name over here smoke sanity and what is the third one is regression correct like this we have to provide simply copy this grouping part groups and put in all the annotation parameters not required so we have put in before suite and test before test over here and now all the test classes before method after method test already we have like this we have to provide and this is the last one all done now what i'll do save selected now what i'll do i need to create the sweet again okay why this is because of this only it is showing again error now what i'll do i'll create i'll copy this xml which already we have created earlier and put it over here i'll give this time let's say smoke this is how we can give smoke xml and put it over here again just close this sorry simply cop copy this smoke as well and put it over here the second would be sanity sanity group sanity xml and the third will create one more for regression regression so like this you can create now just go back to one one by one all the xml so this is what we have created and now we have to pass the parameters right so we have this parameter and a parameter name we have to give what is the parameter name we have given in base class right so let me go at the base class what is the parameter this is the browser the same name we have to we have to give here as well and what is the value so let's say we want to execute on chrome browser and we need to add one more thing over here is we have added parameters so it will execute the case on chrome browser now for uh grouping we need one more tag so inside that we have groups inside groups we have run i guess run correct and inside run we have include method include tag okay so here we have to give the name of the group what is the group name we are going to give let's say this is for sorry this is for regression regression okay so simply we can do like this so this will execute only regression suites so let me copy from here like here and we'll do the same changes for other xmls this is sanity inside the test and here we have to give sanity like this for sanity and what is smoke the last one like this and here we have to change it to smoke so this is how you can do now let me run this smoke xml so here we have smoke sanity regression and all so let me run this smoke first and we'll see uh how many test cases it will execute because in smoke i think we have six test cases so let me run this irrespective of whether whatever classes we have but it will go whatever the group's name we have given in the test cases okay so it will execute accordingly so let me run this run as test ng suite some configuration failure is there i think some configuration failure is very smoke sorry we have to give this parameters in the in the test cases guys sorry i forgot to give that i have given uh wrongly i have given in this base class so instead of that we should have given in the test cases so where are the test cases like we have different test cases over here so i should give this parameter name over here before method and yeah and in the xml we have this browser correct yeah so here we have to give in all the before method we have to give for all the test method we have like this home page test as well login page test and order page test search result page test and before method we have to give because uh ultimately we have this setup method here right so that's why we need to give over here so now i think all done let me open this smoke xml let me run it again run as testing this fit now this time it should be fine so let's have a look now you can see the error is gone it is not throwing any exception so it will start all it will exit all the cases belongs to smoke group okay so shhh now here you can see we got uh six test cases which belongs to i should have given the name to what is this smok test so based on that it will come over here the name okay and the sweet name okay so these are the six test cases let me show you so we have six test cases belongs to smoke group so we have executed six test cases so this is how you can divide different groups uh your test cases into different groups so this is about grouping here you can see all the test cases are passed successfully and you can give the name instead of this test all here you can be the name of the test so this is smoke test let me change the name this is sanity and we have regression so i'll change this to regression now let's do uh the last topic last exercise cross browser and parallel execution now what i'll do i'll create one i'll copy this xml and i'll put it over here here is best option here we have and instead of this test ng i'll give name over here cross browser cross browser cross browser like this we can give cross browser dot xml test ng hyphen cross browser dot xml click on okay let's open that xml sorry cross browser like this we have to change the name cross browser now it's correct now instead of this regression i'll give cross browser and we can remove this grouping from here that is not required now now let's do the cross browser testing for one of the test class let's pick this index page and yeah i'll have only one class okay so this index page test so i'll copy this test and i'll give name sorry i'll give this name to let's say for chrome chrome test i'll give chrome test this test name i'll give chrome test okay and it will run on chrome browser so similarly we'll create different other suites okay guys so we have three test suites inside test tag we have three test suites here i have given the chrome and this i'll give firefox firefox and the last one i'll give i i so we have three different browsers and in inside this suite we don't have anything so we can remove this thread corner as well though that is not required so let me just remove this inside a test tag okay now here inside the suite tag we don't have any parallel attribute so this will run sequentially so let me show you how it will run sequentially on different browsers first and then we'll do the parallel testing okay so right now here we have chrome browser firefox and i three different uh test suites we have so let me run this sweet name i'll give sweet name cross browser cross browser let me run it run as test ng suite now it will run one by one something has happened why oh sorry i have uh so this can i cannot have the same name chrome test so yeah chrome test here we have we should give the different name we will give firefox test we cannot have the same test name for different differentiates okay so here we have chrome test so we should have different name over here and i test i should give i test over here let me run this right click run as test engine suite now it will run one by one in all three browsers so we have one only one uh index page test class here so i think we have couple of test cases inside that so it will execute so the first one is chrome browser so chrome test is chrome browser is launched and it will executing both the test cases there now it will run on firefox thus for the second test suite so firefox browser is launched it will run it will navigate to that browser automation practice.com website and it will execute though both the test cases one by one so this is how we can do the cross browser testing now in the next uh then i'll show you the parallel testing as well now it will start ie internet explorer so here you can see so this is internet explorer browser it is taking some time not sure whether it will work or not on ie so let's see if it will work it is taking too much time to load the page yeah so i it's not working we'll see what is the problem with i so here you can see some setup what is the setup configuration something is wrong with ie because browser is launched what is the problem then firefox is fine chrome is fine let me comment these two first and check for i again what is the problem let me open the base class as well what is the problem with c so it will read based on the parameter which we are passing the i i is fine here i driver to setup internet explorer driver so let me rerun it again on its i only yeah now this time it will navigate to automationpractice.com guys yeah so i think that some problem is there when the first time it launches the browser so i think this is fine it will execute the second test case as well yeah perfectly it is working fine so now here you can see two test cases on i i test so similarly we have seen for uh chrome and firefox as well now what i'll do i'll let me uncomment this source remove block command now we'll do this time in parallel mode what is happening here what is the problem yeah it is fine now let me add the parallel attribute and these are the different attributes will give a values it will give so we need to run test parallel okay so we want all the test cases to be run in parallel mode okay uh chrome test firefox and i test so let's see like how it will run parallely on different browser so here we have given one attribute called parallel test so let me run it so finally three browser will be launched so this is i this is a chrome and firefox is also launched so yeah this is for firefox so all three browser launched simultaneously and it will execute the test cases on these browsers so we have two test cases in that class so all test cases are running in parallel uh i mean different threads guys so separate thread is for firefox separate thread is for chrome and separate thread is for oh i so why we have why we are getting like this problem is there i guess why it is running like this threat count we have to give is equal to three test parallel is equal to test threat count is equal to three so three threads will be run for chrome browser separate thread for firefox separate thread and for this test we have separate thread so let me run it again so three browser will be launched ie firefox and chrome simultaneously and it will execute all the test cases simultaneously one by one we have couple of test cases yeah here you can see so we have total six test cases so all test cases running parallelly uh successfully run finally we have given we have to give this threat count as well i forgot to give the threat count earlier so we have to give the thread count so it will run on separate threads uh and here you can see the results so this is because of the uh this test engine version guys it is showing like 12 past but if you see this console we have six test cases only so there is problem with the latest version of uh test ng okay so here we have chrome test eye test and firefox test so this is how you can do the parallel testing as well so i think we are done for today so we have done the log 4g implementation data driven testing we have run all the test cases using testng.xml grouping of the test cases we have seen and cross browser testing as well cross browser and parallel execution as well so in the next video we'll talk about the extent report listeners and screenshots and will push the code to github as well so if you're new to my channel channel guys then please subscribe this channel and click on this bell icon to get the notification for upcoming videos and please do not forget to follow the blog as well so here we have follow button so please click on that and follow you provide your email and follow the blog as well so here we have this follow button so thank you guys for watching have a nice day bye bye hello friends welcome back to automationtestingscider.com this is selenium framework development part 7 and as you all know that we are creating data driven framework with page object model design pattern and you can call it as hybrid framework as well and we are automating an ecommerce application which is my store application now let me show you the agenda like what we are going to discuss today so these are the different topics guys we have already discussed session wise so here you can see and uh we are almost at the end of our framework development and we are this is the seventh part and today we are going to talk about extent report how we can implement extent report in our framework and at the end of the session i'll show you like how we can push our code into github so you can clone the project from github so this is what we are going to discuss today and in the next video we'll talk about the continuous integration and jenkins with jenkins tool okay and we'll run our project through jenkins so guys if you are new to my channel then please subscribe this channel by clicking on the subscribe button and click on this bell icon to get the notification for upcoming videos and this is my blog as well automationtestinginsider.com and i would request please follow me on this blog as well because i'm writing different articles over here so you can click on this follow button and you can follow me on this blog as well and in the last video this was the last video selenium framework development part 6 and if you navigate to a description box of this video you'll find all the links selenium webdriver step by step java step by step test engine tutorial so for different playlists i have all the links in the description box going forward as well so please go through all the playlist whatever i have created earlier whatever videos i have created so you can directly if you want you can directly go to that playlist from here in the description box of the videos so let's come back to this agenda so we are going to talk about extent report and last time we have discussed about log4j data driven testing and test ngxml grouping of test cases and raw browser testing and parallel execution so this is what we have discussed in the last video so this is the project guys my store project let me close all these and if you see last time we have implemented data driven testing so let me show you yeah so we have implemented data driven testing for login page test when i have created the last video and similarly i have implemented for other classes as well like i am getting the data from excel sheet so this is the excel sheet which we have not this one this is the original one and let me get it from here from project directory and let me close this one yeah so this is the excel sheet uh the first tab is test cases or whatever test cases we have we have created a test cases scripted and these are the different uh test data we have credentials i have shown you in the last video we have email product details we want to get the product from here and search product so already i have parameterized everything i have shown you last time about this login page test for an example similarly i have done data driven testing for all other classes as well and let me show you one more thing over here for this order page test verify total price i have yeah we have written data provider for this one as well we are getting the product and uh from here excel sheet we have this product details so we are getting product quantity and size from excel sheet using data provider and we are passing in this method verify total price and i have done one dynamic uh scripting over here earlier if you remember we have uh hard-coded the values now based on uh i mean the quantity it will calculate the total expected price so we have unit price and total price correct so we are calculating the total expected price with the help of unit price unit price into uh this is what we are getting quantity from parameter right and we are converting that into double and then we are multiplying by unit price and adding two dollars that is shipping charge if you remember by seeing the application there is a two extra dollars so that is for shipping charge so this is how we are getting a total expected price and we are calculating we are i mean simply we have put the assertion over here and we are comparing with the total price so this is how we can validate we can make our script dynamic so these are the different things like data providers and data driven testing we have done in the last video and few things i have done offline as well yeah and uh yeah and one more thing is we have i have already uh provided some logs as well log dot start test case and test case for login page test last time we have done all the logs in this way and if you remember we have created different test in the xml files like this is for to run all the test cases and we have different test suites as well sanity smoke regression cross browser etc now today let's see how to implement extend report this is what we are going to discuss today and one more thing guys i have already provided what it whatever data i have like this project architecture and this page navigation and this excel sheet is already there so these two things and the steps for log4j data driven testing and extend report already i have provided in the project so i here i have created one documentation uh folder where i kept this framework architecture page navigation and step step for log for the extent report and data provider so let's implement extend report so already i have written the steps so this is the steps you have to follow to implement extend report in your project in your framework so the first point is add create extent config.xml file for exchange report configuration so let me get it you either you have to create it or you have to implement it right i mean you have to add it from existing project so since already we have done this extend related things tutorials already so simply i am copying from the previous class previous project okay so if you don't know about the extent report then you can follow the previous videos guys which i have already created so simply i'll copy this extend config.xml from here from the previous project and i'll put it over here in my framework and let me show you what this extendconfig.xml so this is for reporting for extend report guys like how it looks uh look and feel for our extent report so the configuration so simply i'll change some of the things over here so i'll change the document title as my my store my stop project and yeah simply i'll copy this over here my store project report and this is for logo guys this is this report name and this path is for logo so let me download the logo so this is the application which we are automating automation practice.com and this is the logo so let me copy this we want the logo in our extend report so simply i'll uh save image as logo dot let's say or simply i'll give my store dot png format and simply what i'll do this logo we have already created one folder in the first video logo folder simply i am putting over there so this is my logo and i need to give the path of this logo simply copy this logo path and i'll put it over here so this is what you can do for logo and any other things so nothing is required to change over here so this is done and what i'll do what is the next thing i need to do let me go over the steps yeah so second is add create extend manager class in utility package so already we have this extend class so let me copy that one as well from utility class so extend manager i'll show you what it does so simply we can copy this extend manager and i'll put in utility package so this is my extend manager so what it does is to create the object of extend html report and load extend config.xml so earlier we put this extend config.xml so we need to load this right and we have to create few objects over here so this extend html reporter is uh to create the html file so here you can see if you mouse over the extend html report creates a reach standalone html file so this will create the html file and there is another class extend reports which will build the reports the extent reports report client for standing is starting reports and building reports so this is to build the report and we have one more class extend test so what it does is defines a test you can add logs snapshot assign author and everything so these are the different things you can do using this extend test so we need to create the object of all these classes so we have taken reference variable over here and we are creating the object of this extend reporter class and here we are providing the uh path of our extent report so test up output and extend report so let me go extend test of output and i'll create one extend report folder over here so right click and folder i'll create extend report like this extend report click on finish so here you can see extend report inside test output so we'll we need this extent report and it will create my report.html after running the test set once our test switch is done we'll get this my report.html and this is to load the configuration xml config configure file xml config file this extend config file so this is what we have given this is the project directory and this is our extend hyphen config.xml so it will load this extend config file and these are the different things guys to set up in the reports how to say it like hostname project name project name i'll change my store project rest let it be like this and yeah so this is one static method set extent and another method is end report to flush to close the report at the end once everything is done so this is about extend manager class so what is the next step we need to take create a folder to save the extent report under test output so which already we have done configure extend manager dot set extend in before suite method in base class so let's call this a set extend method so how we can call let me open the base class so this is my base class so from before suite we need to call extend method right so extend manager dot set extent so we have set extend method and we need after sweep method as well so i'll write here after sweet so if you see another step configure extent report dot end report so we have if you see we have one end report as well so simply i'll create one method public void after sweet i can give and we'll call extend manager dot and report like this we can call and i'll give annotation here after sweet yeah this and guys we don't need this before test so we can remove this and what i'll do i'll copy the container inside this load config file and what i'll do i'll copy like this and i'll put it over here in before sweet so before shoot sweet only it will load this configuration file so no need of this a direct test annotation so we can simply remove it from here and we can change the name of this before sweet method to load config like this we can do so we have one before suite method inside base class we have this webdriver gate driver method we have this launch app and at last we have after sweet method so yeah our base class is ready now we are calling this set extend from extend manager class let me see the next step add create screenshot method in x action or base class so already we have this screenshot method in our action driver class so let me open this one as well so at the end we have to go yeah so this is a screenshot to take the screenshot we have this screenshot method guys and yeah simply it will take the screenshot so if you don't know about the screenshot already i have created how to take the screenshot if you navigate the previous videos and you will find how to capture the screenshot so this is simple code and here you can ignore this part because this will this is for jenkins we'll change it later on so simply we are returning in this screenshot method this destination okay where we are saving our screenshots so i think we have already created the screenshots folder over here yeah here we have screenshots folder we have created in the first video so screenshot folder is already already there so we are concatenating file name and date name the file name in the sense the test case name and date name so if you don't know about uh again i should tell about this thing like if you don't know about screenshot how to capture the screenshot so already i have implemented a i have created a video on this so you can refer that so this is about screenshot method and what next we have to do to attach the screenshot in extent report add create a listener class okay so listener class we have to create guys because we need to create a report extend report for each and every test case okay so what we'll do we'll implement listeners so we have different methods over there there unimplemented methods uh will implement interface it's listener okay so from there we can configure our script so let me show you from previous class already i have this listener class so simply copy it i'll explain inside this what we have and i'll put it over here my store dot utility so this is my listener class let's remove this yeah i think we have to change this one import base class from com.mystore.based and instead of this base class dot driver what i'll do base class dot we have gate driver method right why it is sorry we have to call it from action class we have short method once again one second this is fine from base class base class dot get driver and a screenshot will call it from action class so simply instead of peace i'll put action class over here and we have to import action from com.mystore.actiondriver so this is how you can implement a listener class so listener class what we have done over here is listener class extends extend manager so earlier we have this class extend manager to configure the extend report okay and yeah list and it implements i test listener and in i test listeners interface we have different unimplemented methods so these are the different unimplemented methods guys on test start we have on test success so simply it will write okay it will add on test start it will add in report okay clear test it will create the test case create the test in extend report simply what it will do okay on test success if it gets passed so what it will do so simply will create the log in extend report past test cases it will give the name of the test case similarly on failure we have to capture the screenshot okay and we have we have we need to capture the logs and everything we can remove these things over here now let me show you this one what we are doing here is on test failure what we are doing in case of failure so what will do we'll simply will write in extend report test case field and we'll change the color of the font is red okay and inside this what we're getting over what we are doing here is we are calling this screenshot method to okay to capture the screenshot okay and on test failure so at the same time it will capture the screenshot in this screenshot folder for field test case and as well as it will add the screenshot in extend report as well so for that we have this create screen capture form from path okay and this is what we are returning the path from this screenshot method here we kept using this screen string variable and simply using this method create screen capture from path we are adding the screenshot in extend report so this is how we can do so guys still i would say if you don't know about about this listeners and extend report then i would request please refer previous videos yeah so this is all about this uh listener class guys on test escaped so we'll write a vertical log like this skip test case is the case name of the test case and we have this on test start on test access and in case of failure we are getting the screenshot as well as we are adding the screenshot in extend report so this is about uh listener class so i think all done yeah and last thing is to call the listener add the below listener inside sweet tag in testng.xml so we need to call this we need to add this listener in our testing dot xml okay and one more thing guys in extend manager so since we have configured using this extend dot config.xml so that's why i have commented all these lines you can configure using this class itself but since we are using this extend config.xml because we are going to implement where logo as well we are going to attach the logo as well so that's why i have used here extend config.xml now let me open the test ng suite so let's run all the test cases so here we need to add the listener inside sweet tag so what is the project we need to exit give the listener class over here so this is my listener class so right click sorry we need to take this now the package name package name and listener class so this is my listener class guys listener class.java so all done i think everything is done so we can run our test case now or all these test cases so let me run it so let me quickly recap like what what are the things we have done so far so we have created uh we have add extent hyphen config.xml this is what we have added and here we have given the path of logo we have created a folder for logo earlier we have created and put the logo over here this is the first thing second thing is we have added this extend manager class so this is our extend manager class to create the object of different classes to create the extent report and to set some some of the values in extent report some of the attributes in exchange report third thing is what we have done is create a folder to save the extent report inside a test output we have created a folder extend report we have configured extend manager dot set extent in base class if you remember here we have set x10 we called this set extend method and similarly we have done for uh after suite method as well and we have created a screenshot full method in action uh yeah we have we have already seen that we have this screenshot method in action class right and to attach the screenshot in extend report what we have done is we have created listener and yeah so we have added the listener to attach the screenshot in extend report as well as to capture the screenshot on failure test case and at last we are adding this listener in our testng suite file okay so let me run this quickly it will take three four minutes so probably i'll pause the video guys so it will take some time for five minutes so let's have a look right click test ng suite so this is the first test case browser is launched automationpractice.com navigated now it will start executing the test cases yeah so our test ng suite xml is also ready guys so i can run this now but let's deliberately fail some of the test cases so what i'll do i'll fill some test cases i need to go to index page test let's fill one test case from here this logo what and title let's change the title over here expected would be my store one and home page test let's do some changes over here what we'll do let's fill only one test case for now and we'll see or let's say we'll write here false yeah so just remember guys we are filling two test cases uh one is from this homepage test and another is from index page test so i'll revert these two things later on so let me run our test suite now right click and run as test in this suite and this will take 4-5 minutes guys so i may pause the video as well so let's have a look run as test ng suite you you you you you so guys so all cases executed so here you can see these are the different test cases and since we have parameterized so here you can see the values which are which we are getting from excel sheet using data provider and we failed couple of test cases deliberately so out of test ten test cases eight past two failed so here you can see and these are the two test cases one is this one because of the assertion error and another one is i think at bottom this verify title so these are the two test cases field and let me revert those changes first otherwise i will forget and another one is home page test this one result now let me look the report why it is giving there i think because of this one right click and maven update the project so that error will be gone and later on we'll check the report extend report what is still showing yeah so let me refresh the project and refresh and if you see inside test report extend report here you can see guys my report.html is created so let me open this right click go to properties and copy this entire path and will open in chrome browser so here you can see guys uh the extent report is getting created so this for these are the past test cases here you can see the test case name is also coming and this fail test case and screenshot is also you can see here this is the screenshot let me show you other this another screenshot okay so this is how you can see the extent report is another view it passed to field and here you can see the logo as well uh this logo is coming the my store logo and this is the project name my store project and let me show you some other configuration which we have done hostname this is the host name my host this is my my store project so this is how you can get the extent report and one more thing yeah so and let's have a look the screenshot folder inside the screenshot two test cases got failed right so here you can see order history details test which we uh got failure and deliberately we have failed couple of test cases and another one is verified title so these are the two failures and we are getting the screenshots inside this folder so i think all done and logs is also there you can see the logs is also created so these are the different blocks some couldn't find temptation i think this is after this one so you can see the logs as well so i think we are done with everything in the framework and yeah so the reporting is also done this extend report now let me push the code into good github and i'll show you the how we can do that so this is my let me login so let's create a new repository over here so just click on this new button and i will write the project name i'll create the repository name like my project and it is available so here you can see the sign and i'll make it as public so you guys can clone this project and simply click on create repository so just click on that so the repository will be created so this is the link of the repository guys so let me push our code into this repository this my project so how we can do that so first of all let me close all these things so this is the project my project and what i'll do in this quick access what you will do will find if you write git repositories will find this and you drag it to bottom second not coming like this close this yeah like this you can drag at bottom now i will create one local git repository first okay because we don't have a any repository related to this one so first we'll create local repository git repository and if you don't know again about git and github then you can refer the previous videos guys as i have told you in this last video since last video we are providing i'm providing all the links so i have git and github link as well so you can refer if you don't know about the git and github so all the links are i'll provide in the description box of this video as well yeah so let me create so we have this create a new repository so we can create new repository i'll give name over here my my project sorry my store and click on create so my store is coming over here now you can see here now what i'll do i'll simply select this project because we have this my store project over here right my store repository is created so let me show you in the c drive you can see over here users and yeah so here you can see that my store project is created and dot git file will be created over here this is the hidden file so that means we have created our own repository local repository over here now simply we need to push our changes locally and then we'll push the changes to the github so what i'll do i'll select this project right click and we have team share project and from here we have to choose our local repository so which this is the local repository and simply i think i need to click on finish yeah simply we need to just click on finish so it will why this is coming no problem you just click on finish yeah so here you can see just refresh this and if you go to the path here you can see it is coming inside this my store path okay so all the files are stored inside that path now simply what i'll do now we have updated the changes in the local repository now we need to make all the changes updates to our git repository how we can push the changes to the git repository okay so right click and team we have commit okay so these are the different uh files inside our project so simply add all the files to stage area and simply i'll write over here first commit and commit and push simply select commit and push so it will ask guys the uri the url of our github repository github repository which we have created earlier now simply i'll provide this github url over here and yeah provide the username and password over here your github username and password click on next and it will go to master branch click on next and finish again you have to provide a password your github password login yeah it is done it is done to master branch and this is the url guys i'll provide the url in the description box of this video as well this github url so close so let me check the github now simply refresh so here you can see the project is added in the github so this is the link so you can get the link yeah this is the link guys so i'll provide the link don't worry i'll provide the link in the description box of this video and if you go to go inside this my project so here you can see the comment which we have given first commit so all the things are added over here so inside this src i can see the scripts as well these for the main whatever we have action driver base class data provider page objects so let me show you one thing so this is action.java so here you can see this action.java you can find here so you can clone this project and yeah so everything is done guys for today so in the next video i will talk about continuous integration and how we can run project using different jobs i mean in jobs in jenkins and i'll show you how we can send the email how we can send the email through with the with the help of attachment with with attachment how we can send and yeah we'll uh i'll show you i'll talk about some tips and conclusion of our framework so thank you guys for watching have a nice day and if you're new to my channel then please subscribe the channel and also follow me on my blog as well thank you guys for watching have a nice day bye bye hello friends welcome back to automation testing insider this selenium framework development part 8 and as you all know that we are creating data driven framework with page object model design pattern and you can call it as hybrid framework as well now let me show you like what are the things we have covered so we are almost end of our framework guys uh end of our framework development and we have covered uh these are the different things which we have already covered session wise and yeah so we are at this point continuous integration is pending and we'll run our project through jenkins and i'll show you how we can generate reports in jenkins as well and how we'll send the email how we can send the email through attachment uh i'll show you that one so this is what we are going to discuss today and in the next video we'll talk about some tips and conclusions so by today our framework will be done everything will be done and in the next video i'll talk about some theoretical stuff like uh tips and conclusion of our framework so i have separated these two parts because i don't want to make this video very lengthy so let me open the architecture what are the things we have covered in our framework architecture so this is the architecture in the first video we have created and almost everything is done and last time we have pushed the code into github we have created the github repository and i have shared the code in github as well and this part is remaining this continuous integration yeah jenkins so we'll do the continuous integration today so here i have listed down some of the steps which we are going to follow today so there are some prerequisites we have to uh follow those so first of all we need to set up pom.xml for parameters so since i am going to parameterize our test from jenkins as well so we need to set this form.xml parameters okay so let me show you so this is uh our project this one this my mystore project so this is our project the framework which we have created and let me open palm dot xml yeah this is our pom.xml so we need to do one setup over here which i have already done so inside this uh maven software plugin guys we have one dependency one plugin maven surefire plugin so this this is used to run the test case so here we need to define some configuration inside this configuration tag so this sweet xml file we have to verify i mean we need to put this sweet xml files so that we can run all our sweet xml files we can set up all the sweet xml files in jenkins and we can run whatever we want uh let's say if you want smoke test sanity regression so we can choose from uh different parameters from parameters in jenkins and you have to just define uh the shift xml key like this dollar and this parenthesis xml files you can give any name so i here i have given xml files and another parameter would be this url so url will be defined under this system property variable so under this we have uh defined and there could be one one more parameter one more system property variable that is uh uh browser but since we have already configured the browser in testng.xml so here you can see we have already sending through parameters okay from testng.xml yeah so this is about the setup bom.xml for parameters make sure testing xml is ready so all our test in the xml is ready so this is testing the all so these are the different classes we have and uh don't forget to add these listeners because based on the listener only we are adding test failure or based on the test case fail or pass will add into report extend report so don't forget to add these listeners in your testng.xml so similarly i have done for other xmls as well so this is listeners i have added here for regression we have this uh again i have added here so this is what we can set up testng.xml another thing is make sure all tests are ready so let me open some test over here yeah so here you test case is also ready yeah we have all the annotations and just make sure for all annotations we should have this grouping okay because we have defined a different uh our test cases into different groups so here you can see this is added test test meta method so here we have sanity group this belongs to sanity group this particular test method so since we have three groups so that's why i have added these different groupings in all the annotations after method before method similarly for base class as well on before sweet here we have given and after sweet as well so this is how we need to set up the groupings okay and let me close all now what i'll do i'll deliberately fill some test cases for reporting purpose so that we can see some failed test cases as well in our extend report so what i'll do i'll feel some test cases from here let's open this home page test and what i'll do i'll fill this test case order history so i'll simply make it uh false sorry like this so false so this test case will get failed this test case will be failed and another thing is uh index page test i can pick yeah here and we are going to verify the title as well so simply i'll fill that as well so my expected would be this my store one but will get my store only so this will definitely it will fail so this is how you can set up you can deliberately you can fill the test cases to just see the reports just for testing purpose now i'll push the changes to github commit and here i'll give updated test cases i'll give comment like updated test cases and click on commit and push enter username and password of your github and click on login so it push the changes to master branch so click close and yeah now here you can see this cylinder symbol that greater than symbol is gone so that means we push the changes to github so here my github is already i have logged in so here now you can see the comment latest comments updated test cases so if you open this we can see inside this src folder okay updated test cases so our test cases are also updated and now what is the next step we need to just set up rain and or run jenkins okay we need to set up uh setup in the sense we have to install jenkins and now we need to run the jenkins so guys if you are new to jenkins then already i have created videos on jenkins already i have created series so if you go to my channel that is automation testing insider so just navigate to playlist and here you will find jenkins videos so there are four videos in that playlist so please refer step by step so uh complete installation process i have explained over there okay so just you can refer this i'll provide the link in the description box of this video as well this jenkins video so let me come back so already i have set up this uh jenkins batch file so simply i'll run this double click and just run it and i'll show you just right click and edit so this is the command so instead of just going through cmd command prompt and writing this uh firing this command simply i have created a batch file over here so this is the command and this command is used to this hudson model command is used to because earlier we faced issue in jenkins right while generating extent report the ui got broken to just resolve that issue we need to just put this command in your when you run your jenkins server and this is simply the jar file where it is located and this is for port so since i'm running on 8082 so that's the reason i need to specify this port over here if you are using the default port that is 8080 then it is not required so this part is not required okay so i'll provide this uh command also in the description box of this video so let me close this now we can see uh here you can see jenkins is fully up and running now we can login to jenkins localhost 8082 so here we need to provide our credentials username and password click on sign in the next step would be i'll show you how we can set up this global tool configuration and configure system so these already i have shown you in the jenkins video guys so you can refer but quickly i'll go through these setups as well yeah so here you can see i logged in into jenkins and these are the different jobs which i have created earlier now what we'll do i'll show you let me show you these two things uh global tool configuration and configure system so from here you can go to global tool configuration so just click on this triangle and manage jenkins and we have this global tool configuration so in this global tool configuration we have to just specify the jdk path and this is the directory java home directory and this is the path so simply you have to specify the path for jdk and git let it be like this only and if you are using gradle then you have to specify the gradle path and this is also important marvin so this is the maven path we have to specify so this is about a global tool configuration and go to manage jenkins and this configure system so we have one more settings at jenkins level at top level at system level okay so configure system it is taking some time yeah so this is a configure configuration at system level so yeah here you can specify the system admin email address from the sender of your email the system admin email the name and you can configure like this and another thing is uh another important thing is we have to configure the system extended email notification you will get this plugin extended email notification so this is how you can set up guys smtp server uh since i'm using gmail so you can specify smtp.gmail.com smtp server and this is the defaults suffix just click on advanced here you have to specify the username and password of your sender email that is nothing but the admin email and just click this check box smtp authentication and 465 is the default port yeah so this is what you have to just specify and suppose you want some default subject line so this is how you can create the default subject line so this will be applicable for all the jobs until unless if you don't specify at a job level then it will take this the content from here okay so this is it will take this default i mean this is the default subject line and this is default contained you can specify it system level and what else yeah email notification another thing is there so we need to just specify all the configuration whatever we have done at top so you need to just specify all those configuration and yeah you can test this configuration by select this checkbox and whatever sender is there not sender recipient you can put the recipient email address over here and you can test this as well and one important thing is if you are using gmail so for sender the email which we have mentioned here for that we need to just make some changes in google account so you can just search on google secure app settings in gmail so you'll find this link less secure app and your google account okay so here i have already opened that so just click on this one if less secure apps access is on or on for your account so just make sure that this is on okay so if you click this yes here that should be on in on mode okay so this is off one second this is for different account this for not this one yeah so for sender it should be on always less secure apps so since i'm using gmail for testing purpose so that's why i kept it as on so that you can do guys and yeah simply all are fine in system level now let's come back and leave this you can come back to the dashboard now i'll create a new project over here new new job so i'll give name like my project my store project and one more thing i forgot to tell you make sure all the plugins are installed so we are going to use different uh things in this job okay so like we are going to use extend report we are going to use testing g report html editable email notification so make sure all these plugins are installed in jenkins so in the same video i think uh part two i have already explained in this jenkins video what are the plugins required the basic plugins required so you can refer that video and you can get it uh the details there so my store project i have given the name of my job and since we are we have this maven project so select this maven click ok hello okay and i don't have a practical experience um um i can manage very much [Music] please [Music] sure so you need to just provide the project description over here so let me give some description this is my store project so you can give any description and yeah we need to select this one this project is parameterized for parameterization later on we'll do that and just come back to this source code management so since we are using git for sem so it's good management so we'll select git and here we have to provide the repository url so i'll go to my github and i'll copy the github url from here and i'll put it over here depository url and we'll select credentials the github credentials already have set up over here so we need to just select that and trigger these are all not required build environment not required three steps we are not going to take any steps so this is important uh now we have to specify the root bomb path over here so how to specify the pom so where our form is located inside our project directory okay so we have form over here this pom.xml so this is the path you need to just give the root project directory and then slash form.xml so simply i'll provide here and goals and options would be clean install and we have to specify the parameters we are going to pass the parameters right couple of parameters i have shown you in the beginning like sweet xml we need to pass let me open the pom.xml yeah this xml and url we need to pass so the command is minus d and this is the key from pom.xml is equal to we are going to set the uh value which we are going to take in jenkins okay so that you need to set up so using dollar symbol you have to specify the xml file so we'll set up the parameters at top with key xml okay so this is how you can give a minus d the second thing is url so just specify url over here and again dollar symbol and i'll put here url so this is how you can set up the parameters clean install minus the xml files equal to this xml will set up and url will set up and post steps post build actions so this is very important so the first thing is will publish test ng results so you can select this no need to make any changes over here the second thing is what we'll do will publish html reports html reports nothing but uh will publish our white is not coming html report where it is yeah this is html for publish html report so just click on add and here you will provide the extent report we are going to publish extend report that we need to specify so extent report is located inside test output so this is my external report guys inside this extent report so we'll give this path from root directory from project directory will specify this path and here we'll provide the the file name so we have this my report dot html so we'll provide this my report.html over here and we can give our report name extend report like this we can give and publishing options are not required and one more thing we need here is uh html editable email notification so just select that one now here we have to set the email so these are not required let me tell you where we need so just click on this advanced settings and and trigger will trigger always irrespective of whether field failure or success so just select this one you can cancel this one yeah let it be like you know just cancel this one as well always just uh cancel these developers options so recipient list here we can add and recipient list so to which email id we are going to send the report okay so the email so simply i'll give that email recipient email over here this is the email ethendra verma22 gmail.com and the project contain type would be html text and html and the it will take the default subject from the configuration i have shown you at the beginning and yeah content i'll take i have already written over here some contents and here we need to specify the extent report path so once our workspace is getting created after that i'll specify the workspace path that we can open through hyperlink this extent report so this is the format guys i'll provide this format with you guys uh in the description box of this video already i have explained this in jenkins videos so just select this and put it over here this content and attachment so since we can access the extent report from our email body so what i'll do i'll give the attachment of logs so just go to the logs in the project directory we have the logs yeah i think this is the logs folder so this is log so i'll specify from root directory so that will be attached in our email my store project logs log4j dot log so this is how you can give the attachment and i'll attach the build log as well console.log so this is how you can do you can set up the email now it is done now at top we need to specify the parameterization which we have set up over here this xml files and this url so we have to specify this project is parameterized so we'll add the parameters so first i'll select choice parameters and i'll give xml over here name so this name should match here with this one this one okay similarly for url as well so xml and what are the different xmls we have so these are the different xmls we have so just copy all the xmls there this is for cross browser we have different groupings regression this is for regression we have sanity we have smoke yeah so these are the different xmls we have and you can provide some description over here so these this is the sweet xml or choose the sweet xml which we are going to run and we can add one more parameter string parameter this time and i'll give url over here and what is the default url we have so we have this url the base url of the application so this is the this is the application url so this is how you can set up let me just quickly recap what we have done so far so we have given the description of the project over here in general tab and this project is parameterized so here we have given the different values and these for the string parameter url we have set up source code management we have selected our github url over here we have provided and what we have root bomb we have given the palm path goals and options we have given like this command and build actions post build actions so this is for extent report extend report directory and this is the extent report file name myreport.html this is the report name and later on we have set up this for testing gxml so we'll get the test engine results and what we have for this is for testing the reporting guys and uh we have this editable email notification so for that we have set up over here this is the recipient address we have this contained and yeah attach the build on and this we are going to attach the lock for log as well and here we have selected attach build so i think all done so let me click apply and save it so this is created the job is created back to dashboard now here you can see my store project is being created and here you will see build with parameters so if you don't set the parameter you will see only build build now and here you will see build with parameters so just click on that so let's select uh this smoke test we have six test cases i think in smoke group so let's run this smoke group so just click on this build so here you can see the it is initiating now just click on this job and console output so first what it will do it will create its own workspace and uh yeah it it pass this github url guys so it takes the project from this github url and here you can see we have given the latest commands when we updated our test case we have deliberately failed some test cases right so here we have given while committing the changes we have given updated test cases so here you can see the message now it will start the maven life cycle cleaning the project and compiling and all so now here you can see the test starts so it will take some time and then it will run all the test cases chrome driver was started successfully so chrome driver chrome browser will be launched here you can see now let's wait some time then it will execute all the test cases [Music] you you still it is running there are six test cases in smoke group now i think it is done here you can see six test cases two failures there are test failures you can see now it is doing the reporting part the configuration of the build that's why it is coming as build success but there are some test failures so that's fine we have deliberately failed couple of test cases now here you can see it is sending the email now i think it is done so let me go back to project and we'll see the extent report let's have a look the extent report this is the extent report guys so this first test case for test case passed to failed here you can see and this is the field test case now here there is no screenshot screenshot is attached i have given the message but there is no screenshot and you can see here is uh it is because of the assertion error so we'll fix this one now we'll provide the workspace path then it will come and here you can see one more problem is this logo is not coming properly the project logo and another failure is this one verify title so this is that is also because of the assertion failure and here also we don't see any screenshot so i'll fix that and here you can see another view of this extent report now let me check the email whether we have received the email or not so this is my recipient email now here you can see my project build one is we received the email and here you can see please find the below automation testing results so this is very good uh template which i'm going to provide you guys so this is the template which i have written over here and we need to fix couple of things over here this extend report there is no hyperlink over here so we'll fix that and here you can see the console logs in the email and if you go and check the attachment so here you can see the lock 4g log as well and build this is the build log so here you can see the build log like this and log for your log you have to download and after that you can see so this is very good template here we have given all the information so project name build number so first bill number and build status is unstable okay now let's fix those things so i go back to my project and we have to fix the logo so we'll open this extend config.xml because we have configured the extent report using this extend hyphen config xml so here we need to provide the uh the workspace path of jenkins so simply i'll go to jenkins back to project and here you can see workspace got created so i'll give the logo path from here so this complete path i'll give over there just update the path from here to this path okay so this is the path of the logo and the second thing is we need screenshots right so for screenshots uh just go to action class so in the action class we have the method called screenshot so this will take the screenshot so what i'll do yeah so this is the path for jenkins guys so here we need to specify the screenshot of folder path so simply what i'll do in the workspace only will get this screenshot path simply copy this entire path and we'll put in our till here yeah so this is the path of jenkins and will return instead of destination so this is the local repository local path so instead of that we'll give this will return this jenkins workspace path so simply i'll give instead of this return destination i'll give this i'm going to return this this one this path okay so i think these two changes are done so let me push the changes again now i'll show you one more thing we can let me open this project maestro project configure and you can run periodically your project as well so let's do automatically when we push the changes then how we can run our script but in that case we have to it will automatically it will run this testng dot all so that's fine yeah so here we can just select this one paul scm just check this one build triggers and here you need to just specify 5 stars like this so whenever you make the changes automatically it will uh run the build okay so for not for now i'm not going to use this so let's push the changes first and then we'll do probably you can do this you can already have explained that in jenkins video so you can refer that video so for now i'm not doing this click on apply and save i'll simply i'll push the changes manually and i'll run the project again so team and commit updated action class and extend config.xml commit and push here provide the username and password of your github click on login so those couple of changes will be pushed to master branch here you can see all done now we'll do we'll run our script again build with parameters now now this time we'll see whether we'll get those screenshot and logo or not in the extent report okay so this time i'm going to use this testng.testng hyphen all xml so we have 10 test cases so out of 10 it should be passed and 2 will be will get failed okay and this is the url so simply click on this build so this will take like four five minutes guys so i'll pause the video and once it is done then i'll come back so just go to this console now it will start so here you can see updated action class and extend config.xml so this is the comment which we have given now it will start executing the test case first it will run the maven marvel life cycle maven clean resource plugin compiling the sources and then it will start test now here it will start the test executing the test cases so this is the first time it will launching the browser for the first test case so i'll pause the video guys and we'll come back once it is done you you so welcome back guys uh so i think all test cases are executed here you can see total test run test two failures which we deliberately failed now it is uh yeah sending the email so i think all done so we'll receive the email so maybe it will take some more yeah here you can see this is the build too so we received the email now here you can see hi team please find the below automation results for project my store project and this is the project name build number two still unstable because we have couple of areas oh sorry we forgot to give the hyperlink over here and this is the console log which we have seen and what will we have we can see the uh log4logs and build log now let me open the extend report now here you can see the logo is coming this my store logo is coming over here and we have this screenshot also attached so we have couple of failures in extent report you can see here and this is the verified title assertion error and here you can see the screenshot is attached so this is how you can send the email and you can see the screenshot i mean extent report also you can verify and you can see this logo you can attach in your project and you can attach for field test cases as well one thing we forgot this attachment sorry hyperlinks of extend report so let me quickly fix this and we'll run it again so if you go to conf configure and just navigate to that email part advanced settings and advanced so here we have to specify the uh the path of our xml sorry extend report okay so what i'll do i'll open this in different uh window okay and just go to my project and test output extend report we have this my report dot html so just copy this entire path of extend report and just come back uh go back to here and this default content and here i'll provide the entire path over here in this anchor tag okay so like this it is done now simply i'll click on apply and save let's run this test case again build with parameters and now i'll run for let's say smoke so it will run a little bit quicker than the all xml file so click on build i'll come back again guys once it is done so probably this will take to three minutes so let's do that console output this is build number three you you nothing all test cases are executed here you can see we have six test cases in smoke group and there are two failures and here you can see it's in the email let me check the email so this time the build number should be three so here you can see we have received email my stoppage at build three still unstable now here you can see we have we got the hyperlink of check extend report to view full results and this is about the project and if you click over here you will see the extend report here directly through this link right so you can open the extend report from email itself this is the logo and these are the failures which we got for for past test cases yeah here we have screenshot for field test case this is another view these are some variables we set up in our scripting so this is about uh today's guys uh continuous integration so i think everything we are done with our framework in the next video we'll talk about some tips and what are the steps we have uh we have taken to create this framework we'll discuss in the next video and going forward if i'll get any update or anything i need to update on this framework so i'll create video on that if we want to improvise some more uh scenarios or things in this framework so i'll create a separate video on this and uh on that and then publish that okay so i think we covered everything in our framework so let me open this architecture so all the components we have covered all the phases we have covered and already i have pushed the changes in the github so you can pick the project you can clone the project from there so this is the uh the url of the project would be this one i'll provide the url in the description box of this video and this is for the template so this one also i'll provide in the description box of this video so thank you guys for watching and if you're new to my channel then please subscribe it thanks a lot bye bye hello friends welcome back to automation testing insider this is selenium framework development part nine and as you all know that we are creating data driven framework with page object model design pattern and we are almost done with our framework guys few things here and there and then we are done with our framework so let me show you like what are the things we have discussed already so these are the different things we have discussed session wise and in the last video we talked about in the session 8 we talked about continuous integration and i have shown you how we can run our project through jenkins jenkins job and we have discussed like how to generate the reports exchange report i have shown in uh in the last video how to send the emails so these are the different things we have seen in the last video now today i will talk about in case if you have to pass different test data in your particular test case so how do you do that okay so that is what we are going to discuss today i was supposed to talk about tips and conclusion in this particular video but since we have few things left so that's why i have created this particular video so we are going to see this today and in the next video we will talk about oops explanation and tips and conclusion so many people asked about the oops concept in the framework okay so already we have created based on oops concept so i'll show you how we can relate our framework how i can explain about the oops concept in our framework in the next video so that is very important uh part will which we are going to discuss in the next video so today i'll show you i'll focus on this particular thing like let's say if you have any test case and suppose you want to pass several test data in that particular test case so how do you do that okay and so we are going to use collection framework in uh the framework okay so collection implementation an example so guys already i have implemented this the test case for this one i'll show you step by step how we can achieve this so let me give you an example which i have implemented so this is our project this is our application automation practice.com and just click on this sign in so in this login page we have this option create an account okay so if you enter for new user you just enter the email address an email address valid email address and create an account so this is dummy application so that's why it is taking any email okay so this is what we are going to implement so create an account so last time when i have created the framework at that time i have just validate this page only we haven't created any test keys related to this page okay so what we are going to do is we will create a test case which i have already done okay i'll show you that how i have created the test case for this one so here we have different test data like this is complete form new form where we have different like we have we have this title first name last name email password date of birth first name last name company address city so these are the different fields in this form okay so take an example if you are creating the test case for this one so if you create the test case then it would be very difficult to pass all the test case in as parameters right so so or to avoid that thing how we can do that so we can achieve that using collection collection interface okay so collection framework so if you are new to collection if you don't know about the collection so already i have created video in my blog i mean i have created the post and already i have covered that part uh as part of video as well as part of our selenium series so if you navigate with just automationtestinginsider.com java for selenium here you'll find all the collection related collection framework in java so all the post you can find over here and i have corresponding video as well so like this i have attached the video as well so you can refer these videos so let me show you how i have achieved this okay so this is the framework which we have created guys uh this is the project my store project and the first thing what you are going to do is you need to just for this page you need to just identify all the web elements okay all the web elements using page factory method will store in page class okay so that is already i have done so let me show you so this is the package we have com. my store page object so account creation page and here you can see i have written all the objects using the red fine by like we did for other test cases other page classes right so i have we have different fields this is a form title this is uh for that mr field this one drop what you can say uh uh select okay selection of this gender field okay radio button we have first name so for all the fields we have i have created the locators over here we are using at the rate find by so we have this uh mr and mrs field so here i have created for first name we have this first name and last name so already i have located all the web elements in this page class and let me show you so these are the different fields guys the different web elements which we have located and this is the method which i have created create account okay so for the user actions so we are going to perform different user actions so for that i have created this method create account and here we have different parameters so these are the different parameters which we are going to pass in this create account method okay so either there are two ways either you can pass all the parameters all the web elements in the same same method or you can create the separate method separate user action method let's say suppose you want to enter the first name so you can create a separate method for this first name okay because since i'm using this uh the same method create account so that's why i that's the reason i have passed all the values all the parameters in the same method and simply this uh here i have included this if else condition to select mr or misses from here so if gender dot equals ignore case will get the uh value from excel sheet if it is mr then we'll select uh this particular web element okay this mister otherwise we'll select this one so this is about that if condition here you can see and yeah these are the different things which we have first name the selection of first name last name i mean entering the first name last name password d month year okay so which i have already implemented in this user action method okay so this is about user action method create account okay and i i have created one more method valid registration so once the registration is over once we enter all the information then we'll click on this register button okay so for that i have created one more method valid registration and here this is the element web element of this register button and when we click on that one it should navigate to home page okay so we'll return the object of home page class so this is what i have written validate registration when we click on this register it will it will show the home page and yeah so let me show you the test class now so this is about page class now i'll show you the test class and i'll show you how we can pass the parameters in test class so this is account creation page test so this was the test case guys which already i have we have created earlier verify create account page test where we are just verifying whether the user is landing on that particular page or not now this is the main test case which i'm i was talking about create account test which i have created so here you can see instead of giving the parameters all the values because we are going to read the data from data provider right here we have provided we have given the data provider okay so in the same manner i'm getting the values from data provider but i'm getting the value in the form of hash map so this is the collection guys hash map which takes the value in the form of key and values okay so this is the key and this is the value we have two parameters in in this hash map i mean uh it will take the value in the form of key and value so this is my hash map now based on key right so key why i have taken this hash map because uh in hash map key will be same i mean unique key will be unique and values can be diff uh i mean duplicated okay so yeah using this hash map value using this object i am we have this method gate method okay in hash map so using that gate method uh this is the value uh i mean key okay so based on this gender this key i'm getting the gender similarly for first name last name so these are all what are these these are all column values okay column names basically so let me open the excel sheet also so i can explain better so this is the excel sheet guys yeah so account creation data i have created and similarly i have given over here this new account oh sorry this is the data provider i'll show you that one this is the excel worksheet okay so here you can see we have a key and value pair right so we'll consider the column names as a key and these are the data okay so we have gender so here we have a gender we have first name firstly we have email so this is the email gender first name last name like this so we have gender first name last name set password day month here everything we have here okay so that's why this is how we get the values based on the key okay we are calling this create account method right so ultimately it will call this method create account method and it will perform the actions whatever actions we are going to perform here so it will type the first name type the last name okay it will do like this now the most important part is i'll show you how we can get the data from data provider okay and at last what we are we are just validating i am calling this valid registration which will returns the object of home page and simply where we have put the assertion over here and validating this url whether we are getting the homepage url or not okay simply home page dot get url method using this get your current url method so this is how you can test and let me show you this data provider what i have done in data provider so if you remember earlier we used to so let me talk about this one any uh the previous data provider so simply let's say if you want search product so this is the data program for search product so simply we are getting the data provider and in the form of object rows and columns right so in this form of 2d array so this is what we are getting the data now in case of our this this account creation page test what i have done here is i have created this data provider i have given the name new account details data which i am providing in my test case so this is the new account details data and here i have created a hash map okay created the object of hash map class so this is how you can create the object of hash map so it has two parameters okay key and value so this is how you can create the object of hash map and simply these are the same thing which we have done for previous data providers getting the total rows from excel sheet using the excel library we have created the object of excel library at top we let me show you this is the object of new excel library which is present in my utility class utility package okay and yeah so these are all these two will get the total rows row count and columns count okay now using this for loop we are reading the data from excel sheet okay and we'll put the data into hash map so we have method called put in in hash map so using that put okay what we are going to do we are retrieving the data in form of key and value so this particular thing will get the keys okay so it will get the email and the second parameter will get the value corresponding value so this email it will get okay so this is how we can get the value and we'll store data in hash map hashmap object and at last we simply we need to return the uh hashmap okay so simply you can write like return hash map and instead of this object you have to give this hash map so to avoid that i have written like this so this is also fine so you can return like this hash map and simply we have provided this data provider this data provider name to our test class here you can see new account details data and these are the different keys which i have talked about gender first name here we have gender first name last name set password etc so these are the different uh we have values okay so let me run the test case guys uh how it works okay so what i'll do probably i have already used this data so simply i'll change this email address i can give any random because this is dummy application so any email will work now let me close this meanwhile i'll start my jenkins as well jenkins server and let me push the changes second just save it we have yeah now we have to update the changes we have we have updated the test data right so we need to push the changes to github so commit the changes updated test data and commit input simply write username and password of your github account right is done now what we are going to do is so our jenkins is fully up and running our jenkins server is started already now i'll simply login into jenkins right what happened localhost at at two username and password of jenkins click on signing and this is the job which we have created my store project so let me open this one and we have given this test case as part of regression i have added as part of regression so we'll run regression suite and yeah configure let me show you one more thing guys we are getting some unwanted logs as well if you remember let me show you in the email if you built in i think we got just for testing purpose i run different builds okay so let me show you some locks which unwanted locks which we are getting related to free maker uh these are the different locks okay couldn't find template so if you don't want to anyways this doesn't affect anything but if you don't want these logs then what you will do simply you need to just go to your this build and you need to just add this command minus d and this org dot free maker dot logger library is equal to none so it will stop those logs okay so that is related to free maker uh blocks okay so you can avoid like this now let me simply run this project build with parameter and i'm going to choose regression because that that case is part of our regression so you can run this test and regression and click on build so the build number 12 is getting started here we go and console output now our test case will start so this is the letter element which recently we have just now we have updated updated test data so it will pick the latest code from github guys now it will start executing the maven life cycle and then it will start executing the test cases yeah so now test will start so this is the first test case launches the browser it will navigate to automation practice.com now till it's good test case one by one i think we have four test cases the regression suite so it will execute one by one all the test cases so this is the first test case now here you can see we are getting the logs as well now i'll show you at the end also how we get the email this was the second test case now it will start the third test case yeah this is the third test case guys and at last i think it will execute the account each creation so this is the end to end test proceed to check out and payment i confirm my order so this is the end-to-end test now it will start the last test case that is create an account test case okay create a contest it's taking time it will enter the email address yeah and click on that create an account now here you can see it is entering all the data and click on register so this is the test case which i have implemented now it will yeah the test case is passed so here you can see four test case failure zero so all our four test cases uh executed successfully now it will uh collect all the reports and it will send the email so i'll show you the email as well yeah so everything is done and you can see we don't see those logs as well so because of that command okay so let me click on the back to project you can access extend report from here but let me show you through email so here you can see we got the email my project build 12 fixed so all the test cases got passed so that's why we are getting fixed just click on this so high team please find the below automation testing results for my store project and this is the project name build number fixed and this part i forgot to show you in the last video guys because of uh the video was not captured not recorded at the end so here you can see this hyperlink as well check extend report to view the full results okay so you can click on this and we'll get the extend report in the next video uh next window okay in new view window new tab okay so here you can see the date the this is the recent results and these are the different text cases which we have executed and this is another view and this is the logs in the email and if you see at bottom we don't see those unwanted logs okay so that is resolved and we have this log 4j log4j.log and build.log is attached so this is about today guys how you can pass the if you have different test test data then how you can pass in your test case with the help of collection framework so this is the implementation of collection framework so this is the one uh one of the examples of collection framework so in the same way if you are working in a real-time project so you might you may need to uh i mean use this collection framework frequently okay there may be different scenarios to achieve that to use that okay so this is what uh this is all about today and in the next video i'll talk about oops explanation and we'll relate with our framework okay uh i'll show you how we have achieved oops concept in our framework and i'll discuss about some tips and conclusion of our framework okay so thank you guys for watching and if you're new to my channel then please subscribe this channel thanks a lot bye bye hello friends welcome back to automation testing insider this is selenium framework development part 10 and as you all know that we have been constructing data driven framework with page object model design pattern and this is hybrid framework as well so guys we are done with our framework and it's ready to use it is available in github and i'll provide the github link in my in the description box of this video so let me show you like what are the different things we have covered as part of this framework uh and we have started from uh framework architecture we have seen the framework architecture and uh we talked about different components in a framework we have created in that framework architecture and later on we have implemented those different components in our framework we have updated the pom.xml we have created config.properties file we have created the base class and action driver we have implemented the action driver class later on we have written the page objects using page classes we have created the test classes and written test scripts and we have done the implementation log version implementation in our framework we have done the data driven testing uh we run our test cases using testng.xml and we have divided our test cases into different groups like smoke sanity regression we have done the cross browser testing as well cross browser in parallel execution later on we have implemented extend report listeners screenshots and later on i push the changes to github as well and we have done ci integration continuous integration with jenkins and in jenkins we talked about how to generate the reports extent report and how to send the email with with an attachment okay so this is what we have uh discussed uh over the last few days uh session wise and in the last video we talked about how to pass if you have more than tested 10 test data in your test test case how you can pass those test data in your script we have implemented collection for that okay so this is what we have seen in the last video now today i will talk about oops concept basically oops already i have covered as part of java tutorial so i'll release those oops concept uh based on this framework how we can relate those oops concept in our framework and later on i'll talk about the tips and conclusion of our framework so this is what we are going to discuss today yeah and guys if you are new to my channel then please subscribe this channel and click the bell icon to get the notification for upcoming videos and if you like this video then please share this video among your friends so this is what we are going to discuss today so oops uh concept is very important as part of the framework creation and this is the core concept of the object-oriented programming okay and yeah so basically uh this is an important question in every interview selenium java so they will ask like how do you implement uh how did you implement the oops concept in your framework so basically they will ask with respect to your framework your project okay so they want to know like how did you implement the concept in your framework they never will their intention is to ask about your project only they will not ask like about the system defined interfaces and overridden methods okay so basically they will they want to know like how in real time how did you implement these oops concepts and oops concepts are really important to create the framework because it simplifies the designing of the framework so it's really important so let me show you uh already i have covered about oops concept if you go to my blog that is automationtestingcider.com and we have java for selenium and here uh java oops concept i have explained everything about the oops concept with the help of example but today i'll show you how we can relate with our framework which i have created okay so these are the different uh points inside oops concept we have different uh things properties of oops concept so we have object class inheritance abstraction encapsulation polymorphism okay so these are the main points inheritance abstraction encapsulation and polymorphism so we'll discuss about them and i'll show you how we have implemented those in our framework so let's talk about object in class so whatever programming object programming you are going to use so it is based on object and class okay so object is an entity which has a state and behavior so we have implemented this object in class in our framework i mean this is based on object-oriented programming right so we have used object in class in our framework so let me and we have used a page object model guys so everything we have written in our framework is page objects and we are returning the object so you can see the page navigation of this my store application as well we have stored different page objects as part of our framework and we are returning the object of the corresponding landing page so let's say take an example if you are landing if you are navigating from index page to search result page we are returning the object of search result page if you are navigating from search result page to add to cart page we are returning the object of add to cart page so this is how we can relate all the pages inside our framework in our project okay and this is how we are written returning the object and we have created the ph classes to create all the page objects and this is how we are returning the objects of corresponding landing page and we can interlink all the pages inside our framework and class is very simple uh i mean it is the collection of all the objects yeah so that is the class now let's talk about inheritance what is inheritance okay so let me next go to the next slide inheritance so what do you mean by inheritance so one class acquires the properties and functionalities of another class is called inheritance so basically there is a base class and a child class okay there is a parent class in child class so child class will acquire all the properties of base class or you can say the parent class that is inheritance okay so let me show you like where we have implemented this inheritance in our framework and this is how you need to explain with the real world example whatever you have implemented in your framework so you can relate with this framework as well so this is the framework guys which we have created this is the project maestro project and if we expand yeah this is the base class so this is the heart of our framework so here i have given the definition of the base class like what it does this is the comment which i have given base class is used to load the config file and initialize the web driver so the basic purpose of base class is to load the configuration file and initialize the web driver so here you can see i have given the commands as well like declare the driver okay so this is the driver declaration we have created the object of this threat local and this is the load config method by which we are loading the configuration of our properties file okay and we have this launch app method by which we are initializing of the web driver by which we are launching the browser and later on we have this uh maximizing the screen detail delete all cookies and etc all these different methods we have implemented over here okay so this is what about the base class so this is the super most class of all the classes inside our framework so this is the parent class and all other classes all the page classes okay all the page classes and test classes will implement this base class because we are going to use the properties from this base class we are going to use this driver we are going to use this launch app method so whatever common things are there that should be defined in this side inside this base class okay so this is how we can acquires uh the properties from this base class and this is how you can relate this base class with inheritance concept okay and what are the advantages of inheritance so reusability so this is the most important point of inheritance advantage of inheritance a quote can be used again and again so since we have all the common things over here which can be used throughout the program will be listed on here we have implemented here so that will be used throughout the program across different classes okay so we have implemented we have extends the base class from this account creation page inside peace classes and we have exchanged the base class from test classes as well here you can see extends base class so this is how we can acquire the properties from we can reuse whatever we have written inside the base class inside other classes it makes us write the less code and the code becomes much much more readable so the designing would be very uh simple if you implement the inheritance because uh no need to write the code again and again and it will be very readable format so you can easily understand that understand that like how we have accessed the base class and how we have implemented the properties so here you can see uh since we have extended this base class from this account creation page right and here you can see we have directly we have used this gate driver method which comes from if you push if you press ctrl and click on this get driver it comes to this base class so this is the the method which we called from base class so directly we can implement all the methods we can call all these methods from base class directly yeah so this is about inheritance guys so this is how you need to explain about the inheritance and what is next abstraction so abstraction is the process of hiding the implementation details and showing only the functionality to the user okay so let's take an example you are watching tv and you are just changing the channel or increasing the volume increasing or decreasing the volume so you don't know what going inside how uh the remote passes the signal to the tv and how it works basically okay we don't know about the internal things uh and we don't care also so we just need to understand like whether while changing the channel it should be change the channel should be changed okay so this is what matters so in the same way we applied in the i mean same thing in our framework so i did little bit change in the framework guys uh offline to uh talk about this abstraction to implement this abstraction okay and we can achieve the abstraction in two ways one is uh interface and another way another way is abstract class so basically interface whatever methods inside the interface all will be abstract methods which doesn't have body we'll just define those methods and the implementation will be done in the sub classes whatever whoever extends uh sorry uh whoever implements this interface implements the interface similarly for abstract class but there is a slightly uh i mean different i mean abstract class is slightly different than interface we have we can have abstract methods and abstract non-abstract methods inside abstract class okay so as part of our framework i have implemented a interface so let me show you this is i have done little bit change offline so let me show you what change i have made what changes we have done so i have created a separate interface guys action interface this one and here i have created i have defined all the methods uh whatever present inside action class okay so here you can see scroll visibility of element click so these are all abstract methods we don't have body you can see here i have just declared the method and ended with semicolon so there is no body of all these methods so this is how you can define all the methods inside interface and later on what i have done is if you go to this action class i have extended the base class and implements the action interface so this is what little bit change i have made in the framework so we have implemented action interface and in this class in this action class i have implemented all the methods which are defined in inside this action interface so here you can see that we have written the body of this uh whatever methods we have defined inside action interface all are all are implemented over in this action class okay and those are overrated methods because we have this all these methods inside action interface so all these are overwritten methods over here we have implemented all the methods inside this action class and the question comes like how do we use all these methods inside our framework okay so let me show you if you go to this account creation page because we need these methods right this click method the find element method we have is displayed method so these are the different methods we have and we need them for user actions okay to perform the user actions and this is our page class so how do we use we can simply create the object of action class over here and using this action object we can call those methods here you can see action.click action.click like this so this is how you can use the interface abstraction in your framework and here you can see by seeing this action interface you can see the all the methods are defined over here we don't figure out like what what is going inside okay how it is implemented and what is for uh what is the behavior of this particular method we don't know right we don't care about the internal things we just care about the what we have defined inside this interface so what are the different advantages of abstraction so it helps to increase the security of an application or programs as only important details are provided to the user so for security point of view this is really important and the second thing is it reduces the complexity of viewing the things so it simplifies the things so you can easily identify like we have implemented we have defined all the methods inside interface and later it will be implemented by different classes as per the usage as per the requirement avoids do code duplication and increase reusability so here you can see we have written we have defined the method over here and this can be implemented whoever classes will be implemented this interface okay so we have written just we have given the definition over here and this will be implemented according to the usage by the different classes so no need to write the same method again and again we can just use this method and implement according to our usage in subclasses so this is about abstraction encapsulation so what do you mean by encapsulation so wrapping of the data and methods together as a single unit so that is encapsulation data is nothing but the variables and methods together methods uh is nothing but the uh the user action methods you can relate and there is there are two things over here the first thing is which we just talked about and the second thing is this is also called data hiding so i'll show you why we call it as data heading so let me talk about this one first how uh the data and methods binding together so this is user action let me open any [Music] other this fine so here you can see guys we have defined all the variables over here uh though these are the page objects so we have defined uh this is web element right so these are the different web elements in our page so nothing but the variables and we have corresponding methods user action method because we are going to perform actions on uh using these methods right using these variables so here we have create account method by which we are performing some actions here you can see we are entering the first name last name entering the password password so these are the different uh uh things which you are performing by using this user action method so this is how or they are apparent uh i mean interrelated with each other and the second thing is this is also called data headings why we call it as data heading because all the variables inside this method this page i have declared them as private okay so initially i did not do this guys because i want to explain uh in the as part of this particular video so i have declared them as private so this cannot be accessed outside of the class because that i have given the access modifier private okay to all these variables and these can be accessed using the public method so here you can see this this is i have declared this method as public so this can be used outside of the class so directly we cannot use these variables so that is part of data hiding yeah and there are getter and setter method guys uh so by this constructor we are initializing the web elements okay and this is public we are initializing the values of all these variables initializing those variables using the constructor and using this method this user defined method this create account method we are accessing the values okay so this is how you can do encapsulation we can implement in case encapsulation in our framework what are the different advantages of encapsulation so it refers to the building bundling of data with the methods that operate on the data so here you can see how we can encapsulates we have seen data methods methods and sorry data members and methods encapsulation is used to hide the values or state of structured data object inside a class preventing authorized parties direct access to them so since we have declared them as private so other outside of the class it cannot be accessed so that is part of data hiding so similarly we have the same thing for other page objects page classes here you can see i have declared them as private and we can access through the public method okay outside of the class so this is about encapsulation and i have given very good example in our this java tutorial guys if you navigate selenium for java and yeah here we have java oops concept so here clearly i have defined with the help of example now today i'm just relating uh how we have implemented in our framework polymorphism so poly means many and uh morphism means forms okay so the polymorphism means many forms so there are two types of polymorphism we have compiled time for polymorphism and runtime polymorphism compile time is uh static polymorphism as well and uh yeah it is also called early binding and we have run time polymorphism that is dynamic polymorphism and lead binding okay and there are there are a couple of examples of compile time and run time so compile time method overloading is the example of compil compile time polymorphism and runtime method overheading overriding is the example of runtime polymorphism yeah so what are the advantages of polymorphism so polymorphism allows us to perform a single action in different ways okay i'll show you the help of with the help of method overloading in our framework and it helps the programmer to reuse the codes classes once written tested and implemented can be reused as required saves a lot of time okay so let's talk about the method overloading first so if a class has multiple methods having same name but different in parameters it is known as method overloading and i have implemented that in our framework so let me show you if you remember that we have this login page class okay and here you can see we have couple of methods login method here login method and this is again login method but the purpose is little bit different guys about this login method the i mean the purpose is the same like logging into the application but uh we are going to use this login method in different way and this login method in a different place okay so in case let me open the application so i can show you better so if you remember we can directly purchase the product without login to the application initially right we can just search the product from here and let me just click on search we can without logging in right we have not logged into the application and directly we can search the product we can add to cart and we can proceed with the payment in this scenario what will happen what happens is when you add to cart and when you navigate further before putting the address before confirming the address you need to login into the application so let me show you this one [Music] this page navigation so here you can see so without logging in we can go from index page search result page add to cart page order page and then we have to login into the application okay so and that will return the object of address space so this method will will be used for that particular scenario and here you can see we have returning the object of address page and if you log in directly into the application if you click on that sign in and login into the application then you that will return the object of homepage class right here you can see the homepage object we are returning the homepage class object and yeah so this is method overloading guys we are using the same name same method name but the parameter should be different so here you can see these two parameter parameters are same but we have we are passing one more parameter we are just passing the object reference of home page over here and here address page over here so this is how we can differentiate two methods yeah so the order should be different the method the parameters should be different the order should be different or if they have the same orders then the the written type should be different oh i mean the method return type should be different so here you can see this is homepage and this is address page so this is how we can implement the method overloading in the framework as per your requirements okay method overriding so we have already discussed about the method or overwriting at the time of explaining the interface so whatever methods we have defined inside the interface those will be overridden in this side inside this action class so this is about polymorphism guys and let me so i think we are done about the uh different oops concept and there are few more things we have yeah this keyword so this keyword we have used in our framework so let me show you any page account creation page so this class we have used and there are different usage of this keyword okay this to initialize the current class object okay and if you want to know about the different uh usage of this keyword so you can refer this link okay java oops concept over here and this keyword similarly for super keyword we have different uh we have different usage of super keyword here we have written i have created a post on this super keyword so uh i have not done the super implementation in our framework super keyword implementation but you can just go through this article and you can understand about the super keyword here i have given the example as well in this particular video yeah so that is done yeah so as part of our framework creation guys we have uh created in different phases so let me show you yeah so we have divided them into different parts like development phase execution phase and continuous integration fees so these are the different phases of our framework now let's talk about the next thing so let's recap like what are the things we have done as part of our framework uh what are the steps we have taken to create the framework so first of all we have created the maven project moment project and uh we have updated the pom.xml okay so for the different jar files to get the different jar files to download different jar files based on different dependencies so we have used different dependencies to use those jar files we have created the page objects using page factory methods we have created different ph classes we have created the base class we have created the base class to read the common values from properties file or you can see the constant values from properties file we have created the properties file we have created the base basic test case and later on we have you know implemented all other components we have implemented the log 4g logs in our framework we have parameterized the test using data driven testing we run our test cases on desired browser using testng.xml or pom.xml later on we have seen the continuous integration part we have pushed the changes to github and later on we have integrated the project with jenkins and we have improvise on our project by implementing the collection so this is the maintenance part you can do uh research and you can do some implementation in your framework so this is how you can relate by looking at whatever the steps we have taken to create the framework over last few sessions okay and these are some tips guys to create the framework from scratch so you should have the proper programming knowledge okay so you should be good at the oops concept you are using object-oriented programming especially for java so you should have good knowledge on programming language concept write page classes for all the pages so let's say if you have 20 pages in your application so you should write only 20 page objects okay ph classes and test classes may be different maybe differ based on the requirements so let's say if you have 10 20 page classes so it's not necessary that you should write all 20 test cases corresponding to those page classes so it may be different based on your requirements write validations assertion in the test class only so whatever uh assertions you which you are going to provide which you are going to validate in your application that should be written inside the test class only write the user actions whatever user actions you are which you are going to perform that should be inside the page class only use proper waiting mechanism in page class synchronization that should be implemented in as part of the page class only usage of proper naming convention of your framework so let me show you so here you can see this is the project name and we have this the package name so here you can see this is this starts with lowercase and this is the class action.java so it starts with uppercase okay similarly we have this interface it starts with the uppercase and methods inside any class should have which starts with lowercase so you should always follow the follow good naming convention for your framework always add the commands when you create the new class so let me give an example of this base class so here you can see i have written very good comment over here base class is used to load the config file and initialize the web driver so basically if anyone looks uh into this base class so he can easily understand like what it does what is the purpose of this base class and you can provide the comments like this on your whatever you are creating the the methods or whatever changes which which you are going to make in your framework in your class yeah all the test classes should be independent as much as possible so all the test cases should be independent guys so that there should not be any dependency of of each other okay as much as possible because in some scenarios you may need to you know relate one case test case to another test case so in that case you can use depends on attribute as part of test ng but try maximum as much as possible that all the test cases should be independent yeah so i think we are done guys and as part of next series i am going to provide the answers of selenium questions which i have written on my blog so few parts is still remaining so let me show you selenium questions and answer so i have covered till here uh selenium questions part five selenium exceptions and remaining part i'm going to cover first and later on we'll start with the other series like cucumber bdd api testing database testing devops etc so this is what i have planned so far so first i'll cover the all these selenium questions which are pending and later on we'll cover other things yeah so i think we are done so this framework is pretty much ready guys and you can use yeah so this is the github my github url and i'll provide the github url uh with the in the description box of this video so you can refer this framework you can clone this project this framework and you can you can practice it okay yeah so everything is covered so guys if you like this video then please share among your friends and uh if you're new to my channel then please subscribe this channel and click the bell icon to get the notification for upcoming videos thank you so much and have a nice day bye
Info
Channel: Automation Testing Insider
Views: 3,960
Rating: undefined out of 5
Keywords: Selenium Framework, End to end Selenium Framework, Automation Mini Project, E-commerce Automation mini project, TestNG, Java, Selenium, Jenkins, Maven, Best Selenium Framework, Complete Selenium framework, Naveen Automation labs, Selenium Hybrid Framework Part-1 | e-Banking Automation Mini Project, SDET-QA Automation techie, Mukesh Otwani Selenium, Automation Testing Insider, automationtestinginsider, Design selenium automation framework from scratch, selenium hybrid framework
Id: 2yDLEgSTG_c
Channel Id: undefined
Length: 505min 26sec (30326 seconds)
Published: Thu Nov 11 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.