How Cucumber Works
Cucumber was created in Ruby Language originally. Later support for different language were provided. Earlier it was just command line, Now you can execute it with tool like Eclipse and other.
During execution Cucumber first look for your features files which are written in Gherkin Language. Features file consist of scenario, scenario outlines, steps, tags, example etc. Each test case in Cucumber called a scenario. Feature file is group of this scenario. For example a Search Feature file consist of many search test cases.
Several scenarios are linked with their step definition, which are written in specific programming language like Java, Ruby etc. A Step definition are step of code mapped to single or many scenarios. This code is linked with other code and automation libraries. This code interact with browsers using browser specific drivers.
If the code in the step definition executes without error, Cucumber proceeds to the next step in the scenario. If it gets to the end of the scenario without any of the steps raising an error, it marks the scenario as having passed. If any of the steps in the scenario fail, however, Cucumber marks the scenario as having failed and moves on to the next one. As the scenarios run, Cucumber prints out the results showing you exactly what is working and what isn’t.
Cucumber Test Stack
Cucumber Testing Stack, which allows for visualization of the hierarchy of your project, from features down to automation libraries. The diagram of the Cucumber Stack gives you a much clearer structure of the Cucumber tests.
- Business Facing: The Features, Scenarios & Steps make up the Business Facing components of the Cucumber stack – this the Front-End File/Document that Business Analysts-Developers-QA Analysts use to define testing requirements.
- Technology Facing: In order for the above Business Components to work (i.e. execute the test) there needs to be some underlying technology that executes the tests in a browser, mobile device, emulator, etc. This brings us to the Technology Facing components of the Cucumber Stack.