testing with easyb - agile developer · testing with easyb venkat subramaniam...

37
Testing with easyb Venkat Subramaniam [email protected] @venkat_s

Upload: others

Post on 14-Jun-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Testing with easyb

Venkat Subramaniam [email protected] @venkat_s

Page 2: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Testing with easybAgile Development

Sustainability

Circle of Expectations and Circle of Relevance

Types of Tests

Behavior Driven Development

Functional Testing

Where does it fit in?

what’s easyb?

Stories vs. specifications

Stories

Writing stories as executable documentation2

Page 3: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

What’s Agile Development?

The essence of Agile Development...

3

Page 4: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

What’s Agile Development?

Feedback Driven Development

4

Page 5: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Sustainability

Rapid feedback is good, but the pace has to be sustainable

No point running fast in the wrong direction

5

Page 6: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Circles of Feedback

6

CustomerExpectations/Relevance

ProgrammerExpectations

Page 7: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Team

7

Traditional

ProgrammersCustomers/

Domain Experts

Testers

Agile

ProgrammersCustomers/

Domain Experts

Testers

Page 8: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Traditional Testing

8

Requirements Analysis Design Coding Integration

Testing & Bug Fixing

Too late in the game

Often pressure to release

QA become defenders

Often looked at as adversaries

Page 9: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Agile Development

9

Testing starts early & is Continuous

Don’t wait until end of iteration to test–test frequently and regularly

Application is exercised constantly, no surprises later

QA become support

Not adversaries, become part of the team

Work with customer and programmers—co-located with them

Testing & Code Fix

Analysis/Design & Coding

Delta of Requirements

Page 10: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Tenet Of Testing

As a tester, your responsibility is to author tests, not to run them!

10

Page 11: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Why Automate Tests?

“Error rate in manual testing is comparable to the bug rate in the code being tested.”—Boriz Beizer.

11

Page 12: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Types of Tests

White-box testing

Black-box testing

Unit testing

Functional testing

12

Page 13: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Behavior Driven DesignIt is a TDD approach

It is a ubiquitous language

It is an executable documentation

It promotes communication

Helps develop common vocabulary and metaphor

Help you to get the "words" right

Can be used by programmers, testers, business analysts, domain experts, and customers.

13

Page 14: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Behavior and StoryYou can use BDD to express Stories and Behaviors

Story Framework and Spec Framework

Stories correspond to User Stories—to express behavior at application level

Spec or Behavior correspond to expectations at class level—to express behavior at service/component level

These can help express requirements that can be specified, understood, and negotiated by developers, testers, business analysts, and business customers.

14

Page 15: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Behavior

Each behavior is expressed as a test/exercise method

It tells what the object should do

Notice the keyword "should"—that's a main focus in BDD—the shoulds and the shouldn’ts

15

Page 16: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Building Stories

You may define user stories as a series of acceptance criteria as scenarios

It has the givens, events, and outcomes

That is

Given some initial condition(s),

When event(s) occurs,

Then ensure some outcome(s)

16

Page 17: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Functional Testing

Focused on what the application should do for the user

Features oriented

Often lead by customers and testers

Coarse grain

User stories can be expressed as executable documentation

17

Page 18: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Types of Tests and Levels

Code Meets

Customer’sExpectations

CodeMeetsYour

ExpectationsClasses/Models/...

Controls/Services/...

UI/Presentation/...

UnitTesting

FIT

easyb

SeleniumWatir

Page 19: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

easyb

It is a Behavior-Driven Design Tool

Started by Andy Glover

Express Story and Spec using Groovy Based Domain Specific Language (DSL)

Highly expressive

Can be used for Java and Groovy applications

Story Framework and Spec Framework

19

Page 20: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Story Example

20

file:money.story

Unintegrated or Pending Story

Page 21: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Specifications

21

file: purchaseSoda.specification

Page 22: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Running easyb

22

You can now simply run easyb storyfile.story

Page 23: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Personas

Personas help us communicate and relate to specific type of users and situations

For example, Jane may be rich customer, Bob may be saving hard so he can buy a new car

23

Page 24: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Creating Stories as Tests

24

Page 25: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Creating Scenarios

25

Page 26: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Detailing Story

26

Page 27: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Integrating the Test

27

Page 28: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Integrating the Test

28

Page 29: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Integrating the Test

29

After Implementing AccountService

Page 30: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

The and clause

30

Page 31: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Verifying

shouldBe, shouldntBe, equalTo, ...

ensure(expression1) { expression2 }

ensure(currentBalance) { oldBalance + 50 }

31

Page 32: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Grouping Methods

before and after

before_each and after_each

shared_behavior and it_behaves_as

32

Page 33: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Narrative

description “...”

narrative ‘customer deposits money’, {

as_a ‘checking account customer’

i_want ‘to deposit money’

so_that ‘I can save money for a new car’

}

33

Page 34: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Using -txtstory option

34

Page 35: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Using -html option

35

Page 36: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

-prettyprint option

36

Page 37: testing with easyb - Agile Developer · Testing with easyb Venkat Subramaniam venkats@agiledeveloper.com @venkat_s. Testing with easyb Agile Development ... Don’t wait until end

Venkat [email protected]

twitter: venkat_s

http://www.agiledeveloper.com

Thank you!