1.Define what is Cucumber?
Cucumber is a Behavior Driven Development (BDD) tool. Cucumber is a tool that executes plain-text functional descriptions as automated tests. The language that Cucumber understands is called Gherkin.
In BDD, users (business analysts, product owners) first write scenarios or acceptance tests that describes the behavior of the system from the customer’s perspective, for review and sign-off by the product owners before developers write their codes.
2.Cucumber execution starts from where ?
Cucumber execution will starts from support. In support first it will load the env.rb file then it will load hooks.rb and then it will start execute feature file scenario steps.
3.Define what is support, env.rb and hooks.rb ?
4.Define what is profile in cucumber ?
Ex: cucumber features -p regression
5. Define what are before, after, beforeStep and afterStep hooks?
6.Define what are cucumber tags? why we use the tags ?
cucumber tags used to filter the scenarios. We can tag the scenarios and we can execute the scenarios based on tags,
We can add tags to scenarios with @
We can use following command to execute a cucumber tagged scenarios
cucumber features -t @<tag_name>
Ex: cucumber features -t @test
7. Define what is cucumber dry run ?
Cucumber dry run is used to compile cucumber feature files and stepDefinitions. If there is any compilations errors it will sDefine How when we use dry run
Ex: Cucumber features –dry-run
8.How to run a particular scenario from a feature file?
We can run particular scenario from a feature file by giving the scenario line number
Ex: cucumber features/test.feature:21
9. Define what is scenario outline ?
10. Define what are the keywords that we use in cucumber scenario steps ?
We use Given,when,Then,And and But keywords in cucumber scenario steps
11.Is it mandatory to use the keywords while writing scenario steps ?
No it is not mandatory to used keywords while writing scenario steps.
We can write the scenario steps like the following without using keywords
* I am on the landed page
12.Define How to generate cucumber execution reports ?
We can use the following command to generate html reports.
–format html –out report.html –format pretty
13.Define How to run a particular scenario from a feature file ?
We can run particular scenario from a feature file by giving the scenario line number
Ex: cucumber features/test.feature:21
14.Define what is Cucumber and Define what are the advantages of Cucumber?
To run functional tests written in a plain text Cucumber tool is used. It is written in a Ruby programming language.
Advantages of Cucumber
15.Define what are the 2 files required to execute a Cucumber test scenario?
The 2 files required to execute a Cucumber test scenario are
16. Define what is feature file in Cucumber? Define what does feature file consist of ?
Feature file in cucumber consist of parameters or conditions required for executing code, they are
17. Give an example of behaviour driven test in plain text?
18.Explain Define what is Scenario Outline in feature file?
Scenario Outline: Same scenario can be executed for multiple sets of data using scenario outline. The data is provided by a tabular structure separated by (I I).
19. Define what is step definition in Cucumber?
A step definition is the actual code implementation of the feature mentioned in feature file.
20. Give the example for step definition using “Given” function?
For example to make visitor visit the site “Yahoo” the command we use for given
Given (/^ I am on www.yahoo.com$/) do
Browser.goto “http://www.yahoo.com”
end – This will visit www.yahoo.com
21. Define what are the difference between Jbehave and Cucumber?
Although Cucumber and Jbehave are meant for the same purpose, acceptance tests are completely different frameworks
22.Explain Define what is test harness?
A test harness for cucumber and rspec allows for separating responsibility between setting up the context and interacting with the browser and cleaning up the step definition files
23. Explain when to use Rspec and when to use Cucumber?
Rspec is used for Unit Testing
Cucumber is used behaviour driven development.
Cucumber can be used forSystem and Integration Tests
24. Define what is the language used for expressing scenario in feature file ?
Gherkin language is used to express scenario in feature files and ruby files containing unobtrusive automation for the steps in scenarios
25.Explain Define what is regular expressions?
A regular expression is a pattern describing a certain amount of text. The most basic regular expression consists of a single literal character
26.Define what is cucumber.yml file in cucumber ?
in cucumber.yml file we will create profiles
27.Define what softare do you need to run a Cucumber Web Test ?
28.Define what does a features/ support file contains ?
Features/ support file contains supporting ruby code. Files in support load before those in step_definitions, which can be useful for environment configuration.
29.Define what is BDD Framework.Define what is the benefit of BDD in selenium ?
30. Define what is #{} and Define How do you use it?
P42, interpolation. most case used as puts “#{x} + #{y}” = “#{x+y}”
31.Define what is error handling and Define How do you do error handling?
P584: Raise, Rescue
32.Define what is the difference between class and module?
P141, P142
Class can do: inheritance, having instance, while module CAN NOT. Can be required.
Module can do: make namespace to avoid name clash, can be included.
#instantiate from class within module
Module A
Class B
End
b= A::B.new
33.Define Cucumber Report:
Cucumber generates its own html format. Define However better reporting can be done using Jenkins or bamboo tool. Details of reporting are covered in next topic of cucumber.
34.Define what are the benefits?
35. What are cucumber tags? why we use the tags?
cucumber tags used to filter the scenarios. We can tag the scenarios and we can execute the scenarios based on tags,
We can add tags to scenarios with @
We can use following command to execute a cucumber tagged scenarios
cucumber features -t @<tag_name>
36.What does a features/ support file contains?
Features/ support file contains supporting ruby code. Files in support load before those in step_definitions, which can be useful for environment configuration.
37. Cucumber execution starts from where?
Cucumber execution will starts from support. In support first it will load the env.rb file then it will load hooks.rb and then it will start execute feature file scenario steps.
38.What is support, env.rb and hooks.rb ?
39.What is profile in cucumber?
We can create Cucumber profiles to run specific features and step definitions
We can use following command to execute a cucumber profile
cucumber features -p <profile_name>
Ex: cucumber features -p regression
40. There are three ways to invoke a method in ruby. Can you give me at least two?
Here, I’m looking for the dot operator (or period operator), the Object#send method, or method(:foo).call
object = Object.new
puts object.object_id
#=> 282660
puts object.send(:object_id)
#=> 282660
puts object.method(:object_id).call # (Kudos to Ezra)
#=> 282660