Selenium Interview Question and Answer Part 2
Selenium Interview Question and Answer Part 2
Behaviour-driven development, or BDD, is another agile software development process that encourages collaboration in a software project between developers, QA, project managers and the business team. It enables developers, QA, project
managers to understand the application without diving deep into the technical aspects.
BDD TDD
It is a Behavior centred development process IT is Test centred development process
BDD tests are written in a readable format using Given-When-Then TDD tests are written using programming languages like Ruby, JAVA
steps etc
BDD tests are readable by non-programmers TDD tests are difficult to read by non-programmers
Question 5: What are different Keywords used in cucumber-bdd for writing a Scenario?
Given
When
Then
And
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |
The Scenario Outline steps provide a template which is never directly run. A Scenario Outline is run once for each row in the Examples section beneath it (except for the first header row).
Feature file:
Feature:
Scenario:
Given verify two values 'text', 'test'
Step Definition:
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.
Question 10: How does the Junit Test runner class look like explain the same?
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
features="src/test/resources/features",
glue= "ca.testing.stepdefinitions",
tags = @regression,
dryRun = false,
strict = true,
monochrome = true)
public class TestRunner{}
@CucumberOptions are used to set specific properties for your cucumber test.
Properties are,
Group scenarios
@regression @sanity
Scenario: Verify Zero Balance
Given I have $1000 in my account
When I withdraw $1000
Then I should have $0 balance
@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");
}
}
Log4j
Extent Reporting
Object Repository
Question 15: Name any two testing framework that can be integrated with Cucumber?
JUnit
TestNG
Question 16:What are the two files required to run a cucumber test?
Feature file
Question 20: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 testing for the steps in scenarios.