5. Reportportal- Integration with Jenkins

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone this is the fifth video of our report portal series and today we are going to discuss that how we can execute the same automation framework which we have created in our fourth video where we integrated report portal with the Cucumber uh based framework right so we are going to take that as a base uh and then we are going to perform the operation on that with the help of jenin execution so what we are going to do is uh first you remember there was a report portal. properties file uh we had kept four attributes in that uh in our fourth video uh those attributes were like first uh where is your uh host like for report portal that is you need to mention it like rp. endpoint here then the project name which uh have been created in the report portal right now the two attributes which I have removed is API key uh that token that we were passing uh right and apart from that uh the other attribute is uh launch name with what launch name you want to create uh the launches within the report portal now why I have removed these two properties specifically and why I haven't removed this uh above two which you can see here so these are like kind of generic right these are kind of constant thing uh we do not have any confidential data here as part of uh like uh you can say as part of of code of practice we shall not uh include any kind of Secret in our source code management so that's why API key though it would be constant for the longer duration of the time I have removed it from here right so what we are going to do is we are going to configure it as a Jenkin secret and then we are going to use it how let me uh let me show you that so first I'll go to readme file again and we'll see what are the things that we going to do so we are going to remove API key uh launch name from the report portal door properties which I have already done then in jenin configure a credentials using the API key whatever the API key uh that we will be having we will put it in Jenkins as a secret now we will create a stage this stage will be responsible for appending this report portal. properties file with whatever properties that we want to includ INE in our uh launch for example uh two mandatory thing is API key that we need to pass or uu ID right then uh the second thing is uh the launch name that we need to pass right these two are mandatory attributes apart from that there are some optional attribute which you can have as per uh your requirement because in you will be creating the dashboard you will need some information regarding maybe what kind of environment you are executing on right you can create different dashboard board on basis of different environments so those things can be passed as a description as a attributes so there are various other options which we will discuss in our future videos but as of now we'll pass one more attribute description which will be on basis of uh build number what is the build number of your Jenkins uh execution right then the entire URL of your uh build right which got executed that will pass as your description and that description will be linked to your launch name in report portal right so let me uh now uh go to the Jenkins and let me first show you setup here so this is a report portal which I have again uh I have kept it I have like kind of restarted all the containers which were there right and this is running on 8080 by default uh Jenkins also executes on 8080 if you are kind of doing this practice on your local uh but if it is on different machines then it is all right but if it is on same machine then both of them uh cannot run on 8080 of course so you need to configure something maybe you can change your junin to some other Port so that's what I have done now talking about the setup what I have done here is I have created a basic folder first right uh this folder is a junkins demo folder here I will configure my credentials uh that credential that API key that I was talking about right so for doing that what we need to do is uh yeah you need to make sure like uh I think it is by default there but let me let me show you in case you are setting up your Jenkins the prerequisite is uh you need to have Maven plug-in you need to have credentials plugin installed so let me go to Jenkins and manage Jenkins M PL uh what you need to do is I'll show you regarding that so if let me show you before going to uh the credential plugin let me show you the thing that I have to do for May one so you can you can ignore this may configuration what I had to do is like I have made a configuration here this configuration is like I have to pass uh the name of the May tool here like whatever I will be using in my stage of uh junkins where I will be executing and then I have men and a version which can be installed it will be one time activity uh if if you are running it for very first time right then the second thing is uh the credential plugin it was not uh like there for me but in most of the cases I think it will be by default there uh but still if you are not able to see the credential within your folder you can just quickly check if the credentials plugin is installed already or not if it is not you can install it and do a restart of t credentials yeah you can see it is already here right credentials it is installed so now going back uh to the folder which I had created now in this folder under credentials uh this is the credential that I have created so what you can do is you can just go here right and you can maybe let's say you you are here you can click on global right and you can say add credential and you need to add a secret key uh so this will be a secret text and here you can keep Global Jenkins node itself and here you can pass your secret whatever the API key will be there from the report portal here API key will be coming and here you will be having the ID this ID is important uh you need to use it within your jenin stage so whatever the ID you will be keeping you need to keep a track back of that right uh then going back to credential so this is the credential that I have created RP creds right and if I go back now this was the second thing that I that we had to do we had to configure a secret now the third thing is uh the jenin stage that we need so that is like let me show my Jenkins file so I have created a very basic junkins file here I haven't passed much of the uh build parameters in the junkins job as well so I'll first show you the jenin file that I have created right so here I have define environment so this is uh for like that MAV install that MAV setup that I was showing you right this is the name that I was talking about that whatever the name you will be giving to your m within the Tool uh setup that needs to be passed here right and then this is the credential that I have used uh this is the thing that I was saying that you need to remember the name of the ID that you will be setting up within the credentials part so this will go here now this is a basic stage for getting the uh getting the code from the bit bucket we are just having a checkout stage here now this is the stage where the thing that I was talking about where we will be appending our report portal. property file right so what I have done here is like this is the credential that I have taken right environment dot the credential name I have named it as a token variable name is tokens and this is just a way to define uh you can say multi-line argument string argument in groovy so here I have initialized it with the Tri uh triple code right and then here we are having our API key rp. API key and we are passing that value which will be stored in this token variable here now the launch name uh I have given a launch name with a like prefix like something Jenkins unor demo and then here I'm using my job base name right and then this is the description part so this description it will be linked to your report uh report portal launch whenever a launch will be executed this description you will be able to see on the same launch itself sorry yeah so after this this is the file path where our report portal property file is placed right and this is the existing content we are just reading this file and taking the existing content and here we are writing into the file what we are writing we have taken the file path right and then the text text text will be existing content Plus sln for the new line plus the content that we have here and upend true means we need to append the data then uh we have this uh this is just for the printing the logs to the console like whatever will be the updated report portal. property file we'll just print it into the console to so it as part of our demo of course once the things are finalized you can remove this and this is the build stage where our execution will take place right now this is the setup in the Jenkins file and now let me go to the Jenkins again and I'll show you the pipeline that I have created so under junus demo this is the pipeline that I have created and again it has four test out of which one is failing as I was showing you in the previous demo about like there were four test cases out of which three were passing one was failing and we just wanted to see the auto analysis part right so the same setup is here now uh how I have configured it let me show you it is very basic configuration I have uh taken the job type as pipeline right and just passed the uh bit bucket uh sorry GitHub URL where my Jenkins file is placed like this is my GitHub repo where I have like this master branch and here we have our Jenkin file right so under this I have just given the same configuration everything else I haven't taken as part of this demo because our main purpose is just to see the report portal linkage with Jenkins so here you can see right it is a public repo I haven't created any credentials and here we have the branch so let me go again to my Pipeline and what I'm going to do now is I'm going to first Let me refresh it report portal because I haven't worked on it since quite a bit now uh so I just wanted to refresh it once so that it will not take time later so yeah it will load automatically now what I'll do is I'll just create a build we do not have any build parameter so a build will be started here so first uh here we'll be having a checkout stage here we are setting up the report portal and here we are just making a build of course you can have post acction as well where you want to uh configure your reportings maybe you need allow report extent report uh or any other report but as part of this demo I have kept it simple uh we just want to see uh how we can use Jenkins uh to enable us to have a report portal launch so I'll go to console as well let me go to the console first and we'll just see what does the report portal do properties is having at this moment so here you can see so this is the log that we have put as part of Eco right so here we have our endpoint project and API Keys here right it is automatically being uh encrypted here you can see then the launch name so launch name I have mentioned it like uh Jenkins demo and then this was the I think job name yeah I think yeah job base name so that's what we have taken so whatever your job base name will be there you can have it here in case you have environmental variables maybe sit uat you can use them as well in case you have build parameter you can just uh just kind of append it here right and now let's see if the Des are executed or not so for that my system is uh a bit slow at this moment uh due to First Jenkins is there then report portal is there and a lot of containers are executing and and I'm recording this video as well so yeah so here we can see we have like four tests uh this is the first one second one third one and the fourth one which is failing as expected and apart from that if we'll go down here we can see that yeah the there is failure because of that one test case which got failed now I'll go to report portal so here in the report portal now let let me make a refresh right and here we can see uh we have Auto analysis going on but the main thing is like we can see uh this is like Jenkins demo and the job name that we have created and then here we have like you can see the description that we have passed like let me quickly show you the same description which we could see in the logs as well and here we have the description as job URL and then the build number job URL is there and then the build number is there right so let me make a refresh here okay the auto analysis is also completed so this is how you can trigger the report portal related y Kumba framework with the help of Jenkins you just need to append your report portal. properties file with the help of whatever information you want to include in your launch right of course there will be mandatory attributes like API key and then the launch name apart from that there are various other optional parameters as well so that's it for this demo guys and in future I'll be coming up with the more advanced uh functionalities about report portal and how we can achieve it like some of them are how to handle the launch in case there is like fail test cases you need to make a retry in case of parallel execution on how to create a single launch that kind of thing we will be also covering right and in case you're liking the content that I'm making please do like share and do subscribe see you in the next video [Music]
Info
Channel: Test Automation with Atul Sharma
Views: 160
Rating: undefined out of 5
Keywords: reportportal, jenkins, reportportalusingjenkiins, cicd, SDET, sdet, QA techs, QA learning, sdet learning, trending in test automation, AI for SDET
Id: A8zCBgF6o1c
Channel Id: undefined
Length: 18min 19sec (1099 seconds)
Published: Sat Jun 22 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.