Bdd for legacy system

33
BDD FOR LEGACY SYSTEM Spin Lai

Transcript of Bdd for legacy system

BDDFOR LEGACY SYSTEM

Spin Lai

Testing

Testing, who doesn’t know it?

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

Testing

TDD (Test-driven Development)

BDD (Behavior-driven Development)

FDD (Feature-driven Development)

MDD (Model-driven Development)

DDD (Domain-driven Design)

So, what is BDD?

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

Gherkin Language

Gherkin Language

Use for describe the test scenarios

Why BDD?

Why BDD ?

Executable specifications

Business needs tie directly to the code

Tests are easier to maintain (stable)

Why BDD ?

Provides a common domain language for

User / Stakeholder

Project Manager

Developer

QA

Encourage collaboration between different roles

The obstacle : 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

So, how?

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)

Tools

Tools

Selenium

Behave

PyHamcrest

Selenium

Automated web testing framework

Selenium IDE

Selenium Remote Control

Selenium Client API

Selenium WebDriver

Selenium Practices

UI Mapping

Page Object design pattern

Three levels of UI test automation

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/

Behave

Feature

Scenario

Step

Tag

Behave - Feature

Composed of scenarios

Descriptions

Backgrounds

Tags

Behave - Scenario

Describe the behaviors being tested

Composed of a series of steps

Behave - Step

Take a line each

Begin with a keyword

“given”

“when”

“then”

“and”

“but”

Behave - Tag

Can be used on

Features

Scenarios

Scenario outlines

Used for controlling your test

PyHamcrest

Assertion matcher library

Predefined matchers

equal_to

has_properties

contains_string

ends_with

Show time

Recap

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

References

References

Q & A