{"id":2523,"date":"2015-09-15T09:04:17","date_gmt":"2015-09-15T09:04:17","guid":{"rendered":"http:\/\/www.gallop.net\/blog\/?p=700"},"modified":"2018-10-03T14:36:55","modified_gmt":"2018-10-03T09:06:55","slug":"successful-test-automation-with-selenium-and-cucumber","status":"publish","type":"post","link":"https:\/\/www.cigniti.com\/blog\/successful-test-automation-with-selenium-and-cucumber\/","title":{"rendered":"Successful Test Automation with Selenium and Cucumber"},"content":{"rendered":"
Selenium and Cucumber are a great combination when it comes to web application automation, as Cucumber allows you to write your tests quickly in English-like language and Selenium allows you to run on various combinations of browsers. Let us have a look at some details on how to put them together.<\/p>\n
The Basics<\/strong><\/p>\n Web application regression testing is done to assess the app compatibility across a range of browsers, but this method tends to be a burden on both time and money. A better method would be the use of multiple test suites to be driven across a number of browsers.<\/p>\n The obvious benefit of this approach is that errors and glitches get identified early in the production pipeline, and can be resolved almost immediately.<\/p>\n When using Selenium with Cucumber for test automation, tests are written in feature files that can be understood by various stakeholders in an agile environment such as the BA\u2019s. Cucumber also comes with its ability to support multiple scripts and programming languages, the Selenium API is one that allows to drive the browser.<\/p>\n An overview of the process<\/strong><\/p>\n Cucumber essentially acts as a common ground between developers and non-technical stakeholders. The BDD style is used in writing tests, which is easily comprehensible and doesn\u2019t require any deep knowledge of code (basic commands i.e., Given, When, Then). After the acceptance tests are written into feature files, Cucumber picks the feature steps and executes the step definitions defined in the respective programming language. The Selenium WebDriver API can be called in these step definitions to drive the browsers.<\/p>\n More details<\/strong><\/p>\n Cucumber does not communicate directly with the applications, it needs to be used in conjunction with tools such as Selenium WebDriver, and Cucumber acts more like an execution framework. Cucumber\u2019s use of English-like language (Gherkin) for its programming function, test case execution is supported with features and scenarios executed based on their definitions.<\/p>\n There are 3 steps for writing automated tests that deliver high value while requiring only low maintenance using Cucumber:<\/p>\n Concluding Words<\/strong><\/p>\n We\u2019ve described the working relationship between Selenium<\/strong> <\/a>and Cucumber here, but there are of course a number of BDD tools that can be used together for the purpose of building test automation suites that deliver high value to your business and do not require heavy maintenance.<\/p>\n Gallop Solutions \u2013 Specialists in Software Testing<\/strong><\/p>\n\n