Showing posts with label Automation Testing. Show all posts
Showing posts with label Automation Testing. Show all posts

BDD - Cucumber Quick Pro - Question and Answers

What are the primary keywords in Cucumber?

Following are the primary keywords in Cucumber:-
Feature: The Feature keyword's aim is to collect relevant scenarios and provide a high-level description of a software feature.
Rule: The Rule keyword is used to express a single business rule that should be followed. It adds to the information about a feature.
Example: This is a practical illustration of a business rule. It comprises a series of steps.
Given: The given steps are used to describe the system's initial context - the scenario's scene. It usually refers to an event that occurred in the past.
When: When describing an occurrence or an action, When is employed. It could be a user interacting with the system or an event generated by another system.
Then: Then steps are employed to indicate an anticipated outcome, or result.
Background: A background helps you to give the situations that follow it some context. It can have one or more Given steps, which are executed prior to each scenario but after any Before hooks.

Example:-

For an e-commerce website, we can have the following features:-
User registers and signs up on the website.
User tries to log in to their account using their credentials.
Users add a product to their cart.
User clicks on checkout now.
User pays for their items.
User logs out from the website.


 

Q1: What is Cucumber?

A1: Cucumber is an open-source tool for BDD that allows the execution of feature documentation written in the Gherkin language. It supports various programming languages like Java, Ruby, and JavaScript.  

        Q2: What is Gherkin?

A2: Gherkin is a plain-text language with a simple syntax used to describe the behavior of software without detailing how that behavior is implemented. It is the language that Cucumber understands.

Q3: What are the key components of a Gherkin scenario?

A3: A Gherkin scenario consists of Given, When, and Then steps:

    • Given: Describes the initial state or preconditions.
    • When: Describes the action or event that triggers the scenario.
    • Then: Describes the expected outcome or result.
                    
Background

Q4: What is the purpose of the Background keyword in Cucumber?

A4: The Background keyword is used to define a set of steps that are common to all scenarios in a feature file. It helps in reducing redundancy by specifying steps that are shared across multiple scenarios.

Q5: How is the Background section different from Scenario Outline?

A5: While both Background and Scenario Outline aim to reduce redundancy, Background is used for common steps shared by all scenarios in a feature, whereas Scenario Outline is used for running the same scenario with different sets of data.

Q6: Can you have multiple Background sections in a single feature file?

A6: No, a feature file can have only one Background section. The Background steps will be applied to all scenarios in that feature.

Q7: When would you use a Background over Scenario Outline?

A7: Background is used when you have common steps that need to be executed before each scenario in a feature. Scenario Outline is used when you want to run the same scenario with different inputs.

Hooks:

Q8: What is the purpose of Hooks in Cucumber?

A8: Hooks are special methods that allow you to perform setup and teardown actions before and after scenarios or other Cucumber events. They provide a way to customize the test execution lifecycle.

Q9: How do you define a Hook in Cucumber?

A9: Hooks are defined by creating methods with annotations like @Before and @After. These methods will be executed at specific points in the Cucumber execution lifecycle.


Q10: Can you use Hooks for setting up and tearing down resources like WebDriver?

A10: Yes, Hooks are commonly used for setting up and tearing down resources such as opening and closing a WebDriver session. This ensures that resources are properly managed before and after each scenario.

Q11: How can you control the order of execution for Hooks?

A11: Hooks can be prioritized using the order attribute in the @Before and @After annotations. Lower numbers indicate higher priority, and hooks with the same priority are executed in a random order.

Q12: Can you conditionally skip or run Hooks based on certain criteria?

A12: Yes, you can conditionally skip or run Hooks based on certain criteria by using conditional statements within the Hook methods. For example, you may skip a Hook if a specific tag is present or absent.

Q13: Are Hooks specific to a feature or can they be shared across multiple features?

A13: Hooks can be defined at the global level in a separate class or file, making them applicable to multiple features. Additionally, they can be defined within a specific step definition class to make them specific to that class.

Q14: How does Cucumber execute scenarios?

A14: Cucumber reads the feature files containing Gherkin scenarios and executes them using step definitions written in a programming language like Java. Step definitions map Gherkin steps to executable code.

Q15: What is a Feature file?

A15: A Feature file is a file written in Gherkin syntax that contains a high-level description of a software feature along with scenarios and steps. It typically has a .feature extension.

Q16: Explain the role of Step Definitions.

A16: Step Definitions are the implementation of Gherkin steps in a programming language. They bridge the gap between the human-readable Gherkin syntax and the actual automation code.

Q17: What is the purpose of Tags in Cucumber?

A17: Tags are used to organize and categorize scenarios. They provide a way to run specific groups of scenarios based on tags, enabling selective test execution.

Q18: How does Cucumber support data-driven testing?

A18: Cucumber supports data-driven testing through Scenario Outline and Examples tables. Scenario Outline allows the same scenario to be executed with multiple sets of data.

Q19: What is a Background in Cucumber?

A19: A Background is a way to group steps that are common to all scenarios in a feature. It helps in reducing duplication of steps.

Q20: How can you integrate Cucumber with other testing frameworks?

A20: Cucumber can be integrated with various testing frameworks like JUnit and TestNG. The integration is done through the use of Cucumber runners.





Easy steps to create Requirement Traceability Matrix (RTM)

