Top Banner
BDD FOR LEGACY SYSTEM Spin Lai
33
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Bdd for legacy system

BDDFOR LEGACY SYSTEM

Spin Lai

Page 2: Bdd for legacy system

Testing

Page 3: Bdd for legacy system

Testing, who doesn’t know it?

Page 4: Bdd for legacy system

Testing

Unit test

Tests the smallest unit of functionality

Integration test

Test the result combination functions correctly. 

Acceptance test

Tests on the full system to see whether the application's functionality satisfies the specification

Page 5: Bdd for legacy system

Testing

TDD (Test-driven Development)

BDD (Behavior-driven Development)

FDD (Feature-driven Development)

MDD (Model-driven Development)

DDD (Domain-driven Design)

Page 6: Bdd for legacy system

So, what is BDD?

Page 7: Bdd for legacy system

Behavior-driven Development

A software development process

Emerged from TDD

Focus on “what” to test rather than “how” to test

Use examples to illustrate behavior

Writing test cases in a natural language that non-programmers can read

Using Domain Specific Language

Page 8: Bdd for legacy system

Gherkin Language

Page 9: Bdd for legacy system

Gherkin Language

Use for describe the test scenarios

Page 10: Bdd for legacy system

Why BDD?

Page 11: Bdd for legacy system

Why BDD ?

Executable specifications

Business needs tie directly to the code

Tests are easier to maintain (stable)

Page 12: Bdd for legacy system

Why BDD ?

Provides a common domain language for

User / Stakeholder

Project Manager

Developer

QA

Encourage collaboration between different roles

Page 13: Bdd for legacy system

The obstacle : Legacy system

Page 14: Bdd for legacy system

Legacy System

It wasn’t designed with automation in mind

Web elements with no identifier or meaningful classes

Limited control of the source code

Works, but hard to maintain

Page 15: Bdd for legacy system

So, how?

Page 16: Bdd for legacy system

BDD for legacy system

Think about the capabilities

Group the scenarios

What kind of contexts (the Givens)

What kind of outcomes (the Thens)

The events (the Whens)

Page 17: Bdd for legacy system

Tools

Page 18: Bdd for legacy system

Tools

Selenium

Behave

PyHamcrest

Page 19: Bdd for legacy system

Selenium

Automated web testing framework

Selenium IDE

Selenium Remote Control

Selenium Client API

Selenium WebDriver

Page 20: Bdd for legacy system

Selenium Practices

UI Mapping

Page Object design pattern

Three levels of UI test automation

Page 21: Bdd for legacy system

Selenium Practices

UI Mapping

Page Object design pattern

Three levels of UI test automation

Source : http://gojko.net/2010/04/13/how-to-implement-ui-testing-without-shooting-yourself-in-the-foot-2/

Page 22: Bdd for legacy system

Behave

Feature

Scenario

Step

Tag

Page 23: Bdd for legacy system

Behave - Feature

Composed of scenarios

Descriptions

Backgrounds

Tags

Page 24: Bdd for legacy system

Behave - Scenario

Describe the behaviors being tested

Composed of a series of steps

Page 25: Bdd for legacy system

Behave - Step

Take a line each

Begin with a keyword

“given”

“when”

“then”

“and”

“but”

Page 26: Bdd for legacy system

Behave - Tag

Can be used on

Features

Scenarios

Scenario outlines

Used for controlling your test

Page 27: Bdd for legacy system

PyHamcrest

Assertion matcher library

Predefined matchers

equal_to

has_properties

contains_string

ends_with

Page 28: Bdd for legacy system

Show time

Page 29: Bdd for legacy system

Recap

Page 30: Bdd for legacy system

Recap

BDD isn’t the only way to do testing

Use BDD tools to automate scenarios doesn’t means you’re doing BDD

Don’t start with tools, start by having conversations

Don’t stick to the BDD (Gherkin) format to have conversations

Page 31: Bdd for legacy system

References

Page 32: Bdd for legacy system

References

Page 33: Bdd for legacy system

Q & A