Check Selenium Interview questions from 1 to 10 below:
Check Selenium-SDET-UIAutomation Questions set 21 to 30:
Check Selenium-SDET-UIAutomation Questions set 31 to 40:
Question Set 31-40
Behaviour-Driven Development (BDD) is a software development
process that Cucumber was built to support.
There’s much more to BDD than just using Cucumber.
HISTORY :Behavior-driven development was pioneered by Daniel Terhorst-North back in the early 00s, as he explained in a 2006 article called Introducing BDD. It grew from a response to test-driven development (TDD), as a way to help programmers on new agile teams “get straight to the good stuff” of knowing how to approach testing and coding, and minimize misunderstandings. BDD has evolved into both analysis and automated testing at the acceptance level. Liz Keogh, another BDD pioneer, started writing and speaking about it extensively beginning in 2004.
If you are new to BDD_Cucumber, please refer to the LINK HERE to install BDD_CUCUMBER
What is BDD?
BDD is a way for software teams to work that closes the gap between business people and technical people by:
- Encouraging collaboration across roles to build a shared understanding of the problem to be solved
- Working in rapid, small iterations to increase feedback and the flow of value
- Producing system documentation that is automatically checked against the system’s behaviour
We do this by focusing collaborative work around concrete, real-world examples that illustrate how we want the system to behave. We use these examples to guide us from concept through to implementation, in the process of continuous collaboration.
SDET Interview Question and Answers.
Jenkins Interview Questions and Answers.
Appium Interview Questions and Answers
Selenium Interview Questions and answers.
GIT Interview Questions and Answers
What is meant by a Feature file?
The feature file in Cucumber is the starting point of the Cucumber test execution.
A feature file can have a single or multiple scenarios
but normally it contains a group of scenarios.
The Feature file is the High-level description of the Application under Test.
The feature file format will be like file_name. a feature where
a single file contains a single feature.
What does the feature file consist of?
Feature files in cucumber consist of parameters and
conditions required for executing the code, they are
Feature
Scenario
Scenario Outline
Given
When
Then
How do I set up Selenium and Cucumber?
Can you share some of the dependencies
required to create a BDD framework?
Please find the entire pom.xml with all Dependencies
LINK HERE.
Remember that Maven has been used as Dependency Management here
What are the Primary and secondary keywords in BDD_CUCUMBER?
The primary keywords are:
Here are a few secondary keywords as well:
"""
(Doc Strings)|
(Data Tables)@
(Tags)#
(Comments)
IMPORTANT FACTS: The language you choose for Gherkin
should be in the same language as your users and domain experts
use when they talk about the domain. Translating between
two languages should be avoided.This is why Gherkin
has been translated to over 70 languages .
Write your first Cucumber script with Selenium from scratch
For the below scenario
Scenario: Finding some cheese Given I am on the Google search page When I search for "Cheese!" Then the page title should start with "cheese" |
ANS: The entire code from scratch has been written in the
POST HERE which you can use in your IDE and execute for practice.
I would suggest to first run it and then make the changes as per your project
What is the Scenario Outline for Cucumber-BDD?
Scenario outline is a method of parameterization of scenarios.
It is used to execute scenarios multiple
times using a different set of test data. Multiple
sets of test data are provided using "Examples"
in a tabular structure separated by pipes (| |)
Feature: Application Login Scenario Outline: Application Website Login Given Open browser When NewUser enters "<uname>" and "<password>" and "<send_text>" Then Message displayed Login Successful Examples: | uname | password | send_text | | side@ama.org | l444444e112 | automationreinvented| | asidu@ama.org | sid@123| automationreinvented | |
Explain when to use Rspec and when to use Cucumber?
Rspec is used for Unit Testing
Cucumber uses behaviour driven development.
Cucumber can be used for System and Integration Tests
Learn more about Rspec usage in the link HERE
How to Create HTML report in BDD_Cucumber with plugin?
Kindly refer to the LINK HERE for the entire code to generate HTML or JSON report with cucumber.
What is Step Definition?
Step definitions connect Gherkin steps to programming code. A step definition carries out the action that should be performed by the step. So step definitions hard-wire the specification to the implementation.
┌────────────┐ ┌──────────────┐ ┌───────────┐
│ Steps │ │ Step │ │ │
│ in Gherkin ├──matched with──>│ Definitions ├───manipulates──>│ System │
│ │ │ │ │ │
└────────────┘ └──────────────┘ └───────────┘
Step definition maps the test case steps in the feature files (introduced by Given/When/Then) to the code which
executes and checks the outcomes from the system
under test. Step definitions file has the actual code
implementation of the Scenario or Scenario Outline step.
Feature file:
Feature: Scenario: Given verify two values 'text', 'test' |
Step Definition:
public class Test { @Given("verify two values '(.*)', '(.*)'") public void verifytwovalues(String arg1, String arg2) { Assert.assertEquals(arg1,arg2); } |
What is Background in a Feature file?
Steps written under the Background keyword are executed before every scenario.
For example:
If you want to execute the same steps for every scenario like login to the website,
you just write those common steps under the background keyword.
Feature: Validation of Account Balance Background: Given I log in to the Application Scenario: Verify Positive Balance Given I have $5000 in my account When I withdraw $50 Then I should have $950 balance Scenario: Verify Zero Balance Given I have $5000 in my account When I withdraw $5000 Then I should have $0 balance |
Explain BDD flow?
Explain Cucumber Hooks?
Cucumber Hooks are blocks of code that can bused to run before
and after scenarios
using @before and @after methods.
It helps us eliminate the redundant code
steps that we write for every scenario
and also manage our code workflow.
public class Hooks {
@Before public void before(){ System.out.println("This will execute before every Scenario"); } @After public void after(){ System.out.println("This will execute after every Scenario"); } } |
Why do we use Monochrome & Dryrun in Cucumber?
Kindly check the LINK HEREas this post
has many most used BDD commands apart from Monochrome and Dryrun.
Do let me know if anymore needs to be added
Explain the basic scenario in BDD?
When we do Behaviour-Driven Development with Cucumber we use concrete examples to specify what we want the software to do. Scenarios are written before production code. They start their life as an executable specification. As the production code emerges, scenarios take on a role as living documentation and automated tests.
Feature: Login Feature Verify if the user is able to Login to the site
Scenario: Login as an authenticated user Given user is on homepage When the user navigates to the Login Page And user enters username and Password Then the success message is displayed |
Integration of Jira with Cucumber? How to setup and activate Cucumber on your JIRA project?
ANS: Checkout the post
HERE with all the steps and details. Do try to integrate the same if you are usinh JIRA for test management in your project.
TIPS:
Watir
Watir only works with Ruby.
Capybara
Capybara only works with Ruby.
*******************************************************************
For any doubts or career guidance, arrange a 1:1 call with me
********************************************************************