How to Run Selenium tests code in Azure DevOps CI pipeline | Selenium With Azure

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so hey guys welcome back so in this lecture I am going to show how you can build the selenium code which is available in the GitHub repository in your case you can place the code in the bit bucket on the AO repos it's the same thing so the question is we want to pull the code from The Source Cod management tool and we want to build using the Azor devops CI pipelines okay so first we need the code in the CI pipelines then we will build using the M tool this is our M project and this is my GitHub account and this is our project so bdd test report is the our project and in this project we have the our source code is there so SRC folder is there so let me explain the folder structure SRC folder is there in this we have the Mayan Java and the feature files and this is our Google file so so this is the simple code in your case it can be the big feature files okay and you will have the step definition file also there so you will build the all the complete test suit or the complete um the the feature files or the folder in your case so that is the same thing these are the step definitions and we have we need to provide the part into this step Runner file so test run folder is there and this my test run file is there so I have provided the path of the feature file print google. feature and and there is the plugin report. Json and this is the glue code so like that you can provide the the path of the complete test suit folder okay in your case if you are going to build the complete automation code through thej devops so this is our project now uh let me make you understand that why what the URL we are having currently so we will go to the step definition file and we will have our Java file okay so here you will notice that we are having the driver. kit this is the google.com Okay this is the hardcoded URL we are having here so suppose this is the one environment environment one is this one so we are going to trigger the automation code on this environment and this we will trigger through the AO devop CI pipeline okay in your case the environment can be your application URL like stage to application.com d. application.com uat 3. application.com so whatever application URL that is the testing environment you have you are providing the URL here and you're triggering your automation code so what we notice that at a time we can trigger only the one URL okay but what if I have the one more environment like the ww. ken.com ww. another.com okay so we have the another URL so in your in the real time scenario in the software companies we have the uat environment and we also have the test environment and in that case if I want to run my automation script in the multiple environments then how can I achieve this one so that we will understand video Wise Video so as of now we will pull this code and we will try to build this code then we will do some changes and how to maintain the multiple environments with the same selenium code without changing any URL at the run time okay it will be the static and it will choose the environment name at the run time on the different different machines okay so this is the code I'm going to pull so let's switch to the our d. azure.com so this is our application dev. a.com okay in this applications I am on the project this is the test as your project is there under this project you can see the pipelines are there so we'll click on the pipelines and now we want to create some build pipeline okay so for that you can select on the pipeline and here you can see the new pipeline so just click on the new Pipeline and here you need to select the use the classic editor we will use the classic editor as of now so so let's choose the classic editor now here you need to select the source code management tool so as of now our code in the git repository github.com so we'll select the GitHub and now here we need to select the repository so which repository we want to select here so load all the repository so we don't have the repository name because we want to create one authorization connections so if I select the authorization connection so I already have the authorization connection GitHub connection 8 and if I go now you can see my GitHub repository are showing here but in your case if you want to create a new connections then how you can create that one I'll quickly show you that go to the change create the new service connection so after that it will say the authorize with the GitHub personal access token so you need to select this one now you need the token so the token GitHub personal access token for that you can go to the GitHub account and go to uh the settings you can go to the settings here and here just scroll down and you can see the developer settings is there so under the developer settings you can see the personal access token is there so you can see the token classic so you need to select this option and now you can see the generate a new token so click on this one and you can see the generate the new token so for General use I will click on the personal token so the token will expire in the 30 days so I want want this token so my u a your token so this is the note and it will expire in the 30 days I need for the repositories okay I I need for the admin organizations okay like that now generate the token okay when you click on generate the token you can see the temporary token is there you just copy this token come to dev. a.com pipelines and enter the token here and authorize okay once it's done now you can see you have the GitHub connection now click on this three dots at this time you will see all the repositor so you can select the bdd test report because our code in this repository bdd test report and I will select this one and now I can see I need to build the master Branch because we have only the one branch here so if I go to my account again where my source code is there so you need to select the correct Branch also so as of now I have my code into the master Branch this is for the demo purpose in your case it will be your branch so you can drop down and you can check where your code is in in which branch your code is placed so you can select that Branch so as of now this is the master Branch so I selected the master branch and now click on the continue okay when click on the continue you just scroll down and and then you will see the empty pipeline you need the empty pipeline okay so now you have the empty pipeline is there so now the pipeline the build pipeline so you just select the pipeline name so we will select the pipeline name aure with selenium okay now the agent pool so agent pool where we are running our automation code so as of now I'm going to select the default pool because in the default pool I have configured my local system Windows machine as a agent machine on this I have I am running my agent so you can watch another video how to trigger the agent and now I run do CMD this is the my agent which I have downloaded and then I run this agent on my local machine so my on my local machine the agent is running okay now I select the agent pull as a default okay this setting is done now coming to the source code now source code setting is already done okay this one is done now here is the agent job one so here you need to select one job so what we want to do this is our Maven project you can see the pom.xml file is there so I want to build this code with the MAV command so what I will do I will go to the agent job I will click on this plus sign and here in search box you just type the Mayan okay and after that you can see the May test and deploy with the Apache Mayan so you just add this one now click on this one now M pom.xml file pom.xml file will be the same now the package so you just select the clean verify this is the goal we we need to enter here and M pom do file options now here you can see the test result files are there and this code coverage none now we have added the MAV job here now once our bill of the selenium code is done I want to publish the artifact so for that what I will do I will again click on this plus sign and here I will type the publish because I want to add the publish job here so I can see the publish pipeline artifact is there so you can see the publish pipeline artifact effect is there so you need to add this one so I added this one click on this one now you need to update this one so file and directory path will be the same by default pipeline. workpace and now you select the artifact name so you can select the artifact name as your selenium okay because this training is for the selenium code run on the so I select the a selenium and your pipeline artifact location will be the Azure pipeline so you keep as it is azure pipelines okay this setting will be the same you just make sure you need to place here the pipeline or directory part is the pipeline do workpace all right I will explain this pipeline working space is where once the building is done so now uh this is done now you select the task version is one star or you can okay you selected this one the task verion is there now everything is done now your pipeline is ready now I want to execute this pipeline so for that just save and Quee when you save and Quee you can see the agent pull is there so you need to select the default pull okay on which your agent is running so in your case if your agent is running on the Linux machine you need to select the Linux machine you need to configure the agents here okay as of now we are using the windows local machine as a agent so so I will select this one and I need the master branch and after that I need to save and run okay now let's see the agent job is running now if I see on my console you can see the running job agent job one so the job is already trigger okay because my local system is a agent machine and on which I have configured all the May one also so it will pick the May one from my machine so if you are going to prepare your Linux machine there you need to install the May one GitHub everything you have to set up or the Linux machine and then only you can run the M command so just consider this machine is your machine okay Windows machine on which you are running your selenium code so this is the CI pipeline what it will do it will run this code okay first it will check out the code from the GitHub repository on the local space on space and then will run the M command to build this code okay and we'll see the google.com will be launched when it will run the mean.com okay so check out is successfully done now if you go to the checkout you can see where it go check out is done so here initiated the MP G reposit see users training Azure so this is the my agent folder in this hyper work /3/ s in this one it is going to trigger okay so now let me go to this space and then I will explain this space while it's to check out the code so for that uh we'll go to our folder now this is our folder so this is our agent folder you can see this is the same agent folder in this folder I have the hyper work is there and then the folder number three is there and in the folder number three you need to go to the S okay so I will go to the S and here I can see dogit is there so this is my checkout code now the Mayan will build this code because we have the pom.xml file is there okay so now Mayan is running so first it will download all the dependencies and then it will start running the pom.xml file now let's see here you can see the M Apache M version 3.8.6 pin because if you don't have the M on your systems you cannot run the pom.xml file or even the M commands you cannot run so now you can see the Google is open okay so the command is executed now it will access the google.com you can see the google.com it access and then it close the browser okay so this we have tested we executed the one statement okay or it trigger the browser and then it will do the executions because we have the very small piece of the automation script as of now so it just launch the browser and it close the browser so so one test is executed successfully now publish the pipeline artifact okay so this is the build pipeline artifact just publish so build number 1462 so our build number is 14 1462 is the build number okay just publish the celium code build artifact and where hypon work slash3 so now you can see this is the Hy work sl3 so this is the build it took and it's configure this [Music] one all right so this is the checkout code and it just build this code so now let's see the code is successfully build or not so now you can see the agent job status is success and here you can see the one related artifact so it's just publish the one artifact folder so you can see the selenium this is the artifact name and this is the artifact folder now you can see all project is there
Info
Channel: Viren Automation Testing
Views: 1,690
Rating: undefined out of 5
Keywords: azure devops, run selenium test on ms azure pipeline, how to run tests in azure devops, how to run automated tests in azure devops, run automated tests in azure devops, how to launch chrome browser in azure devops, create pipeline in azure devops, build selenium test in azure, run tests in azure devops, how to launch a browser in selenium, run tests in azure, run selenium tests in azure devops pipeline, test report in azure devops, azure devops run tests, viren automation testing
Id: HTBfxNYWUUg
Channel Id: undefined
Length: 16min 2sec (962 seconds)
Published: Sat Dec 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.