 Hello everyone. Welcome to the course video of Ruby with Cookumber, an online training to teach the techniques of BDD. Software testing help is a decade old organization which carry out wide variety of online courses. In popular demand we have introduced our new course of Ruby with Cookumber and the course is spread across 12 modules, each session lasting for around 120 minutes. More details about this session can be found on this link. The first six modules of this session are dedicated to learning of Ruby followed by teachings of BDD as a technique, introduction to Cookumber as a tool, learning of Gherkin as a language. Finally, we will understand how we can create down our own feature files and scenario files. We will also be using a live application, a live web application which will be used as a real-time project along with we will have also an implementation on web services. We will as well see as in part of this course how using another language like Java and another IDE like Eclipse we can set up the Cookumber environment and use it with tools like Selenium. Finally, we will be talking about how we can handle some generic errors etc. The course is primarily designed for QA testing professionals, people who want to learn BDD as a technique to improve their test automation ability. For team leads, for managers, for software development engineers, BDD as a technique is widely accepted now and there is a lot of demand of people to know about Ruby and Cookumber as a tool so that they can be used effectively in their project workspace. Well, that's about the core structure, how is it spread out, what all modules will be covered and who are expected to join this course. Next, we are going to talk about a small demo of this course in which I will be making you go through in general to understand as in what exactly is BDD, Cookumber. We will talk about briefly future file scenario file. Then I will take you to the step-by-step instruction to understand the real-time web application and how we can go ahead and create the first feature file or scenario file from a manual test case implemented using Ruby, Cookumber and executed as well. BDD stands for basically behavior-driven development which combines the general techniques and principles of test-driven development and allows across teams from developers to managers to analysts to testers to collaborate collaborate together and create artifacts and scripts which can be used across teams. Cookumber is a very famous and a widely used tool to implement BDD framework and to write acceptance test for web applications. It is created in Ruby. It basically allows automation of functional validation in easily readable and understandable format like plain English. Cookumber also supports a wide variety of other languages as well. A typical Cookumber project structure looks like this. In project you have got features folder. The feature folder contains feature files which are represented with .feature extension which basically represents the acceptance test of a web application. It contains a step definition file in which each feature is implemented and this is typically a .rb that's a Ruby file. You might also contain some support folder which contains some generic Ruby files for environment settings for general commands etc. And then finally you have got test results available. A feature file is typically a test automation step or an acceptance test file. A scenario file in Cookumber is called a test file which contains the steps that exactly tells us Cookumber as in what is to be done. Gherkin is the language which is used to write down this scenario file in using very typical keywords of given then given when and then keywords format. In here what is given, what is when and what is then let's understand them. So we will be typically generating notes during the core structure. So given as like a precondition it's like a state the system and the user is already in. So given as a state in which the system or the user is already present when are the steps user performs on the system is the output the system generates. So given you are on the login page when user types in the username types in a valid password types in the language to be selected and clicks on the sign in button then the system should show the account information page for that user. So that's how we basically generate our scenario files in the form of how the user is going to behave with the system and how the system is going to behave back with the user. So we are going to take a typical real time application which is effectively an e-commerce application to showcase the demo and implementation of a BDD technique via Ruby and cucumber. So our application is available on the URL carguruji.com slash shop. Let me open this application for you guys the e-commerce application which has got wide variety of flows. You can register a new user. You can log in with the help of an existing username and password. Once logged in you can log out from the application or you can go ahead search for a product and allow that product to be bought by clicking on buy now and taking it to add to cart checkout confirming the checkout paying by cash on delivery. So remember it's a dummy website so no order is actually being placed and then finally when the order is placed you can go ahead click on log off continue button to come out of this application. So this application has some of the flows like registration login log out search product buy product change profile information view orders lot of flows are available from this live web application. So in them we are going to pick up a very typical manual test case for login. So what are my steps for login my steps are open the application click on the my account link type username type a password click on the sign in button and then I add my validation validate availability of a log off link or presence of a text on a page click on log off and click on continue button that's a typical manual test case you will see being implemented by the testing team but let's say we are using now a BDD way of representing this scenario of login log out not only this artifact generated is useful for your testing team it is also useful for your business analyst it is also used for your development team rather all these teams can use just this one artifact to drive their work and that's the beauty of BDD it reduces the workload and the effort to generate different artifacts by different teams thus introducing the problem of Chinese whispers where client wanted something and every team had their own implementations or assumptions of this is how the system should behave so it reduces all that workload and effort and it provides a common language which can be so spoken across teams and a common artifact document which can be consumed across teams to do their work so let's look at a scenario file for the login logout how it looks like using the given when then keywords scenario log into the application and then log out in simple English given you are on the homepage of your application when I will click on my account link when I will type the username when I will type the password when I will click on the sign in button so these are first the precondition the state your system and user is in then the set of actions the user performs sorry when the set of actions the user perform and then the output you should see log off link on the page then you will click on the log off link and click on the continue button so that you can finally log out from the application so I have converted the manual test case to a scenario file in BDD and this is how a step definition file which is effectively implemented using Ruby as a language and regular expression technique would look like so given in a regular expression format I'm searching for this pattern so when this statement will be matched there would be a set of steps available just below this command to execute the action to open the homepage then we will have a set of actions available to click on the my account link then we will have a set of actions available to type on the username and to perform this set of actions I will be basically using an underlying test automation tool for us it is going to be selenium selenium is a very popular open source tool to test web applications and we are going to use another tool which is basically a gem file over selenium which creates and provides some very useful wrapper functions over selenium known as capybara so using capybara selenium we are going to write down this test let's see how so I'm using a very famous editor called as ruby mine available from jet brains this is my project folder structure module seven contains features folder which contain these feature files and my step definition folder which contains implementation in a ruby program of this feature file so that they can be executed let's look at the login logout dot feature file so this is my feature file as mentioned with the given when then keywords let's look at the login logout step definition file which is implemented using the capybara gem and selenium test automation tool so for the command which will match the pattern I am on ok omar's home page I am giving the command to visit the website then I'm going to click on the link my account which is again recognized by this regular expression pattern and stored in this INP variable so this all is basically ruby commands on the capybara commands fill in is like typing in the object recognized by the name email address the username typing in the object recognized with the password name the password provided and whereas this data is coming from this data is coming from the login logout feature file as you can see then you are going to click on the sign in button finally I have some validations that you should find the link log off on the page then you should click on the log off link click on the continue button and you should expect the page to have the content welcome back on screen so that you know that you are back to the home page so this is my login logout feature file each of the steps written down in feature file is implemented in this step definition file of the login logout and for each command we basically have got the capybara commands available to perform the action capybara underlying uses selenium as a test automation tool to automate the steps now to execute this program we will basically launch the command window and we will go to the path where this project structure is available so for me it is available in my cusers folder I'll go to module 7 in here I will type the command cucumber I'll select the features folder and I will specifically select the feature I want to execute for us it is the login logout feature once you do that the tools will get into action the cucumber will start reading the scenario file will try to find the matching step definition file once the matching steps are found it will find out the implementation of these capybara selenium commands it will perform the actions on your firefast browser as you can see and your login logout action is automated in such a simple manner so that that's and a lot of more things we will learn in this course of ruby with cucumber so what are you waiting for go ahead and join this course right now and you enroll yourself for this course the very first batch starts from 31st march timing being 7 p.m. pst it will be held two days in a week on Thursday and Friday so I'll wait for you all and I'll see you all on 31st March 7 p.m. pst shop thanks a lot I hope you all enjoyed this presentation and you are willing to take up that next challenge to increase your professional value worth and to meet your career goals see you all soon thanks bye everyone