Cucumber may be a testing tool which supports behaviour driven development. This gives a method to write tests can understand, regardless of their technical knowledge. In BDD, users first situation or acceptance tests defines the behaviour of the system from customer’s viewpoint, sign–off by the product owners before developers code. This cucumber tool uses Ruby programming language.
What is BDD ?
Behavior driven development is a software development procedure that allows the tester/business analyst to create test cases in simple text language. BDD Transpires from TDD(test driven development) which allows the users to work with many test data with minimum intervention in the software code thereby helps to increase the reusability of the code, which is time saving approach in the software development.
How BDD works in cucumber?
We have many ways to test in cucumber testing framework
- Fund transfer should always take place if there is enough balance in source account.
- Fund transfer should take place if any destination a/c details are correct.
- Fund transfer will take place if password / rsa code / security authentication for any transaction entered by the user is correct.
- Fund transfer will take place even if it’s a bank holiday.
- Fund transfer will take place on the future date as set by the account holder.
There is test scenario becomes more explicable as- consider additional features like transfer amount X for an interval Y days/months, stop schedule transfer when total amount reaches Z and so on. Here the general tendency is, the developers develop the features and write test case code will be complex and develop, will put off testing, still release.
In cucumber, BDD framework whatever we write into Given-When-Then steps. Consider an example,
Example feature would be Account creation or may be sign in or may be registration or payments on the bank website. We have a scenario which is a keyword then followed by the description, then all the actions which are termed as steps. We are clicking on the homepage and again clicking on the sign-in page like registration. We are entering all the details. Then expecting the “missing error” on the create account page which is visible.
Similarly in the second example which seems to be same as the first one we are not filling all the details like- we are not filling in email fields. This is what we have a basic structure where one scenario encompasses many scenario and scenarios consists many steps which contains Given –when –then.
Advantages of Cucumber:
- It is always helpful to involve business stakeholders who cannot easily read code.
- Cucumber Testing tool focuses on the end-user experience
- Here Style of writing tests allows for easier reuse of code in the tests.
- Quick and easy set up and also fast execution.
- Cucumber testing tool is efficient for testing.
Software tools supported by cucumber are:
This part of code has to be executed for testing, that belongs to different software tools like Selenium, Ruby on rails. But the cucumber will support almost all the software platforms and this is the reason why cucumber is popular. The cucumber based tools like Ruby on rails, Selenium, PicoContainer, Spring Framework, Watir.
Cucumber data tables:
When working on automation we can encounter many scenarios. Each of which may have different meaning and needs. We have been taking an example of login functionality for all social networking site where we need just to pass input parameters. There is like username, email address, password, re-enter password, birthdate, phone number. We can verify the new user registration number if it is unsuccessful after passing the incorrect inputs. When we enter the user name as new email address as email address and password and also re-enter the password as an birthdate as the gender and phone number user registration that should be successful. Here the data table is set input to be provided for a single tag. The tag can be given, when or Then.
Enter valid data on the page:
| Fields | Values |
| First Name | Tom |
| Last Name | Kenny |
| Email Address | firstname.lastname@example.org |
| Re-enter Email Address | email@example.com |
| Password | Password1 |
| Birthdate | 01 |
Then the user registration should be successful.
1. What is cucumber testing tool?
2. What are the features of cucumber testing tool?