A Traceability Matrix is a document that co-relates any two-baseline documents that require a many-to-many relationship to check the completeness of the relationship.
It is used to track the requirements and to check the current project requirements are met.



Advantages of Requirement Traceability Matrix (RTM):
  1. Gives Overview of ALL the requirements
  2. Shows how requirements are linked to Test Cases
  3. Makes sure 100% coverage of requirements
  4. Easy to prepare
  5. No special tool is required

How to prepare Requirement Traceability Matrix (RTM):
  1. Get all available requirement documents. For eg. Business Requirement Document(BRD), Functional Requirement Document(FSD), Technical Requirement Document(TSD)
  2. First list down All the requirements from BRD one by one with requirement ID#
  3. Now go to FSD, and list all respective functional requirements for each Business Requirements
  4. Open Test Scenario or Test Case document and link available TC IDs to respective Functional Requirements
Let’s take an example:

Business Requirement Document (BRD) :


This document is provided by the Client with high-level business Requirements. Suppose for Flight Booking Application it shows below 2 requirements
BR_1  Reservation Module :
It should allow the user to book one or more tickets, one way or a round way for future dates
BR_2  Payment Module:
User should able to make payment for booked tickets via Credit / Debit Card or through Reward Points

Functional Specification Document (FSD) :

This document is prepared by the Technical team which further elaborate business requirements into functional requirements that can be implemented in software.
Suppose above 2 business requirements in BRD have more detailed functional requirements:
BR_1  Reservation Module :
  • FR_1 : One Way Ticket booking
    • It should allow user to book one-way ticket
  • FR_2 : Round Way Ticket
    • It should allow user to book round way ticket
  • FR_3: Multicity Ticket booking
    • It should allow user to book one way or round way ticket for multiple cities
BR_2  Payment Module:
  • FR_4: By Credit Card
    • It should allow user to make payment by Credit Cards
  • FR_5 By Debit Card
    • It should allow user to make payment by Debit Cards
  • FR_6 By Reward Points
    • It should allow user to make payment by Reward Points

And you have written some test cases or test scenarios for each functional requirement.
   
So if we prepare simple Requirements Traceability Matrix (RTM) for the above example it would like as below:
Requarements Treaceability Matrix
You can also add Execution Status and Defects columns in RTM to view the overall status of all requirements along with Test Cases.

World’s most desirable Test Automation skills!

                                
                                 Most Desirable Test Automation skills!

In order to answer the question – “What are the most desirable test automation skills in the upcoming year of 2016?”, our research team took over the top job searching websites around the globe looking for the most popular and required technologies in the test automation field.
Most popular test automation frameworksMost popular test automation frameworks
Selenium is considered to be the world’s most popular framework. The most surprising fact regarding Selenium in the United States is that it’s almost 300% more demanded than QTP/UTF which has made to the second place. This huge gap practically renders all the other technologies as less relevant for people looking to learn a new automation framework.
The broad use of Cucumber and the fact that Behavior-Driven Development (BDD) and testing has become one of the promising technologies in Europe influence the rising popularity of the Ruby programming language. As can be seen in the graph above, Ruby for test automation has become the second most popular language in Europe, and the third most popular in the US.
We can summarize by saying that in case you are looking for test automation position in Europe, Cucumber Ruby may be the right buzzwords in your resume.
If your destination is India; Selenium or a premium solution such as QTP or Microsoft testing tools (Coded UI/Unit Testing) will most likely improve your chances in finding a job in the test automation field.
World’s test automation programming languages distribution
Most popular test automation programing languages in the world
In case you are debating on whether to acquire Java programming skills to improve your chances for sitting behind an interview desk, you probably on the right path. The combination of Java and Selenium are so far considered the most popular for test automation in the world.
The broad use of Python in test automation is already well known, yet our research reveals that Python is highly popular when used for internally developed tools.  This and the fact that it’s broadly used with Selenium contributes to its continuous and rapid growth in the US and Europe in specific.
Finally, if it hasn’t been clear so far, SQL is a very useful asset for all QA engineers.  SQL validation queries are very common and complementary to automated test scenarios, as it's broadly used with any of the existing programming languages.
Demand for mobile test automation experts Mobile test automation demand worldwide
The demand for mobile test automation experts is higher in the US compared to India, which is considered as very much lean in mobile skills demand for test automation compared to the rest of the world.
While discussing mobile technologies, acquiring test automation skills for iOS considered a must-have skill, while Android isn’t too far behind.  Therefore, we recommend targeting both technologies in order to increase your chances in finding a job in the mobile test automation field. You may refer to popular tools drill down here: Open Source Tools for Mobile App Test Automation’.
Operation Systems DistributionTest Automation for operation systems
Currently, the need for Linux automation experts is similar to Windows and continues to grow in the world of test automation across the globe, as also reflected in the growth of use in cross-platform programming languages such as (Java, Python, Ruby, etc). In any case, acquiring “advanced user” skills with Linux based distributions is necessary.
In addition, it is interesting to see the almost equal segmentation between desktop and mobile OSes (Linux<->Windows/ iOS<->Android). This trend may very much show that smartphone – mobile world is taking over the world.


#Reading #Writing #Learning #Skills #to #upgrate #recommend #to #change 
#Automation #Tesing #Automate #The #Manual #Efforts 
#Soni10.10 #hsoni2010 #harry #soni1010 #QualityEngineer