Ruby Cucumber Interview Questions
Q1. Define what's Cucumber?
Ans: Cucumber is a Behavior Driven Development (BDD) device. Cucumber is a device that executes simple-text practical descriptions as computerized exams. The language that Cucumber is familiar with is referred to as Gherkin.
In BDD, users (commercial enterprise analysts, product owners) first write situations or popularity assessments that describes the behavior of the gadget from the patron’s perspective, for evaluation and sign-off by the product proprietors before developers write their codes.
Q2. Cucumber execution starts from wherein ?
Ans: Cucumber execution will starts offevolved from support. In guide first it will load the env.Rb report then it's going to load hooks.Rb after which it'll start execute characteristic document scenario steps.
Q3. Define what's help, env.Rb and hooks.Rb ?
Ans:
Support is a foder in which we will setup cucumber associated support.
Rb file may be used to load the specified libraries for cucumber state of affairs execution
rb we will add hooks like earlier than, after, beforeStep and afterStep hooks
Q4. Define what is profile in cucumber ?
Ans:
We can create Cucumber profiles to run particular features and step definitions
We can use following command to execute a cucumber profile
cucumber functions -p <profile_name>
Ex: cucumber functions -p regression
Q5. Define what are earlier than, after, beforeStep and afterStep hooks?
Ans:
Before:execute earlier than the characteristic report execution
After:executes after the function record execution
BeforeStep:executes before the every step execution
AfterStep:executes after the each step execution
Q6. Define what are cucumber tags? Why we use the tags ?
Ans: cucumber tags used to filter the scenarios. We can tag the scenarios and we will execute the situations based on tags, We can add tags to eventualities with @
We can use following command to execute a cucumber tagged eventualities
cucumber capabilities -t @<tag_name>
Ex: cucumber features -t @check
Q7. Define what is cucumber dry run ?
Ans: Cucumber dry run is used to bring together cucumber characteristic documents and stepDefinitions. If there may be any compilations mistakes it's going to sDefine How whilst we use dry run
Ex: Cucumber capabilities –dry-run
Q8. How to run a particular situation from a characteristic report?
Ans: We can run specific situation from a feature document through giving the scenario line variety
Ex: cucumber functions/check.Function:21
Q9. Define what is situation define ?
We will upload check data in examples phase
Q10. Define what are the keywords that we use in cucumber situation steps ?
Ans: We use Given,when,Then,And and But key phrases in cucumber state of affairs steps
Q11. Is it obligatory to use the keywords even as writing situation steps ?
No it isn't always mandatory to used key phrases while writing scenario steps.
We can write the state of affairs steps like the following without the use of key phrases
* I am at the landed page
HubSpot Video
Q12. Define How to generate cucumber execution reviews ?
Ans: We can use the subsequent command to generate html reviews.
–layout html –out report.Html –format pretty
Q13. Define How to run a selected situation from a function record ?
Ans: We can run specific scenario from a characteristic record by using giving the situation line number
Ex: cucumber functions/test.Characteristic:21
Q14. Define what is Cucumber and Define what are the benefits of Cucumber?
Ans: To run useful checks written in a undeniable textual content Cucumber tool is used. It is written in a Ruby programming language.
Advantages of Cucumber
You can inolve business stakeholders who can't code
End user enjoy is priority
High code reuse
Q15. Define what are the 2 files required to execute a Cucumber check scenario?
Ans: The 2 files required to execute a Cucumber check scenario are
Features
Step Definition
Q16. Define what is function report in Cucumber? Define what does feature file encompass ?
Ans: Feature document in cucumber encompass parameters or situations required for executing code, they are
Feature
Scenario
Scenario Outline
Given
When
Then
Q17. Give an instance of behaviour pushed test in plain textual content?
Ans:
Feature:Visit XYZ page in abc.Com
Scenario:Visit abc.Com
Given:I am on abc.Com
When:I click on on XYZ page
Then:I ought to see ABC page
Q18. Explain Define what's Scenario Outline in feature file?
Ans: Scenario Outline: Same situation may be accomplished for a couple of units of statistics using situation define. The information is supplied by way of a tabular structure separated by means of (I I).
Q19. Define what is step definition in Cucumber?
Ans: A step definition is the actual code implementation of the function referred to in feature file.
Q20. Give the instance for step definition the usage of “Given” feature?
Ans: For example to make vacationer go to the site “Yahoo” the command we use for given
Given (/^ I am on www.Yahoo.Com$/) do
Browser.Goto “http://www.Yahoo.Com”
give up – This will go to www.Yahoo.Com
Q21. Define what are the distinction among Jbehave and Cucumber?
Ans: Although Cucumber and Jbehave are supposed for the equal purpose, reputation assessments are completely specific frameworks
Jbehave is Java based and Cucumber is Ruby primarily based
Jbehave are based on testimonies at the same time as Cucumber is primarily based on functions
Q22. Explain Define what is test harness?
Ans: A take a look at harness for cucumber and rspec allows for keeping apart responsibility among putting in the context and interacting with the browser and cleansing up the step definition documents
Q23. Explain while to use Rspec and while to apply Cucumber?
Ans: Rspec is used for Unit Testing
Cucumber is used behaviour driven development.
Cucumber can be used forSystem and Integration Tests
Q24. Define what is the language used for expressing situation in feature file ?
Ans: Gherkin language is used to express situation in function documents and ruby documents containing unobtrusive automation for the steps in eventualities
Q25. Explain Define what is everyday expressions?
Ans: A ordinary expression is a pattern describing a sure quantity of textual content. The maximum simple everyday expression includes a single literal man or woman
Q26. Define what's cucumber.Yml record in cucumber ?
Ans: in cucumber.Yml file we are able to create profiles
Q27. Define what softare do you need to run a Cucumber Web Test ?
Ans:
Ruby and its Development Kit
Cucumber
IDE like ActiveState
Watir ( To simulate browser)
Ansicon and rspec (if required)
Q28. Define what does a features/ help file includes ?
Ans: Features/ assist report carries supporting ruby code. Files in support load earlier than the ones in step_definitions, which may be useful for surroundings configuration.
Q29. Define what is BDD Framework.Define what is the gain of BDD in selenium ?
Ans:
BDD is becoming broadly generic practice in agile software program development, and Cucumber-JVM is a mainstream tool used to implement this exercise in Java. Cucumber-JVM is based on Cucumber framework, broadly utilized in Ruby on Rails international in addition to in Java and .Net.
Cucumber-JVM permits builders, QA, and non-technical or enterprise individuals to jot down functions and situations in a plain textual content record the usage of Gherkin language with minimum regulations about grammar in an average Given, When, and Then structure.
The feature record is then supported by means of a step definition record, which implements automatic steps to execute the scenarios written in a feature document. Apart from checking out APIs with Cucumber-JVM, we also can take a look at UI level exams by using combining Selenium WebDriver.
Q30. Define what is # and Define How do you use it?
Ans: P42, interpolation. Maximum case used as puts “#x + #y” = “#x+y”
Q31. Define what's mistakes coping with and Define How do you do errors managing?
Ans: P584: Raise, Rescue
Q32. Define what is the distinction between elegance and module?
Ans: P141, P142
Class can do: inheritance, having instance, even as module CAN NOT. Can be required.
Module can do: make namespace to avoid name clash, can be covered.
#instantiate from class inside module
Module A
Class B
End
b= A::B.New
Q33. Define Cucumber Report:
Ans: Cucumber generates its very own html layout. Define However better reporting may be performed the usage of Jenkins or bamboo device. Details of reporting are covered in subsequent subject matter of cucumber.
Q34. Define what are the benefits?
Ans:
It is beneficial to contain commercial enterprise stakeholders who can’t without difficulty examine code
Cucumber focuses on quit-user revel in
Style of writing checks allow for less difficult reuse of code inside the checks
Quick and easy set up and execution
Efficient device for testing
Q35. What are cucumber tags? Why we use the tags?
Ans: cucumber tags used to filter out the scenarios. We can tag the scenarios and we are able to execute the situations based totally on tags,
We can upload tags to scenarios with @
We can use following command to execute a cucumber tagged scenarios
cucumber capabilities -t @<tag_name>
Q36. What does a features/ help file contains?
Ans: Features/ help file consists of assisting ruby code. Files in guide load earlier than those in step_definitions, which can be beneficial for environment configuration.
Q37. Cucumber execution starts offevolved from in which?
Ans: Cucumber execution will starts offevolved from guide. In help first it'll load the env.Rb document then it will load hooks.Rb after which it'll begin execute feature file scenario steps.
Q38. What is assist, env.Rb and hooks.Rb ?
Ans:
Support is a foder wherein we can setup cucumber related support.
Rb file might be used to load the specified libraries for cucumber scenario execution
rb we will add hooks like earlier than, after, beforeStep and afterStep hooks
Q39. What is profile in cucumber?
Ans: We can create Cucumber profiles to run unique capabilities and step definitions
We can use following command to execute a cucumber profile
cucumber capabilities -p <profile_name>
Ex: cucumber capabilities -p regression
Q40. There are three ways to invoke a technique in ruby. Can you deliver me at the least two?
Here, I'm seeking out the dot operator (or length operator), the Object#send method, or method(:foo).Name
Ans: item = Object.New
places object.Object_id
#=> 282660
places object.Ship(:object_id)
#=> 282660
puts object.Method(:object_id).Name # (Kudos to Ezra)
#=> 282660
