Selenium WebDriver | Part75 |Extent Report in Jenkins |Send email with Attachment | Periodic Job Run
Aug 16, 2023
Selenium WebDriver | Part75 |Extent Report in Jenkins |Send email with Attachment | Periodic Job Run
In this video, we will discuss about following things. 1. How to generate HTML report in Jenkins 2. How to generate Extent report in Jenkins 3. How to send email 4. How to send email with an attachment 5. How to run job periodically in Jenkins SUBSCRIBE: / @automationtestinginsider About this channel: This channel is dedicated to Software Testing, Automation Testing, Devops, Agile and TestNG, Maven, Jenkins, Git, Github, RPA, Agile, Devops, Database, Domain and many more. Please Subscribe this channel and press bell icon to get some interesting topics on Java and Selenium and other tools. / @automationtestinginsider Please check out my blog here:https://www.automationtestinginsider.com Follow Facebook Pagehttps://www.facebook.com/hverma22/ Follow me on instagramhttps://www.instagram.com/hitendrahita/
Content
0.5 -> hello friends welcome back to automation
testing saturd or comm the selenium
4.77 -> webdriver part 75 and today I'm going to
talk about the third part of continuous
9.45 -> integration in Jenkins and this is the
last part of Jenkins as well so let me
15.179 -> show you what we are going to discuss
today so we'll talk about scenario for
18.119 -> today where we will see the integration
of maven project Marvin github project
22.289 -> with Jenkins and I will show you how we
can publish destiny report how we can
26.73 -> publish extend report and I will show
you how we can send the email through
30.599 -> Jenkins or we can send the email within
attachment and how radically we can run
36.36 -> our job in Jenkins okay
so we'll talk about all these today in
41.73 -> scenario 4 and before that we have
discussed seen ru 1 2 3 in the first
48.42 -> video we talked about a simple Java
project simple project how we can
51.84 -> integrate with Jenkins in how we can run
the project using a batch file ok in the
58.44 -> next video we talked about how we can
integrate in scenario 2 in the second
62.609 -> video or we can integrate maven project
into Jenkins ok and in the in the
68.31 -> scenario 3 we talked about how we can
integrate Marvin github project in
72.78 -> Jenkins and how we can set the
parameters in Jenkins and how we can
76.77 -> pass the parameters so this is what we
have seen so far scenario 1 2 3 now
82.259 -> we'll concentrate scenario for today
okay so let me start my Jenkins service
87.299 -> first so I will go to command prompt and
I will type command Java
93.68 -> - jar and I will drag my bar file over
here and if you remember we are running
105.479 -> our Jenkins on port 80 0 8 2 2 simply
press ENTER now so it will take some
114.45 -> time and then server will start in guys
if you remember earlier we have created
120.6 -> a project called extend demo ok when we
discussed about extend topic next entry
129.119 -> pod topic so this is the existing
project I am going to take
134.2 -> we'll integrate in Jenkins today so let
me have a look and this project is
145.81 -> already available in github here you can
see the cylindrical cylinder cylinder
154.12 -> mark okay now here you can see Jenkins
is fully appear running now simply go to
163.96 -> browser and type localhost at 0 82 so
simply I need to just login in Jenkins
187.38 -> click on sign in and I will sign in to
my github account as well
214.819 -> yes last three times I mean last two
videos we have created three projects
220.129 -> demo 2 demo 3 and simple project sample
project ok and this is my editor and
231.89 -> extend report let me have a look yeah
this is the the project extend demo so
244.17 -> this is the same project which we have
in Eclipse so this is the project ok and
249.53 -> to perform all these activities we need
to configure some of the plugins ok I
256.47 -> mean some of these settings we have to
do in in our Jenkins ok so first of all
263.19 -> what I will do I will create a project
what you can say a job so what I will do
268.86 -> I'll give demo 3 this time and I will
select maven project click on OK demo 3
278.28 -> is already exist I will keep demo 4 and
select maven project click on OK let's
292.65 -> set up everything whatever we have test
in the report extent report so just
298.38 -> taking time so here I can give some
description this is this is demo
302.78 -> All the required plugins are already installed in the last video. please refer previous video
310.099 -> coming down and we are getting source
code management will give github because
315.33 -> we are getting the project from github
so I'll give the github URL from here so
324.81 -> this is the github URL and these the
credentials of my github account so this
333.84 -> is done
next is come to here palm dot XML so
341.55 -> instead of only pound-for-pound dot XML
we have to provide from here let me tell
349.41 -> you just click on this so here we have
one dot XML file ok so we have to take
362 -> from here extend demo these the this is
the name of repository and from here you
368.22 -> have to take so this is the the main
project we have and inside that we have
373.65 -> formed or Texan also you have to take
this like this and forward slash and
380.27 -> goals you know goals and options I will
give clean install last time we have
389.01 -> done and this project since we do not
have any parameters let me show you the
394.11 -> beasts class so here we don't have any
parameters over here ok so directly we
402.33 -> are running our tests on Chrome browser
only and whenever getting to you this
406.38 -> URL you simply provide this clean
install last time we have given
410.729 -> parameters over here passing the
parameters ok so simply you just keep
415.169 -> clean install command now so forth it is
then we'll add a post build action ok so
425.85 -> here when you click over here you will
see for Bliss publish HTML reports ok
432.44 -> publish test in G results as well so
let's configure test in G results
436.59 -> so we'll keep this as as it is so it
will peek automatically and to publish
444.03 -> stable reports we have this plug-in if
you remember last time we have installed
449.28 -> all the plugins I think I have not
listed down over here so last time if
454.56 -> you see the last video we have installed
all the plugins so already we have I
459.78 -> mean installed all the plugins so that's
why I am able to say this publish HTML
464.01 -> report so I'll click over here
468.74 -> second happened this estimate sorry we
have to go to advance these the estimate
486.78 -> reports publish estimate reports okay so
here I need to give the path of my
494.51 -> extent report so takes test output and
here we have extent report so till here
501.27 -> we have to give the path from extent
demo so that is the root directory so
507.45 -> here we need to just copy like this okay
and here we have to give the the file
512.7 -> name so my report is my repo dot HTML so
simply I'll give my report dot HTML okay
521.88 -> so this is the file extension my report
dot HTML and the report title you can
528.78 -> give extent report at strength report
sorry report is already there extent
541.77 -> report so this is done and the test ng
result is also done what else remaining
549.57 -> now simply click on apply and save so we
have done so far test in C report in
558.51 -> extent report now we have to set for
email so how to set so first of all we
565.11 -> have to set the system level settings
okay so just click on this rectangle
571.62 -> triangle okay and here we have many
Jenkins and we have configure system so
577.47 -> just click on that
585.33 -> we have to set the email configuration
for admin user and then at project level
592.36 -> we have to set it build level the job
level so what is taking time guys so
598.81 -> yeah this is the configured setting I
mean configuration and system admin
608.47 -> email address will give we can configure
my name or here I can give like it's the
613.96 -> end for here the system admin email
address and we'll get one plug-in over
622.84 -> here all these are not required here
extended email notification here you can
628.18 -> see extended email notification so here
we have to set the SMTP server so I am
634.03 -> going to use Gmail so simply I will give
smtp.gmail.com so this is the SMTP
645.85 -> server for Gmail and I'll click on
advanced and we have to click on these
656.08 -> use SMTP authentication and here we have
to provide the username so their admin
661.39 -> user email ID okay in the 122 1285
gmail.com this is my gmail ID so make
672.52 -> sure everything is correct okay and we
have to provide the password and simply
684.94 -> select this use SSL and the port SMTP
port for Gmail is 465 so I think this is
697.18 -> done SMTP server anything government
went into it everything is fine this is
705.28 -> not required and here we can set the
this is the what it can say body of the
712.45 -> email so here we can set the default
contained so I'll say like
717.22 -> I team please find the automation
automation report below please find the
731.31 -> automation report simply let's write
like this and I will give thanks thank
740.199 -> you and I'll give my name over here and
this will give the project name and the
747.16 -> build number and the build status
whether it is field pass or whatever and
751.98 -> what I will do what is the next we have
to set this one as well the same
759.91 -> settings which we have done so
smtp.gmail.com and we need to just check
769.629 -> this one simply copy from previous
setting and password as well and to the
783.37 -> password to use SSL SMT SMTP port is 465
this is not required one more thing I
794.439 -> forgot to add a default email suffix we
can say like Gmail at 3:00 at gmail.com
804.04 -> I think everything is fine now here also
you add gmail.com
816.059 -> at gmail.com everything is done now
let's test this whether it is working or
821.199 -> not so we have this test configuration
by sending a test email so I will check
826 -> this one and I'll put another gmail
account okay so I have another Gmail so
834.16 -> let me try to test with this one whether
we're sending the email or not so test
841.149 -> configuration click on that so here you
can see the email was successfully sent
849.6 -> already I have logged
in with my email so here you can see
855.06 -> this is I think we should receive here
yeah here you can see test email one so
863.47 -> this is how you can test the
configuration so it is perfectly fine
866.709 -> I'll click on apply and save it so the
email configuration is fine
876.25 -> eight system level now we use our
project right so demo 4 so just click on
883.81 -> that and again go to configure we have
to set the configuration at job level as
891.25 -> well now let's do one thing not here at
post will action again choose this
905.649 -> editable email notification so just
select that and here we'll write
915.69 -> recipient address so 10 over 120 to
editor at gmail.com the sake in Gmail my
922.72 -> gmail address okay so I will put it over
here
925.149 -> he tends over my 22 editor gmail.com and
all these are not required and here we
932.11 -> need to click on advanced settings and
if you go come below add trigger we have
941.649 -> to select you can click cancel over here
and this is also not required add
949.87 -> trigger so we'll select always always
and developer is not required click on
957.64 -> advanced and here I'll put recipient
again and what I'll give this content is
970.75 -> fine now we are going to attach we can
give the attachment over here so simply
976.269 -> I will give the attachment of my extent
report so what L give
984.04 -> yeah we'll copy from here I'll give the
attachment like this and my deport dot
993.79 -> HTML okay so these the extent report my
report dot HTML and I will select attach
1002.97 -> build log as well once again yeah attach
build log as well so it will attach
1008.91 -> along with the extent report so this is
done now I will click on apply and save
1018.23 -> now let me just check the configuration
again at project I mean job level so
1024.69 -> this is configure we click on that so
this my github URL this is fine and this
1036.9 -> is the pond dot XML so it will copy the
bound wrote XML I mean it will read the
1042.51 -> palm dot XML from this root directory is
the project directory
1046.709 -> Bridget folder and inside that we have
pump dot XML so simply I have given
1051.59 -> extend demo slash form dot XML and this
my extent report directory extent report
1060.81 -> inside that we have this file my report
dot HTML and this will be this is for
1066.66 -> testing G results and these for email
given the recipient address over here
1072.75 -> and yeah this is then advanced settings
we have this recipient over here as well
1080.4 -> and this is the attachment so everything
is done guys so I'll click apply and
1085.83 -> save now we can run our bill so let me
build it build now we'll see whether it
1094.11 -> is working fine or not I'll go to
console so it will pick the project from
1103.11 -> github here you can see github.com
extend demo'd report demo this is my
1108.39 -> opposite now so far it is looking good
let's have a look whether it is working
1115.77 -> or not
1119.91 -> now our command is getting executed
clean install you can see here the movin
1129.04 -> process started now
the tastes are started okay the
1146.62 -> execution starts here you can see
chromedriver was successfully you
1151.93 -> started successfully so these four I
think we have three test cases in this
1157.36 -> project so prefer that project
previously and using github also I'll
1164.56 -> provide the link in the description box
of this video and I will write post also
1168.82 -> probably when I publish this video at
that time I'll write the blog as well on
1174.01 -> these a Jenkins so you can get the
report from there as well I mean the
1180.88 -> project so something is wrong that is
not working so probably maybe one or two
1189.73 -> pieces will be failed so that is fine
that were on main target is to run the
1197.17 -> project in Jenkins and generate all the
reports so here you can see we have
1203.53 -> three test cases one failure errors is
zero so everything is fine let's see
1209.65 -> whether build is success the
configuration and everything is correct
1214.6 -> guys so that's why we got this build
success and it is sending the email as
1218.65 -> well here you can see collecting the
data n finished an unstable the build is
1225.22 -> unstable unstable okay now what we are
going to do yeah will we can see the
1232.09 -> results now so let's have a look at the
email whether we get the email or not so
1241.39 -> this is the recipient email so here you
can see guys the beautiful report we got
1246.1 -> I mean the email like higher team which
we have given at system level right
1250.85 -> please find the automation report and
demo for this is the project named Emma
1255.44 -> for build one and that is unstable
because we got one failed test case
1261.71 -> right so that's why it is unstable and
thank you with Indra my name and here
1266.93 -> you can see my report dot HTML and build
or build log is also attached now we'll
1272.72 -> see the report here back to project so
here we have let's have a look the test
1281.48 -> in see results first so if we click once
again click on this build one so this is
1293.78 -> how you can see the test in G results so
this is what the exit is there's an
1300.56 -> error we got expected orange HRM but we
found this one I think we are not able
1306.8 -> to login into the application right now
it is down so that's why we go out I'm
1311.9 -> in different Titan so that's fine we got
the field is that's fine
1318.23 -> so this is how you can see the testing
the results I'm more interested towards
1324.4 -> extent report ok so just click on this
extent report now here you can see it is
1331.03 -> coming in this format guys so this is
not at all readable so how to resolve
1336.71 -> this issue right so what you can do here
is let me do one thing let me stop there
1347.84 -> Jenkins for now and what I'll do I have
come and I have written over here some
1355.1 -> commands so if you start the Jenkins
with this command then they will not
1361.67 -> face the problem with extant report so
let's do that so what I will do I'll
1367.82 -> create one file over here Jenkins and
1379.789 -> and simply I'll put the entire command
over here but we need to change the path
1389.359 -> of these Jenkins for so these simple
command guys you have this Java - D and
1396.499 -> this is the command we have to write
over here okay and this Hudson model
1402.769 -> command you have to write over here and
- - jar and then this is the path of R
1409.309 -> so let me get the char file press shift
and we have copy as path just navigate
1424.279 -> to this file like this put it over here
and we are running Jenkins on 8:08 - and
1435.22 -> simply click save as desktop and dot
batch file ok dot dat so click on save
1449.049 -> so here we'll see this Jenkins file is
getting created over here and what is
1455.749 -> this simply close this one now we can
start the server from here this batch
1459.889 -> file so in case we can start our Jenkins
from here so just click on this where it
1466.009 -> is not getting
1473.59 -> something is wrong
1489.52 -> sir we have double quotes over here we
have to remove one quotation click on
1499.19 -> save I think it should be fine now let
me run it again now here you can see it
1505.7 -> is running now so let's wait until it
gets up and running just add all plugins
1524.95 -> so I will provide this command in the in
my block so you can refer this
1550.28 -> starting the Jenkins is still now here
you can see Jenkins is fully up and
1555.87 -> running now we can go to the browser and
please wait while pinky's is getting
1561.36 -> ready to work now again we have to
reload in signing now let's run the
1580.92 -> project again so here you can see in
orange color if everything is success
1586.17 -> then you will see in green color if you
about that about it if it is about it
1592.05 -> then you can see in black and this is
unstable and that is success so let me
1597.87 -> run it again build now now here you can
see the bill 2 is started click on
1618.15 -> console output so you can see the
console output so ultimately our Tess is
1632.1 -> exhibiting from Palm guys so this is the
github account so it will copy the copy
1641.31 -> the report from I mean the project from
github and then it will pass the forms
1647.19 -> so Jenkins will create its own workspace
and then exhibit that project now there
1658.2 -> are couple of session we have to do I
will show you what are those
1662.01 -> configurations regarding extent report
1669.85 -> our test is running
1709.799 -> so here you can see three test cases one
failure and now it is collecting the
1715.96 -> data will be success the configuration
everything is success but it will be
1720.61 -> like unstable build because of one
failure so unstable you can see and it
1727.36 -> sends the email so if you check the
email we will get the we got the second
1732.639 -> email build to still unstable so because
this is the second time okay
1738.7 -> now what we'll do let's have a look at
the report extent report whether it is
1742.75 -> fine or not this time click on extend
report now here you can see the extant
1749.049 -> report is fine okay and if you see the
login taste we got this this case is
1754.659 -> failed and this is the assertion error
and if you see here we don't see
1761.049 -> attachment screenshot is a test but we
don't see any attachment or here so I
1766.029 -> will show you how to do this
configuration and these the project logo
1770.679 -> is this is also not showing in correct
format so we need to do the
1775.69 -> configuration at project level in
Eclipse what we need to do here is just
1783.07 -> to go back to demo 4 and here we have
workspace the Jenkins workspace and
1790.47 -> click on extend demo this is the logo
and here we have a TI PNG this file so
1799.57 -> we have to copy the path from here
workspace Jenkins workspace and put in
1804.76 -> our project so from where we are getting
that path so that is there in extend
1812.679 -> config dot XML so that's why I have told
you I told you guys that
1817.5 -> please configure I mean please refer to
my previous video on extent report I
1822.519 -> mean how we have done that project how
we have created the different classes
1827.799 -> how we can we have configured the
project ok so here if you see in this
1832.96 -> configuration extend dot extent - config
file so here we have SRC the
1838.96 -> I mean image file for logo okay so we
need to just change the path from here
1846.79 -> okay so simply change the path logo and
then we have ATI dot PNG ATI dot PNG so
1857.26 -> this is the this is done okay and simply
I'll click on save and another
1866.23 -> configuration for or screenshot right so
for a screenshot so you can let me go to
1875.02 -> that demo for workspace and where we
have that in base class so we are
1885.37 -> returning the path from this screenshot
method guys okay so already I have
1891.67 -> created this couple of lines of code to
return this new path okay so simply I'll
1898.21 -> put the path over here from Jenkins so
extend demo they have screenshots short
1907.81 -> and what is that yeah we have to give
this path from here yeah this is fine
1927.76 -> and we'll put it over here
simply put till is three short okay and
1936.12 -> yeah the format will take PNG dot PNG it
will give the file name and it will take
1943.33 -> the file immediate name dot PNG so this
is fine too so two things we have done
1949.02 -> over here to change the path of the
still short okay and now we are we are
1958.39 -> good to go but before that I will show
you one more thing how to run your test
1964.12 -> theoretically okay so let's go back to
Jenkins go to extend demo our project
1974.16 -> second back to dashboard and let me go
to configure you will understand in
1987.13 -> couple of minutes when we do check-in
then how it will because read just now
1991.3 -> we have made the changes in our Eclipse
project now we have to check in this
1995.41 -> code into github and then it will be
picked by Jenkins okay so I will show
1999.76 -> you how we can do that how it will be
automatically it will run the job from
2006.15 -> Jenkins okay so here we have guys in
build triggers we have this option build
2015.78 -> periodically so if you select this we
can schedule our job jobs from here so
2021.42 -> I'm not going to select this right now
what I'm going to do is all SCM source
2027.84 -> code management source click this one
and I'll give the current form it five
2037.8 -> stars over here okay and here you'll see
do you really mean every to every minute
2042.96 -> when you see five stars perhaps you mean
H and then four stars so if you one sec
2054.899 -> and if you select this question mark and
here you can see not here yeah so what
2063.629 -> is cron form it so to run your test
periodically you can specify some format
2069.659 -> okay so this is called cron form it so
from here here you can see and I think I
2076.5 -> have written over here as well so this
is how the current format looks k so we
2081.84 -> have five stars the first one day notice
the minutes
2085.11 -> second one is hours third is day of the
month fourth is month and a sixth one a
2091.05 -> fifth one is the day of week so this is
how we can schedule the job in Jenkins
2095.1 -> and these are some examples so build
every hour so if you want to build every
2100.2 -> hour your job then you have to specify
age and then for star if you want to
2106.44 -> build a
20 minutes then H by 20 like this so
2109.32 -> these are some different examples of how
we can run our jobs periodically so this
2114.54 -> is how you can set your own format now
here I have given five stars so that
2120.119 -> means it will it will run the job
automatically when we push the changes
2127.68 -> to github so let's have a look with that
it is working fine or not so here I have
2133.109 -> given five stars and click on apply and
save
2137.66 -> do not worry guys I'll create a post in
my blog so I'll post related to this
2145.8 -> cron format as well so this is done now
what I will do right now we have two
2152.46 -> builds over or you can see you're here
right now simply I will go to my Eclipse
2159.54 -> and simply I'll push the changes to
github so team and we have commit I will
2167.94 -> give latest or let's say path extent
report and screen short path
2183.38 -> updated so these the commit I am giving
and simply click on commit and push its
2192.72 -> former 22 and this is the password click
on login so if if you see as soon as we
2206.97 -> push the changes to get up automatically
the job will start from here let's have
2212.73 -> a look whether it'll start the job or
not it will take some time I guess I
2219.8 -> think changes is pushed to Peter why it
is not starting
2247.11 -> yeah here you can see the third job is
started automatically
2251.73 -> I haven't start from my side it starts
automatically when we made the changes
2256.62 -> in when we push the changes to github so
these that the continuous integration
2264.06 -> process guy automatically it will pick
the new changes from github and it
2269.37 -> automatically it will run your test your
project your a script okay let's go to
2274.86 -> here and go to console output now it
will run as usual what we have done last
2282.3 -> two friends ok so this is how you can
configure your mob in github you can
2293.4 -> make the connection between mob in
github and Jenkins and you can publish
2298.74 -> your test in the report you can publish
your extant report you can send the
2302.88 -> email you can send the email within
attachment so here you can see we have
2308.13 -> seen the email with attachment as well
my report and this bill dot log and what
2317.22 -> else remaining so all done guys for
today video I am going to start selenium
2326.07 -> framework development from scratch so so
far we have covered everything in
2331.47 -> selenium Java today else we have covered
and a selenium tutorials we have covered
2336.45 -> and we are going to start framework from
scratch so if you are new to my channel
2342.81 -> then I would recommend first go to my
channel and yeah you can go to this
2349.23 -> playlist so this is my channel
automation testing insider go to
2352.83 -> playlist and here we have I have listed
on all the topics over here and I would
2358.41 -> suggest if you're new then please go
through this Java for selenium and this
2364.02 -> is the selenium webdriver is step by
step so so far we have 73 videos here
2370.13 -> and these are the separate other
playlist excel and data driven framework
2376.32 -> screen short slavs reports get in github
Keane's videos so just never get to this
2382.83 -> playlist and you can see all the videos
available over here and guys if you are
2387.9 -> good to go with framework then refer
this video here I have explained clearly
2393.87 -> about all the components in a framework
seldom framework videos and here I have
2398.7 -> only one video and that talks about
every components in the framework so
2403.59 -> that would really help when we start the
framework from scratch so you can
2407.82 -> understand that better so I would
recommend go to this go to this one and
2412.95 -> if you go to my blog automation testing
center dot-com so all the topics of Java
2420.81 -> related are covered here Java
fundamentals Java oops conceived
2425.73 -> collection frameworks everything over
here and selenium tutorials are covered
2430.65 -> over here in selenium tutorial tab and
regarding these Jenkins by the time I
2436.59 -> will publish this video I'll I'll make
sure that I'll write a post on this as
2441.99 -> well so here you can see Marvin tutorial
so I have fun link over here for Marvin
2447.14 -> get in github as well so in the similar
way I will write for Jenkins as well and
2455.55 -> guys if you are new to my channel then
please subscribe it and click on bail
2460.23 -> icon as well so you will get the
notification for upcoming videos so let
2467.07 -> me just see the Jenkins weather yeah we
are done and here you can see the last
2472.29 -> report as well the third here you can
see demo for build three still unstable
2477.18 -> and here is you can see the report as
well so these how you can send the
2482.67 -> report to your development team your
manager this way and Bill dot log is
2487.35 -> also there so let me open this bill dot
now so all the logs which we have
2491.91 -> created I mean when we run the project
so all the logs will be listed over here
2497.76 -> in this file
2503.25 -> so I'm good for today guys I think if
anything is remaining let me just think
2509.8 -> about it I think all done yeah so in the
next video we'll talk about selenium
2520.48 -> framework development from scratch so
thank you guys for watching and I would
2525.22 -> recommend please subscribe this channel
ok so you can learn so many things
2529.51 -> so after selenium will start maybe BDD
flavor
2533.77 -> thank you guys for watching have a nice
day have a nice day bye bye
Source: https://www.youtube.com/watch?v=GAjxnkH6Tt4