final paper/best practice/tutorial advantages of bdd...

13
Final Paper/Best Practice/Tutorial Advantages OF BDD Testing Preeti Khandokar Test Manager Datamatics Global Solutions Ltd

Upload: others

Post on 25-Apr-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Final Paper/Best Practice/Tutorial

Advantages OF BDD Testing

Preeti Khandokar Test Manager

Datamatics Global Solutions Ltd

Page 2: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Table of Contents

Table of Contents ....................................................................................................................................... 2

Abstract ...................................................................................................................................................... 3

Introduction ............................................................................................................................................... 3

Solution: ..................................................................................................................................................... 4

How we do it at Datamatics? ..................................................................................................................... 9

Conclusion: ............................................................................................................................................... 10

About Datamatics .................................................................................................................................... 12

Page 3: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Abstract

The purpose of this white paper is to bring out some of the best practices of testing that Datamatics is

following while working in Agile testing environment to overcome QA challenges especially around

behaviour driven development and associated testing

Following are some of the key things that are addressed in this document:

BDD Testing importance?

BDD Implementation?

Application Delivery in BDD?

Different Tools to implement BDD Processes?

Introduction

Behaviour Driven Development (BDD) is a product improvement process which advanced out of

many set up Agile practices and is intended to make them more accessible and effective teams. It has

developed to incorporate the more extensive picture of Agile Analysis and automated acceptance

testing.

BDD helps in beating a portion of the difficulties which teams’ experiences with standard Agile

methodologies.

Behaviour Driven Development (BDD) is a product improvement process that advanced from Test

Driven Improvement (TDD). BDD includes making features (containing scenarios), that are intended to

test different behaviours that your application ought to have. This is altogether done totally from the

point of view of an end client. BDD results in faster UAT cycles resulting in faster deployments. BDD

empowers better coordinated effort over all partners i.e. Clients, Developer’s and QA Team members.

BDD practice QA is an ongoing process with User Acceptance criteria which makes it the most

appropriate practice within Agile.

Page 4: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Problem Statement:

To understand a project, each team member has to go through high level documentation created by a

Business Analyst or the client. While reading the documentation, there is a possibility that the

requirement might be misunderstood. Based on this incorrect understanding, a faulty or buggy

product is developed; irrespective of Agile or Waterfall model.

It’s expected that the first step in every project is a discussion about the features, and behaviours of

the software to be built. A client or business person comes up to the development team and explains

what they want.

Sometimes these requirements come in form of an agile user story or in the form of design

documents. They could also come as flowcharts or mock-ups or through phone calls.

Many teams using Scrum and other agile methods still team suffer following problems.

Where to begin

What is in testing scope and what is not in testing scope

The amount to test in one go

What will be the test name?

How to analyse failed test cases

Solution:

Why BDD

BDD serves in providing better collaboration between Business Analysts (BAs), Developers, Testers, Customers, and end client. It sets a ground for an easily understandable common domain language for functional testing and for defining functional acceptance criteria.

What is BDD

BDD is referred to as Specification by Example and it practices TDD. Behaviour Driven Development is more about interactions with the application behaviour and not just unit testing. It forces developers to understand the responsibility of the method he is about to implement. Using various BDD tools, the acceptance criteria written to test the application can be used as guidelines for developers.

Page 5: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Benefits of BDD

Communication: BDD helps to build a framework for having the right conversations at the right time; which avoids repetitive specification meetings loops. Team Understanding: Strong collaboration result in early discovery of unknown specification, and helps everyone in the team to develop domain expertise.

Requirement Understanding: BDD helps in breaking down specification into small pieces of work, and helps the team to reliably predict and meet their delivery schedules. Better Build Quality: BDD helps to built and execute automated tests in early stages of development, which prevents defects at earliest stages of development. Automation: BDD framework makes it easy to turn specification into automated tests. These automated steps are already specified by the specification – QA only needs to write a method to perform each step’s operations.

