Overriding tags in Runner class using Maven command line command (Cucumber BDD - Part 38)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello all welcome to part 38 of cucumber bdd training Series in this session I am going to explain and practically demonstrate how to override the tags that are specified in the runner class of cucumber projects using the maven command line command so let's get started till the previous sessions okay in order to specify the tags we have specified them in the runner class okay and appropriate scenarios in the feature files which are okay relating to the particular tag specified in the running class were running right that happened till now now I'll show you how to specify the tags from the command line okay using the maven commands from command line also we can specify the tags okay all those things I am going to cover in this session in a detailed manner guys so this is the command we have to use in the uh for a command line okay the command prompt you have to type this command guys then it's going to work so anyhow I'm going to show practical again till then just follow my session let so I have quickly switched to Eclipse ID here as you can see we have this Runner class if I run this guys all the feature files will run okay here login for all the scenarios and all the feature files will run so what I will do is I don't want to run all the scenarios in all the feature files rather I want to run only the smoke test okay here you see in the login dot feature the first one is smoke second one is also smoke and the one thing is I'll remove smoke for first scenarios uh intentionally so that I don't want many scenarios to run only second one I am making it small guys that's okay and uh remaining all are normal okay the first one is normal second one is now smoke okay similar to insta dot feature file we have this one as smoke and this second one also has smoke that's okay out of four two or smoke in such out of three we have one as smoke in the login we have one as smoke in the register we have two as smoke in the size we have one S Mode that is total four scenarios are there across the feature files which are tagged with at the right smoke tag name okay so if I want to only run that particular uh scenarios having that at the right smoke tag so what I will do here is here I'll add tax is equal to double quotes I'll provide put a comma here is okay so here at the rate smoke you right okay so now if you run this now if you run this uh runner class using junit or whatever it is you will see that only only the four scenarios from across this feature files which are tagged with at the red smoke will run so the running has been completed you can see this one has smoke whatever that has run has at the red smoke attack only the scenarios having at the red smoke has run have run okay at the red smoke so we can see these are generate results also and uh can see that okay under user login only one scenario having that smoke tag has an uh registration restarted feature file two scenarios of the smoke tag they got run and search for a valid product has such a DOT feature file has one scenario having that uh smoke tag okay now I'll show you how to override this tags that are specified in the runner class using the maven command line okay I'll specify one command I will write down some command in the maven okay command line and I'll show you so before that we'll do one thing uh that is first of all uh in the previous session I showed you how to run this uh cucumber test with the help of Maven from the eclipse idea right right click uh run as Maven test we have said and uh it will it will run this uh test Runner which is having the desk keyword and uh the test Runner will invoke this feature files having the smoke tags okay and uh respective step definition files also will be invoked internally okay that's what happened so far now what I want to do is I'll go to the project location guys I want to do it everything from command line now okay I don't even want to open the clip side without Eclipse ID open I want to run the Cucumber test with the help of label guys we can do that without Eclipse ID with help of Maven we can run the Cucumber test okay and also we can override this tags also okay from the command line I'll show you guys everything I'm going to show you in this session so for that I'll go to the location where this project is available I'll select properties guys this is a location where the project is available I'll go to the location is the location of open the project folder guys where you will see this combat XML file okay this is the location we have to run the maven okay so you can close Eclipse ID guys there is no issue you can just close the eclipse ID it's not required and you can see that uh before closing in that Turner class uh tax is equal to smoke is mentioned we are going to override the attack that's anyhow so for now wherever the com.xml file is visible in this project select the project path and type CMD guys when you type CMD you'll get this command prompt okay you'll get this command prompt where you will write mdn space test just simply write mdn test case nothing much okay mvn test press enter you see mvl is not recognized that means Maven is not required recognized so just go back I intentionally type this command guys now if I say mbn hyphen version will not enter the version also you see again is not recognized why the command prompt is not recognizing the uh Maven because Maven is not installed in this machine okay Maven is available by default in Eclipse ID guys that's correct but Mabel is okay to you to run the test using Maven from the command line you need to have Maven software installed in your machine the way the Java is installed your machine and configured okay same thing we have to do guys for that I will go to this uh browser open the new tab and search for uh um I mean uh download simply I'll say download Maven guys nothing much and uh you will be provided this link download fhc Maven click on that link guys you will scroll down on this link just scroll down guys I hear you see binary zip archive will be there this bin zip folder will be the click on the zip file a zip file will be downloaded into your machine so we have to extract the zip file guys okay once it is downloaded we have to extract the zip file so still it is downloading guys I'll pass the video and resume once it is downloaded so that I don't want to waste your time as you can see guys uh ZIP file got downloaded I'll uh just click on this option and say show in folder it gets generally down and the downloads folder guys this is the location where Maven software got downloaded I'll extract this ZIP file if I'll extract the zip file extract all click on extract okay uh the zip file got extracted guys uh you see we got this FHA level inside that again we have these bin folders and all wherever the folder in which we have the bin and all these things right uh you just go to that copy that folder again which has a bin folder inside okay copy this don't double copy this Apache even copy the only folder inside folder which has a bin okay don't copy this outer Apache moment okay when you have to copy which has which directly has a if you open that you should get this bin that that folder you have to copy and come to the any location in your machine guys I generally prefer going to C drive and paste it okay I just pasted it guys uh you see it's getting pasted you see here we got Apache Maven I'll open this folder guys I'll copy this path I'll copy this path this is a maven Home Path I'll click on the search and say edit system environment variables I'll get this dialog okay once I do that I'll click on and advanced tab I'll click on environment variables and here I'll select new and say Maven underscore home okay in capital letters with underscore I'll give and provide the path and click on OK and select the path and click on edit and again click on new and paste it guys I have to give the path till the bin folder guys just say slash bin guys okay that's it okay you have to give the home Home Path under that you have to go inside the bin folder slash bin you mentioned that's enough say okay say Okay so this blue quarter path we have given in the pre-existing uh path system variable in that environment variables okay done that's it guys so what now what next you have to do now is again go to the project location guys uh just go to the eclipse ID that project location now just let me see where exactly that is there in my machine okay let me go to the project because I don't have Eclipse ID open now so I have to find that place where I have that uh project available Okay so this is a workspace in that we created tutorials ninja project and this is a project case this is a project we are working on so I have not opened Eclipse ID guys currently clip side is closed here now earlier when I selected this path and type CMD the command prompt will open at this location get tutorials in your project location I don't have to type C drive clear function all the stuff automatically the command prompt will open from this folder location so it is a kind of a shortcut you can say or tip where you can directly go to the folder okay in Windows now here we have the form.xml file guys we have to see whether om.xml file is visible if it is visible we can uh write on mbn test guys mbn test will invoke the okay mvn test you see from command line we are running the test in Maven project okay running the Cucumber test in this project with help of mvn test case this will invoke the runner class as you already know when the eclipse idea was open uh when you run the test using Maven test right click on as momentous from Eclipse IDE what happened it was was invoking the another class Runner class has invoked the feature files feature files have invoked desktop definitions that happen and if you see before I close the Eclipse IDE okay before I close it Eclipse IDE here uh if you go to this SRC uh test uh Java Runner if you see that guys in the runner class If You observe we have specified the tax is equal to smoke guys okay tax is equal to smoke is there in the project again I'll go back to the place where we have the bomb red XML file and the command prompt is opened also at the uh where the palm.xml file is visible I'll simply say MV and test it will invoke the smoke test case only the smoke test will run because in the runner class will invoke Maven deiven will invoke the runner class the runner class will invoke the feature files so in the runner class what we have mentioned tags as tax is equal to smoke we have mentioned okay you see uh you see only four scenarios have run that is a four smoke scenarios okay all the four smokes scenarios have run guys you can see at the rest smoke okay here also at the red smoke here also whether it's smoke head that smoke so I don't want uh smoke test to run uh rather I want to run uh all the scenarios from the search File such dot feature file so what is the tag name we have at the rate searches attack name if you see here for the last one at the red such as attack only the scenarios which I have whether it sucks I want to run there are three scenarios having at the red such tag in the search dot feature file so what I will do now is here I'll run a different command this time the that command will override the tax in the runner class specified in another class the command will be a continuation against mbn test will be saying hyphen d cucumber you have type like this okay hyphen D cucumber dot okay filter dot tax is equal to in double quotes you provide the tag uh anything uh any types that generally you provide in another class right same thing you can provide from the command line guys okay here I will say search okay search tag will provide and press enter if you press enter here this at the rate search will override the at the rate smoke in the runner class okay and only the search related scenarios search at the rate search specify tax scenarios uh in the Umbra project will run okay you see here only three tests will run having that there is such okay it's not working out uh or okay it's continuing here so get started just wait wait here it is running actually okay that's the word output now we are getting it latest output you see what happened here four are there do I have four here let's see what's happening looks like it's not overriding that smoke is still coming I said there is smoke is coming okay it's not overriding guys okay and that's uh smoke is still there so it's not overriding what we can do then I'll do one thing guys uh this part is not working out in this part is not working or so I'll just close this once and try this again CMD mdn test hyphen the Cucumber dot filter Dot X is equal to I'll save the rate search case okay at the rate search carch let's see what will happen this time if it is still not working uh then we have to go with another approach for that okay this which tests are running let's see it's not take much time though again four are coming means it's not working fine okay only the tags which are specified in the only attacks that are specified in the runner class are running but not from the command prompt I'll do one thing I'll go to srcts Java and see if I remove this Runner I'll if I remove this you know uh tax is equal to from here is it working or not it from the command line is it working or not I will see okay if may not be overriding us but uh is it working whatever the tags we are giving you from the command line are working or not I'll check okay I'll just close this and again open CMD now here I'll say mbn test hyphen D cucumber dot filter dot X is equal to at the rate search run this let's see what will happen this time okay how many tests are running let's see okay looks like all the 14 tests are running that means this command line is not working at all okay this uh command Landing is not working at all let me check once okay there is a small mistake that I have done guys okay uh you see you see here the D cucumber C should not be Capital guys I just mentioned c as capital guys not working so let me do one thing I will go to the project again and I'll go to the SRC test Java and again put tags there okay because I thought there is a problem with uh it's not overriding but I have done the mistake where I install specific lower lowercase i specified upper KC guys okay because of which things are not working here again I'll mention tax is equal to the runner class tax is already there okay this is not the problem is not the problem here I'll write at the right earlier what is that at the red smoke is there okay so smoke test should not run now because I'm from command line we are giving a different option okay different tag that tag should override the tag in the runner class that's what is expected mdn test here I'll say hyphen D here uppercase C I am giving that's the problem you have to give lowercase cucumber dot filter dot X is equal to at the rate I'll give search and press enter this time only three should run if it is really overriding only three should run instead of four smoke only three search should run okay let's see what will happen foreign happened but now I corrected it you see only three has run okay the problem is with the command you have to give the command properly guys even though I return here properly but uh I just mentioned Capital C which was causing the problem so if you have given the command properly you can see that clearly see that only three scenarios have run only three scenarios have run and all the scenarios will have there is such tag and the red subject there is such only the at the right search okay we're running because there is such Stacks were override in the at the rate uh smoke tax mentioned in the runner class so four guys you understood this session on how to override the tax and run a class using email command line command so that's all for this session thank you bye
Info
Channel: QAFox
Views: 2,886
Rating: undefined out of 5
Keywords: Overriding tags in Runner class using Maven Command line command, Cucumber BDD Made Easy, Cucumber BDD Tutorial, Cucumber BDD for Testers, Software Testing, Software Testers, Tags, Maven, Command line
Id: dLrbTkOy1r0
Channel Id: undefined
Length: 17min 20sec (1040 seconds)
Published: Fri Dec 30 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.