Understand the Cucumber Scenarios Usage

Rahul Shetty
A free video tutorial from Rahul Shetty
Teacher/Founder of RahulShettyAcademy.com (Testing School)
4.5 instructor rating • 15 courses • 250,791 students

Learn more from the full course

Cucumber with Java-Build Automation Framework in lesser code

Step by Step Cucumber BDD Approach to design the powerful Testing framework(Selenium,Appium,API) with very MINIMALCODE

10:40:37 of on-demand video • Updated June 2020

  • By end of this course , You will be able to develop Cucumber Test Framework for any Web/Mobile/API Automation testcases
  • Understand how BDD(Behaviour driven development) approach works with the knowledge of gherkin syntax
  • Indepth understanding of real time Automation framework challenges and solutions to fix them
  • Complete knowledge on Datadriven testing, Parameterizations, Resuable components, Cucumber hooks and tags
  •  Additional knowledge on Integrating Cucumber framework with MAVEN, JENKINS, GITHUB
English [Auto] OK. So that is one scenario I think but in this case if you want to talk and simple traditional forms and you might be wondered that why do I need to convert this slime into the standard argument. So in cucumber whatever line you will define like this we really tag our regular Development Corps. We just mention Gore to each and every of this lame OK you will no doubt in our coming lectures when we actually start developing something. So for each for each of the line we just present in the scenario we will actually tag this complete line with our development mattered. OK if you take the DNA code to navigate to the pay grade card page using your mobile testing our testing. So the core what you wrote for navigation will be tied into this line. You're going to run this simple test case like this from combat. So as you find each and every line do you end up back in real court. So from here it will Barbuda that particular board and execute. OK so that's fine. It isn't mandatory for you to be fine you are a test case. In this scenario it is a gel. Stein OK if you don't like this then it is suitable to make then you're using could work. And one more thing I want to tell here in this complete course I will be only talking about cucumber. I'm not going to talk about any other mission I'm. Any of what they say. It required our permission to select selenium ABM artist. Sure. OK. So I assume that we already have some other major test case the plain standalone without any framework. And the discours teach us you how to pick those test cases and automate using cucumber framework. OK so fun explanation. I use a dummy test cases in this course. I'm not going to write any real selenium Gorda lappie in court. So this is universal. Any obligation. This is not restricted to our verb or obey our API. So any user any user can watch this course comfortably. But if you are expecting to learn selenium donation from here and this is not the right course for you this is still developing. But for all your other distinct tools. OK. So I mean you this and I are two meter down using this cucumber framework when I said dummy test. I just printed something and I'll put a single why land systems are in the line of skiers. I will read a dummy line that instead of the dummy line you can inject you real selenium gourd or appear in court or a step in court and you can use this framework within the frame what part is taken care of in this course to police the mind because the framework itself take many hours to explain. So if you want to learn excusably of selenium that is in my course very we'll have some 45 ops of course which talks on Selenium. OK. Just please mind that line and yeah. So I hope by this lecture you understood the purpose of cucumber OK so that purposeful The only sarvant in this completed ordeal which is nothing but a framework building. And if you're really scared out of building automation remember that lots of cold discours teaches you do design a neat and robust framework. But simple good. OK. That's all I can say. And breastfeeds you can enjoy by watching my lectures. OK. Let's come back. That's about scenario. And as I said when we first find this business requirement sometimes there could be multiple preconditions or multiple actions. So here you see there are multiple actions. So in that case you will be using an operator or whatever any keyword you can get to make your work actions. So that's what he had described. This is used for statements that are in addition to the previous steps and present positive statements. OK. So you'll see here for example you have multiple evaluations here. Let them get a card confirmation page is displayed. And also check if Lifton's number is displayed. So once you feel like a girl Bisley you will have somebody fun and snum but for confirmation you need to take that. So there are multiple actions here. So for one action you might have one called the Back in which you were back later. So that's why you want to read this. So for this there is one particular chord Jurado mission to get this reference number in my head. And here is to just check it for decent information page. So when you have multiple validations you can happily spread and keyword and keep on trading. You see how some 50 melodist and like it. OK. And if there is any need do validation here like Bart varify again. Error message is not. This is the ideal scenario right. So if you are building with any nigga do the nation's business is positive testing checking if something is displaying. This is to check if something is not displaying sounds like ending it just a guess for this particular scenario so that you can use a keyword with but you can still use and to validate this. But if you are under different than Gerkin syntax and conventions you have to use Bart keyword to showcase it. And then you deal with the testing and get work to show positive detesting. So this is useful statements but that addition to previous steps and the present negative statements. OK so that's all that's how you can simply define a test case in terms of scenario on Google. So you might having some plain core to automate this. So using this you can bag you are called to each and every line and you can do that. Don't worry about just dying and all incoming letters. I have clearly explained how to do that. Just follow my lead us and not it don't want to learn from this particular lecture and just do not zoom in anything now. Once we progress you will get an answer to all of your questions. OK so right now I'm still intending to go back explaining how polite a jerk can scenario to work with cucumber. OK. And you know what is not you. So you have to make sure every test you have to write like this key works in audio and you have to describe what exactly this will get you going by any name. This is not syntax you need to follow. Here I am doing make minimum Duey amount. So you have to mention it here. So before given you have to write like this so that you are a good man and understands that is a scenario. It will first verify this keyword. Scenario 1. This is different. The remaining statements often dark will be treated as a part of that scenario. That's why you have to follow this convention of writing like this. Still there are some tools which generate followers which will we're talking in the late. All right so next is the future which you need to know what is the future. The second key word so future of the presence of business requirement. OK so here the business requirement is to test the credit card payment flow. Then that is a high level business requirement. If playing askew do test a grade card payment flow. So it is your duty to build as many test cases to verify that particular business requirement. OK. It costs us simply to test the grade card flow. You shouldn't be able to test that floor with the multipurpose basis. Like I said test with minimum do your own selection and complete the floor and check if a credit card payment is successfully happening. If you do a minimum amount option and best of floor again with the statement balance option selection OK there's no option to pay the full amount with the statement balance. Select that option and see if the floor is working or not. Or click on and I've got a. And see and does some random amount and see if the flow is working so late that you have to test all the possibilities and you how to satisfy the business requirement off. Craig garbagemen that secure it would be OK. So here are future presidents and business requirement and both so why is this a business requirement. You'll be fine. Many people in aureoles. OK mathematician I think nothing might my best guesses. So in this example what we are talking future is requiring credit card payment. And this is one scenario one stinkiest to satisfy that requirement requirement like this. You'll have them you'll have to come at many all possible combinations to satisfy the business equipment. So let me show you this example. OK. So here future is credit card payment. This is what we looked toward. Now to satisfy this I have written multiple scenarios. Nothing but money to protest gives us OK. When I said you know they'll just assume that I guess in your mind a bus home is speaking now. So it that's actually a great compliment. You see here you can take a page news that fills all the details and select the minimum on option and click on paying for them and his checking of confirmation is desperate. This is one scenario to satisfy that. And this is another excuse he was always on paygrade got Ph. He filled out the details and this time he selected stateman balance auction and then he paid confirmation messages for one discus and when there isn't another agreement instead of the state bring balance on. I mean my mom he had selected some random emong and a third zero. OK. He cannot pay the zero rate which is wrong. This is your best guess. So as you know that interesting word to satisfy one business requirement to usurp that will still best guesses as well as your best guesses. I protested him only using all the combinations. So this guy here would and another combination. He entered Seatle and clicked on Pemberton. So obviously confirmation page is not displayed but error message is displayed. We did a fix and it as different. So like this is the best guess and these two us to discuss. And he's saying that all of this just scarcest Oddly enough to validate the future. OK. So that's where we said our future. So in every test when you define C not of you it's mandatory that you use a filter like this. OK you can not just define C audio to test you but my desk is. So when you do find this cucumber will expect. What is the future for this in your credit card payment is a feature for this in audio you have to define this. OK. And these three optional lanes like in order to Isaac. I want to. These three are not optional lengths which you can use to describe a more stable future. Right now I don't want to talk about this which will give you a confusion so let me him this right. OK. So many would be fine scenarios. So just remind that you have to obviously give the statement if you're going don't give this statement you are a test of faith asking that feature is missing. OK. So as I said to satisfy this Foods or find these other multiple scenarios. Now next is food to find. Now you might be wonder when exactly how to they all of this stuff. OK so if you want to write an art emission test in the state of selenium you used to have eyeglasses if you have done that any time in the past. Obviously when you Domitius but in cucumber to define all this you have to use a future fight it's a file can be created by simply giving d'arte feature the extension to it. OK. Just slide in enim like if payment is a feature find them penmen. If you are writing that in traditional why use it being rendered. Java is a class name like an eclipse or whatever it is that you use. But here in cucumber when you want to describe a desk like this you'll have to use dot feature extension so that means payment dark feature you have to write like this. OK so that is a feature fine. And you can dump all this dust in Boulder fine which is nothing but a feature. OK. So this is how you would be fine in a real time. You cannot use the office to define all this. So this is at best guess basically an eight card payment test. OK. That's what you see here. We are seeing a live feature phalanx of the sort which consists of multiple Sinatras that correct. Right. So if you place all this in if it's a file with the dark featured extension. So this is one scenario. This is one scenario. All these are multiple scenarios. We've done nothing but been traditionally seen as a test to sort of files of this sort and then say that on my desk it says he wanted to build an audience. OK. You just imagine like Future Files like this to soup which everything is placed OK. And this is a business that I went to my name. So you'll be using all this when you are working with cucumber. So to summarize it very simple. Now when you want to create it this is fast your creative file with the DOT featured extension and you go in a scenario like this scenario given then and then once you are defined scenario like this obviously it expects a scenario like this. OK. And it also takes picks which feature it belongs. So if you knew all this keywords that told you how good lady identified now so you might be wondering where exactly the lies. Now I would be talking about step defamation in our coming lecture and we'll take it from there OK. Thank you.