BDD Process

Behavior Driven Development enables QA’s to create test scripts from both the developers' and the end client viewpoint. Before the beginning of any iteration; Developers, Project Managers, QAs, and end client define acceptance criteria which should pass in a given iteration, in-order to call the application successful and accepted. This way team comes up with a set of acceptance criteria. All these acceptance criteria are in straight forward English dialect. So, these acceptance criteria serve the purpose of documentation too. BDD gives another vocabulary, and in this manner, concentrates on composing a unit test. Fundamentally it is an element driven way to deal with TDD. It implies outside-in development starting with User Interface definition to code development. Based on acceptance criteria QA will create test scenarios for the given specification you would like to develop, and then follow the BDD process:

Page 6: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Create the Tests

Refactor the Code

[Pass]

[Fail]

[Fail]

[Pass Development stops]

[Pass

Development

continues]

Execute the Tests

Execute the Tests

Create Next Tests

1. Create the Tests 2. Execute the Tests– It Fails (Go Red) / It Pass (Go Green) and create next tests 3. Refactor the code and repeat steps 2 & 3 for each step until… 4. The Test Passes – Go Green 5. Pass Development continues 6. Pass Development stops and you can move on to the next feature

These acceptance criteria drive the developers into the development process. It enforces them to write the application code to get the current test step to pass, before moving on to the next step. This process gives a sense of gratification to developers every time a step execution passes. And they know with surety, which specification work and are bug free.

BDD Framework

Behaviour-Driven Development uses simple domain-specific scripting language. Domain Specific

Language focuses on a specific programming prerequisite. It is implemented by converting the

domain-specific statements into executable, automated tests.

BDD tests use as live documentation of application behaviour and are maintained as extensive and

reusable tests.

Page 7: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

There are many Integration testing frameworks that can be used with BDD.

Cucumber supports BDD framework. It offers a way to write tests that

anybody can understand, regardless of their technical knowledge. Cucumber can be implemented via

different programming languages such as Java, C#, and Ruby.

SpecFlow also supports BDD framework which is based on .NET Platform.

SpecFlow is an open-source tool and its source code is hosted on GitHub.

For specifying the Features SpecFlow uses Gherkin Syntax. Cucumber introduced Gherkin format and

is also used by other tools. Separate GitHub project is created to maintain Gherkin language, which is

independent of SpecFlow.

Benefits of BDD with SpecFlow

As compared to manual testing it reduces 40-80% of test execution time

BDD Feature file can be easily understood by anyone.

It creates easy and detail Test execution report.

Selenium, Test Complete and QTP can be integrated with SpecFlow easily

It supports multiple languages.

BDD uses “Given/When/Then” structure to explain specification:

• Given: Some initial Condition given by end client (e.g. Given the user has Application Url and enters

the Username/ Password).

• When: Expected action occurs in application (e.g. When the user presses the Login Button).

• Then: Expected outcome of the action (e.g. Then I expect to see Application Home Page).

Page 8: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Here is a simple example:

Code Behind:

Automation QA translates each step into a method, which is used to implement its Given/When/Then

step. The entire scenario is tested by running the corresponding methods step by step.

Page 9: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

BDD Team Roles

BDD team is consists of three main roles that are fulfilled by three different team members.

Developer translates user story scenario into a function which is used to implement the steps into

given in acceptance criteria.

Business Users are domain experts and understands application flows from a user’s point of view. This

role can be shared with product owner and business analyst.

Test Automation QA’s are responsible for implementing each scenario using the BDD framework,

according to the user stories that were created by the business users.

How we do it at Datamatics?

Our Focus at Datamatics, is to accelerate software testing process and deliver high quality products in

Agile Environment by using BDD Test automation framework.

At Datamatics, we implemented a Behaviour-Driven-Test across multiple projects. This approach is

single point of continuous interaction between the QA’s and End Client.

The feature file/application specification is divided into various test scenarios by QA’s. Test scenarios

