Udemy

What is Gherkin syntax and how it works

A free video tutorial from Rahul Shetty
Teacher over 800K+ QA Students|Founder of RahulShettyAcademy
Rating: 4.6 out of 5Instructor rating
29 courses
868,529 students
What is Gherkin syntax and how it works

Learn more from the full course

Learn Cucumber BDD with Java -MasterClass Selenium Framework

Step by Step Cucumber BDD Framework Tutorial with Java and implement Robust Selenium WebDriver Framework from scratch

12:07:02 of on-demand video • Updated November 2023

By end of this course , You will be able to develop Top class Cucumber BDD Selenium Test Framework from Scratch
Understand how BDD(Behaviour driven development) approach works to write Scenarios for Test Automation
Indepth understanding of Core Cucumber framework concepts like Dependency Injection, Parallel execution, CI/CD Integration
Practical knowledge on Datadriven testing, Parameterizations, Resuable components, Cucumber hooks, tags & Attributes
Generate HTML, XML, PDF, Extent reports with Cucumber with Screenshots attached on failure Scenarios
Learn to develop Readable, Maintainable and Scalable framework using Cucumber and Selenium WebDriver by following Page Object Model design
Understand Selenium Cucumber Frameworks using both Junit & TestNG Runners
Learn Design Patterns & Best Practices to implement Loosely coupled tests in the Framework
Learn how to Schedule your Framework tests in Jenkins CI/Cd with auto trigger regExpressions
Learn supporting tools like Maven, Github and Jenkins
Understand running Cucumber Scenarios in Parallel Mode using TestNG & Maven Junit
English [Auto]
Welcome back. So let's start understanding field terminology regarding this cucumber. The first thing is Judge Kim. So what is Judge Kim? So basically, it isn't language to describe the softer led behavior, so intestine tends to speak its own language to define the testicles. OK, in general, if you want to develop on, if you want to test something, you right at the sticks in plain English, right? Like, take the credit card payment or take the loan payment. So it's all about go and click on the link. Verify that information is being sent. Click on Submit. Take the confirmation page is displayed so you're right and pretty plain. Best case and if you want to test any software in behavior. But so doing this, there are some problems with this design. OK, so Durkin is replaces and fixes all the disadvantages we are having with existing uploads after writing test cases in plain English. OK, now, for example. So this is a plaintiff's case. If you want to write like a pop up message is displayed when buttons are clicked and it hasn't gone. OK, so this is the text given by the business analyst. So let's assume that we all know that business analyst is the guy who will give us requirements. Business requirements. OK. Based upon business requirements is given by B Q, I will go in brightness cases based upon that requirement. OK. So in one of the requirement, this is what he has given. So when you write something in plain English that the interpretation of that line could be different for a different person? OK. B, it assumes I interpret this in one way, but when you read this, you might interpret this in another way. OK, because there is no one single common syntax to stick to a particular language. So here it's up to the people. So based upon his proficiency in English, people define something that you see here and b want to write like this pop up message is displayed when buttons are click OK and then eraser one. This is what you thought of giving a requirement. So one way of interpreting this is performance is disparate, and I saw going on button. Click on clicking on a button. The message is displayed and those errors are gone. This is how he interpreted and written. But when you this, his vision could be different in reading this plain English. Now you can also write this as carefully observe these two lengths. Not. OK, here, what cue is thought of this line is. Pop messages will only display, then I click the button and all the errors are gone. OK, so he has to make sure all the answers are not present in the pitch and then he clicks the button so that pop up message is displayed. OK, that too condition has to meet to display a pop up message. That's what you interpret and never be. He's saying that on button clicked automatically. A.R Gone and performances comes up. So which is correct? And if you read this clearly, you're confused, OK? Just pass this video and try to understand. So with the plain English language, it's warm generally or traditionally, people lose in the market. There could be wrong in interpreting that. OK, then business analyst give this developer may assume this this time, and he never like this. OK. Cue amiable zooming in this fashion and develop test kits in this way. So that of course, there will be mismatch. And he would be raising an issue once you see that in the production and thereafter he would be. If developers is wrong and if it's already late and before releasing the project, then there is something less OK. If at least let's assume that developer made a mistake. If queuing is correct, then he could correct it and he can play the defect. And that is not a big deal, but it could still be interpreted in the wrong way and developer also interpreted in the wrong way. Then what happens? It goes into the lane, but when they start an argument and everyone have their own version. So that is why people generally put in meetings as a sign off look. Whenever they develop test cases, they get to off signed off the test case as a. Business analyst, that's what people traditionally do to overcome this problem. So however, there are some minor problems are still going on in understanding this the way people are writing. So to overcome this disadvantage. If we all come in to a common platform of showing or describing software behaviour, then there is no point of misleading from actual behaviour. OK, so this is where Justin comes into the picture. So if BEEI wants to write or wants to show a software business requirement, he has to define that in jerkin syntax so they can define some standards that if he used our standards in describing this test case, then it would be very clear for a developer architect to interpret it, OK? That is where this comes into picture. And we say as a BDD behavior driven development, OK, we explicitly define the behavioral software requirement using this jerkin language, so it can be also served as a business attainable and domain specific language. OK, so you will be saying here how to exactly write a discussing jerkins index. So here I just want to throw a light on what is Typekit, and I hope you understand this example of misleading of interpretation. Right, so that is one main thing, and the killers, which you frequently see in cucumber are scenario future feature, film, scenario outline and step definition. OK. These keywords you will commonly see when you are working with cucumber automation on. If you go to any interview, obviously there will be a question from one of the schema. OK, what is this and how it looks? That's a common thing. So this tool will be specifically concentrate when we are working on real automation things. OK, now I want to concentrate on these three parts. So first, what is scenario? In cucumber test cases are presented as scenarios. OK, we generally talk them in terms of scenarios instead of excuse. So in traditional world, we see it as a test case. But when we are dealing that with cucumber, we should see it as a scenario because this is how we use a key word in that framework now. So as I said, this is a test case and this test case should be represented in jerkin state, isn't it? So each and every scenario is nothing but a second language. So what are what do you want to express? You need to express that. Now what does Jerkin takes as an input and how do you define it with this index? OK, let's understand these three times now. So then you want to write your test case here. The business requirement are meant to be a one to express is making credit card payment by selecting minimum amount option. So if you want to make any credit card payment, you would have an option to pay a minimum bill or you will have an option to best complete statement balance. Or you will also have an option to pay other amount and you can mention the amount in it. So any of these three fields you have to use to pay even greater. So here, let's assume that functionality is to check if minimum due payment floor is working or not. OK, if credit card bill is about $500 and $25, your minimum payment. So there is an option to select a minimum payment and you have to pay that friendly fee. So this is a functionality which you need to verify. So to express this to experts and to define this because after that, behavior detection uses three key words here. Given then and then OK. So given is to test this. What are the preconditions like before you begin testing this functionality? What you need to know and what you have to fulfill? OK, in this case to fulfill this credit card payment. First of all, you should be on big credit card page. OK. This is a requirement. So here your business is clearly telling that from which page you can test this functionality. OK, if you're simply simply let go and make the Connecticut payment that late card payment, maybe from multiple pages. But when you navigate to your net banking, same credit card payment could be from the left side, not the navigation links, or you can access it from credit card tab. Are there could be any link in the future page for the instant I clicked link references to Bakelite card. So first, we need to understand on which tab on which model we are testing this fund that he has to provide a given like preconditions are mentioned mixed when once you are on that page with preconditions fulfilled now to make this payment, what action you need to perform? OK, that stands the event. The purpose of many is to describe user action to make this payment happen. What are the actions we need to perform when user fills our details? OK, he has to obviously fill that data out of making payment and which from which account. And then he should select minimum amount option. Yes, selected. And for this one, if there are multiple user actions, you can comfortably use and operate. OK, you can use and keyword, and you can concatenate all you want actions under this one. OK, that's like once all the details are filled and minimum amount option is given. And user will go and click on pay button obviously has told all that this is an action. And then what is their list like? OK, so once user fulfill the conditions and what after he makes a payment? And then what is the purpose of this flaw? The result, right? That result should be written and then keyword here then stands for parts. Then step is to observe the expected output. Here, credit card confirmation page is displayed. This is our expected output. You'll see that a simple task is making minimum pay. Dumont great card if they want to express that, he can do this right in one single line. But from that, we will have a lot of questions like from which navigation we have to do what is the flow and what is the outcome expected. So all of these, if they define in this fashion and how qualities? This is what we say as a behavior driven development. So in cucumber, this way of writing in this case is called as scenario. OK. So one caution, please remember that don't assume that if business analyst does not give you the skills in this way, you cannot work with cucumber. OK. Give me, given your simple, plain text on what I have shown here. If you want to automate your best guess you can. You would like selenium test if it is a web based. OK, so if you want to be a school combat framework, make sure you convert this test to get into this fashion. You define it as an automation tester when you have a requirement in a single page line. Read that requirement. And obviously, when you want to automate something, you have to start from the basics, from where you want to navigate and you have to automate all that actions. And then the end, you need to validate, right? By using assertions so fast, convert your testicles into this model and then you can use cucumber automation to automate your excuses. OK. So just don't think that if you want to be out, if your manager or whoever gives your best guess is not in the standard, you cannot use cucumber because mostly people say that we don't get like this. So can't they use cucumber? OK, you can use cucumber, for sure. Just convert this test. Whatever you got as a plain English into this, it's a simple step, right? Right in your own fashion. And then you can happily automate it. OK, so let's continue in our next lecture. Thank you.