what up everyone welcome back to the channel Jahmal here and in today's video i'm going to
be showing you how you can generate x10 reports in your cucumber framework i'm going to be using this
awesome adapter it's called the cucumber adapter and it's going to be used by a particular team
and it's the tech grasshopper team and they really really perfected this
plug-in in my eyes and i really want to say shout out to them so today's video we're
going to be looking at how we can generate our x10 reports using our gurken or our
feature files and this is pretty much an example of what that extend report is going to look like
we're going to have a nice dashboard it's going to capture our time logs how fast something ran
and pretty much all the nice details that is very useful for presentations and demo so i'm just
going to be showing you how you can get started with that so let's get started so the first thing
you want to do is head over to your browser and type in tec grasshopper cucumber adapter
and the very first link you should see is the cucumber jvm6 report generation using x10 reports
so click that link that should take you to the grasshoppers chirping page where we have a nice
breakdown and documentation on how we can set this up so i'm going to be walking you through
this process so you can get this adapter set up in your cucumber framework so let's get started
all right let's get started so what i'm going to do real quick is just resize my windows so i have
my grasshopper documentation to the left and then i'm going to have my eclipse to the right so i'm
just going to open up my gherkin test and project and i'm going to head down to my features folder
and i'm going to open up my home feature so we're just going to be picking up where we left off from
our last video where we ran our scenario outline and it did these things here in the example
all right so what i'm going to do real quick right now is simply open up my home page runner
i'm just going to retest this just to make sure everything is running fine
and let's see what happens all right so i'm just going to rename this one as test one i don't want
to run all of them right now so we're just going to run the scenario outline it's looking good
and it's just simply clicking each category and it did that real nice
all right so now today's video is talking about using the x10 reports and how we can use this to
generate better reports and what's not so we're gonna be using our poem dependency and we're gonna
need the x10 reports version five so i'm gonna head over to maven repository and i'm gonna just
search for advanced stack and then you should see extend reports i'm gonna be choosing 5.0.9
the latest version and i'm just going to copy this into my poem file and my project
right now that i have that copied next we're going to head back over to the documentation
all right so if you're version five make sure you use this dependency
we also have another dependency for extend reports version four so you're gonna use the one below for
that if you're using version four just going to copy this into my maven repository as well
so now i have the extend reports cucumber 6 adapter inserted all right next we're going to be
talking about the plug-in configuration so the x-9 cookie number 6 adapter plug-in needs to be added
to the cucumber options so that's what we have in our runner class so this is the example that they
have for us to set up the plugin what i'm going to do is head over to my homepage runner and what i'm
going to do is just simply copy the code from com.advance stack and just add it to my runner
all right so i'm going to do is simply add a comma so i can add another plugin
i'm just going to add this right after the json and that looks good
all right next make sure you have the colon at the end yep i do have my colon
else an exception will be thrown
all right so now let's get the report activated so the first method of activating the report
generation is the creator extend properties and we have to add this into our src test resources
folder so that's what we're about to do all right so i'm just going to go to my src test resources
and what i'm going to do is just right click do new and go to other
and what we're going to create is a file and then click next so this file we're going to
give it the name that i recommend extend that properties once you have that just click finish
okay so now we have all file created so we're just going to be adding these properties to that file
all right so i'm just going to copy and paste that into my extend that properties and this is
just showing us where our file will be outputted so test hyphen output spock reporter spock.html
we're going to change this up a bit i'm just going to give this a name like reports
and instead of spark.html i'm just going to give it automation test report all right that looks
good next on our documentation what we're going to do is take a look at the maven show for your
plugin so if you're using the maven show for your plugin i'm not going to be using that right now
you can add it to your pawn file as well so that's just one other way of getting the report activated
and you can use the maven command as well so different options of activating your reporter
but i'm just going to keep it to the property files for now
all right the next we're going to be working on the report settings so this is like to
change the theme the title encoding etc so we need to create another file and we're going
to give it a name of spa config.xml so let's head back onto our src resources so go to new
and then go to other and what we're going to do is back on the general we can go to file
and then we're going to create this name and we're going to do spark hyphen config.xml
all right now just click finish now we have our new file created so what we need to do is add some
xml in this file so we're going to do is head back over to the extend reports main page what you want
to do is click reporters click v3 html and scroll down towards the bottom until you see the xml
section all right so now we have the xml section this is the xml configuration that we need to copy
copy this and we're going to paste this into our spa config xml file all right that looks good
so we have the report theme so the standard is the white color so i like to use the dark theme
that looks good you keep the utf the same https the same so the title of the document so this
is pretty much like what that name is will be even repository we can change it up to our project name
so give it a name in my case i'm just going to say this is shop angular plus
that's the project i'm working on and then the report name so this is pretty much what
that report gonna be named i'm just gonna give it a name of automated tests and then
everything else should stay the same okay once you made those changes just click save
all right so now we're gonna head back over to the tech grasshopper documentation what we're
gonna do is just copy this this property and we're gonna paste this into our extend.properties file
so now we are telling it the location of our spa config and that looks good all
right next we're going to be looking at the report attachments so to add attachment like
screen images to set needs to be added to the extend properties and the first one is going
to be the screenshot directory and the other one is going to be the screenshot.relativepath
all right so what we're going to do is just simply scroll down we're going to copy this
couple settings and we're going to paste it in our file all right
so now we have our screenshot directory so it's saying it's going to create a new
folder and it's going to create it right here called test output i have an example
here already but i'm going to delete it because this is going to be auto-generated
and i want to put the screenshots in its own folder so i'm just going to add
screenshots towards the end of this path so now our screenshot's going to go into our test output
and screenshots folder looks good and then the relative path that's going to be screenshots
all right now we're going to scroll down and now what we're going to see is this is what we
just set up so now what we're going to see is the pdf extend report so this is a new feature
so if you want to generate some pdfs to show your highlights your features scenarios steps
pass fields all that stuff in the pdf format all you have to do is just add the settings and what
it's saying is hey you want to start the pdf so we do want to generate pdf so that's why it's set to
true and we also have the location where we want to put these pdfs so add a hyphen to this path it
had test space output but it would just generate two folders and that's a little confusing so make
sure add a hyphen so we have both our html and our world pdf going into one test output folder
seems like i have like two spark outputs i have one on the top and then one right here
so what i'm going to do i'm going to have to take one of these oh i'm going to take
this one out real quick all right so i'm just going to keep the top one and take the
spaces out and i'm just going to call this html reports so now everything looks good all right
all right next we're going to head back over to customize report folder name so it's good to add
these two settings base folder dot name equal reports and the base folder that
the time pattern let's add these to our extend properties so what this gonna do is just generate
um a folder and it's gonna call it test report and it's gonna add a timestamp to it
and this is good so when we reuse our tests we don't override our last test okay so it's going
to make sure we have unique text every single time and the next thing we're going to add is
our spark report view order so this is going to tell us how our dashboard is going to look where
the test categories and all that stuff is set up so just copy that and paste that into our file
and last what we're going to be doing is our system info properties so this is just pretty
much going to tell us the os version who ran it the project name just little quick settings okay
so i'm just going to simply add these to my extend that properties file so i'm going to do is just
copy this example system info.os and os i'm using is a mac so i'm just going to change that to a mac
i'm currently the engineer so i'm just going to put my name as the engineer on this report and you
can just add any other settings that you like i'm going to say the project name is shop angular plus
so the browser that i'm testing on was a is google chrome now that looks good and we also have
parallel or multiple runner executions but we're going to be taking a look at that in another video
all right so what i'm going to do is just clear my console click save on my extend properties
i'm just going to go to my runner and i'm just going to click run as and run as a junit test
alright so now our tests pass and if everything ran successfully we should have a report
and we're not going to have screenshots in this report those are just print statements
yep nothing is really happening so i'm just going to comment this out
we're going to add the real screenshots after that but what i'm going to do is refresh and now we can
see our test report file is generated we have test output and within that we have our html reports
and we have this nice dashboard with all our results we have the start time end time we have
you know how much features pass how much features failed
and we have our system environment variables so everything just looks pretty much good
and if you take a look at the extend properties you can see everything is matching up
so what we'll enter the spa config you can see shop angular plus document title we have
the automated test report name and we have all these useful information in this widgets
all right so we have our tags so it reported that we have our add test tags and instead
we have four scenarios passed we also have the system environment so these are all the quick
highlights i was mentioning earlier we're going to dive into the test report and now we're going
to see the test scenario um details so we have the feature name listed right here to the left
and to the top right and also has a little detail of the user refers to the person interacting
with the website i really really love that and now we're taking a look at the scenario number
three so the user clicks each category on the home page so now it's gonna click the canvas the lust
on acrylic so we should see all the given and when then statements being brought back in this
little bubble so what you're going to do is just click that and now we can see our given and
when then statements in this example we have the canvas print so that looks good next if we open up
the other one we have the lustre and we have the acrylic so this extend report capture those steps
very very nicely and we also have you know this tag column so you can tell you which tags were ran
even though we ran three tests that's what we've seen for because i guess the scenario outline
somehow counts as a test interesting so what we're going to do next is in the after step we're going
to do is add the screenshots to this now and that should pretty much generate our reports as well as
have our screen shots all right so we're gonna do now let's take a look at the x10 pdf before
i forget so instead of the pdf report we have these nice details we have all the feature names
we have a breakdown of all the scenarios as well so a lot a lot of details in here
very good useful information you can see how long a test ran which tests ran the quickest i
really really appreciate what the team has done over here the tech grasshopper team
really good adapter that these guys develop so big shout out to to the tech wraps upper team
so what i'm going to do right now inside of my after step i have a take screenshot method so
what you want to do is make sure you import your scenario and then give it a name of scenario and
this is the io cucumber java scenario so make sure you have that and what i'm going to do is just
paste the scenario and what we're going to do is do the attach so we have the data we have a byte
the media type and we have a string so in this example we can see how it's supposed to look like
so we can see the media type is an image png that's good the name is just a string you can
give it anything you want so now let's try to create a byte this is going to be
our data out of this attachment so i'm going to just say is final byte open up my square
brackets screenshot is equal to what i'm going to say is take screenshot all right so we have
to do is just open up some parentheses here and this you're going to say take screenshot driver
and what we're going to select is get screenshot as and then we got to choose our output type and
the output type i'm going to be choosing is bytes and then we're going to paste that screenshot
element right into our function and then i'm going to change the media type to image slash
png and just give it a name i'm just going to say image you can give it anything that you want right
now and i'm just going to add my semicolon and now everything looks good so what i'm going to do is
i'm just going to simply run the first scenario just to make sure everything is running good
so in this scenario the user's just going to click on the the paper and select the
silly peak print now i'm going to show you that it's going to generate another report without
overriding our current report and that's exactly why we're going to use the datetime pattern for
all right so what i'm going to do is just simply click run as fire this up let's see what happens
all right since i ran the tested ram both this scenario so you're an scenario one and scenario
tree so that's pretty good so let's take a look at the report now that we have two scenarios
so refresh the project now we're going to go to our last um test reports now you can see
our screenshot folder is listed with a lot of images i'm just going to open up my html with
chrome and now we can see we have four scenarios past 26 steps um it's very funny when you click
refresh in this page the color changes so even you see that from time to time and now we have
a breakdown of all our tests and steps so once we go into a test section what you're going to see
is now we have our given when then statements we have our images and that looks amazing
wow really really love how versatile this adapter is because look how streamlined and easy this
is i remember how hard it was just to build all of these um stuff manually oh my goodness
this is a lifesaver so shut up shut up shout out to that team so this is how you can get
started with the extend reports all right i think i'm just going to do one more test
and in this test i'm just going to do a failure so you want to see what happens when there's an
actual failure so i'm just going to change the the home tab expectation so the home tab is home
and i'm just going to change it to like home too and just see what happens when we do that
all right so when this happens this should automatically fail
because we are not expecting them to supposed to expect us simply home
but this is a good example how we're going to show what it looks like when a failure is reported
all right so as you can see our error on our console we have a search failure so the same
way as expecting home but it was home too all right perfect so let's refresh our page generate
our new test report i'm just going to open this with my system editor which is chrome and now we
can see the failure so you have no scenarios passed one scenario fail we have a breakdown
of which steps past which steps fail and which steps was skipped very very nice we also have
this new bug um icon to the left and it's going to show us which page has given us this issue
and you can see a breakdown of that comparison failure right into the report
so it makes everything so much easier when it comes to debugging you can look at this
and notice hey this is where the issues are current without even looking at the console and
a very very versatile tool especially using the cucumber framework you're definitely going
to be needing something like this to you know make sure you present your reports to all your
stakeholders your managers or whoever this right here is the way to do it all right so
there you have it this is how you can get set up with this cucumber adapter to generate great
reports within your cucumber framework if you guys found this video helpful please feel free
to smash that like button subscribe to the channel and i'll see you on another video