are written using Gherkin language which includes the business situation, test data and acceptance

criteria.

The end client signs-off the feature/application specification based on test data they have provided in

acceptance criteria. And reports and dashboard are created in user’s language.QA team creates the

underlying Business layer/Service/UI Automated test scripts for the test scenarios.

By using Spec Flow or Cucumber tool the test scenario converts into step a definition which acts as

binder between test scripts and test scenarios. And these make sure that single interface is used to

execute any of tests.

We have implemented well structured test framework to ensure test scenarios are kept separated

from the interaction code to reduce the possibility of duplication of code. This ensures test scenarios

can reuse common code which reduces the QA’s test automation efforts. In other words simple

change in product development requires only small changes to the test automation scripts.

Page 10: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Product Under Test

Interaction ToolingSelenium WebDriver

Interaction Library

Page Objects, Utility

Classes

Test CasesScripts / BDD scenarios

(SpecFlow/Cucumber)

Reporting

BDD Reports, Test

Failures, Log Files

Test Data

Scenario Outline

Finally, it facilitates introduction of automation in early stages of application development

Conclusion:

The key is to achieve high quality product and test automation in the same sprint.

Our solution approach is used to reduce the complexity of test automation and making it more useful

for end client. It provides early and continuous feedback to the agile application development. It leads

automation at every level to achieve rapid development.

It supports early automation and early life cycle validation and single-click generation and execution of

automation scripts.

By developing test automation at an early stage we have achieved higher quality product at every

stage of product development.

It reduces 40-60 percent effort for automated test script generation over manual testing.

It ensures high defect detection rates (95-98%) due to high test coverage.

Page 11: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

Author Biography

Preeti Khandokar

Test Manager Datamatics Global Solutions Ltd. Preeti is Test Manager at DGSL. She has over 11 years of IT experience out of which 10 years are into

software testing. She has diversified experience into testing which includes Test Management,

SOA/Middleware testing, Agile Test Automation, Implementing solutions for DevOps testing, Web

Service testing, Mobile testing.

Prior to Datamatics he has worked with companies like Hitachi Consulting, Capgemini and Reliance

General Insurance where she has handled multiple roles of Testing Presales, Test Manager, Test

Architect, and Automation Tester. She has completed her BE-IT and CDAC. She has expertise in

handling onshore and offshore team.

Page 12: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

About Datamatics

Datamatics is a trusted partner to several Fortune 500 Companies globally for managing their End-to-

end Application Life Cycle & Business Critical Processes. Datamatics is a global Information Technology

(IT) and Knowledge Process Outsourcing (KPO) organization focused on delivering smart, next-

generation business solutions that help enterprises across the world overcome their business

challenges. These solutions leverage innovations in technology, knowledge of business processes, and

domain expertise to provide clients a competitive edge.

As a strategic partner, Datamatics helps its clients improve their business competitiveness and achieve

operational efficiencies. The benefits delivered by the Datamatics’ unique solutions include

accelerated time-to-market for new products and services, maximized productivity and efficiency in

business processes, shorter turn-around times for service delivery and lower total cost of ownership.

Datamatics’ next-generation solutions and the services span:

A cross section of industries including Banking & Finance, Insurance, Publishing,

Manufacturing, Research and Retail.

Varied business processes that transcend F&A, Enterprise Document Management, Portal

Management, Publishing Solutions, Application Development, Support & Testing, Data

warehousing & Analytics, Engineering & Embedded solutions, Billing solutions, Enterprise

Content solutions.

Datamatics has a geographically diverse portfolio of Fortune 500 client’s with a footprint across four

continents- Americas, Asia, Australia and Europe.

Page 13: Final Paper/Best Practice/Tutorial Advantages OF BDD Testingqaistc.com/2017/wp-content/uploads/2017/09/advantageofb... · 2017-09-01 · Final Paper/Best Practice/Tutorial Advantages

THANK YOU!