Agile Mëtteg #5: Agile Testing

64

Transcript of Agile Mëtteg #5: Agile Testing

Page 1: Agile Mëtteg #5: Agile Testing
Page 2: Agile Mëtteg #5: Agile Testing

25 June 2015

Agile Mëtteg : Agile Testing

Page 3: Agile Mëtteg #5: Agile Testing

ObjectivesThis session will focus on a Agile Testing and provide you with practical examples and techniques to help your team understand what is behind this approach.

AgendaLet’s get acquaintedWhat is agile testing?Unit testing Test Driven Development Acceptance testing Behavior Driven Development Q&A

28 Feb. 2013 3

OBJECTIVES & AGENDA

Introduction to agile methods

Page 4: Agile Mëtteg #5: Agile Testing

4

LET’S GET ACQUAINTED

28 Feb. 2013 Introduction to agile methods

Page 5: Agile Mëtteg #5: Agile Testing

Introduction to agile methods 528 Feb. 2013

Eric FERROT

Senior Software Developer

ME

Page 6: Agile Mëtteg #5: Agile Testing

6.

AGILE PARTNER

28 Feb. 2013 Introduction to agile methods 6

Software Development

Knowledge Transfer Innovation Support

Consulting

Page 7: Agile Mëtteg #5: Agile Testing

Introduction to agile methods 7

YOU

What about you?

What do you know about agility?What are your expectations?

28 Feb. 2013

Page 8: Agile Mëtteg #5: Agile Testing

8

WHAT IS AGILE TESTING?

28 Feb. 2013 Introduction to agile methods

Page 9: Agile Mëtteg #5: Agile Testing

9

WHAT IS TESTING?

28 Feb. 2013 Introduction to agile methods

Page 10: Agile Mëtteg #5: Agile Testing

WHAT IS SOFTWARE TESTING?

Definition:

Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test.

(Wikipedia)

Page 11: Agile Mëtteg #5: Agile Testing

WHAT IS SOFTWARE TESTING?

Definition:

Software testing is a way to measure the quality of the product using tests.

(me)

Page 12: Agile Mëtteg #5: Agile Testing

MEASURING QUALITY

Measuring quality using tests:tests to find defectsfunctional / non-functional testingManual / automated testsa LOT of kinds of tests

15 July 2010 12

Page 13: Agile Mëtteg #5: Agile Testing

SO WHAT IS AGILE TESTING ?

… AND WHY?

… AND HOW?

Page 14: Agile Mëtteg #5: Agile Testing

Traditional / Waterfall approachTesting is done after the development

Requirements Analysis Design Developmen

t Test Release

WHAT IS AGILE TESTING?

15 July 2010 Agile Mëtteg - Agile testing 14

Page 15: Agile Mëtteg #5: Agile Testing

Agile approachTesting is part of the development process

WHAT IS AGILE TESTING?

15 July 2010 Agile Mëtteg - Agile testing 15

Iteration 1

Requirements

Analysis

Design

Development

Test

Release

Iteration 2

Requirements

Analysis

Design

Development

Test

Release

Iteration n

Requirements

Analysis

Design

Development

Test

Release

No specific order

Page 16: Agile Mëtteg #5: Agile Testing

Traditional / Waterfall approachTesting is done after the developmentClear separation of roles

WHAT IS AGILE TESTING?

15 July 2010 Agile Mëtteg - Agile testing 16

Programmer

Domain Expert

Tester

Page 17: Agile Mëtteg #5: Agile Testing

Agile approachTesting is part of the development processA whole team

WHAT IS AGILE TESTING?

15 July 2010 Agile Mëtteg - Agile testing 17

Programmer

Domain Expert

Tester

Programmer

Tester

Page 18: Agile Mëtteg #5: Agile Testing

Agile testing places an increased portion of the testing in the hands of the developers

Wait… WHAT?!?!I’m a programmer not a testerIt’s trivial I don’t need a testI don’t have time for testingMy code is very difficult to test

WHAT IS AGILE TESTING?

Page 19: Agile Mëtteg #5: Agile Testing

WHY AGILE TESTING?

WHY should developers write tests?

Fear / ConfidenceDo you dare to change the code? Tests = safety net

It places developers as users Better usability

It makes the code testable Better design

15 July 2010 Agile Mëtteg - Agile testing 19

Page 20: Agile Mëtteg #5: Agile Testing

WHY AGILE TESTING?

A better design

“How good the design is doesn't matter near as much as whether the design is getting better or

worse. If it is getting better, day by day, I can live with it

forever. If it is getting worse, I will die.”

(Kent Beck )

Page 21: Agile Mëtteg #5: Agile Testing

AGILE TESTING… HOW?

Agile testing… HOW?

Unit testingTest Driven DevelopmentAcceptance testingBehaviour Driven Development

Page 22: Agile Mëtteg #5: Agile Testing

BUT FIRST…

15 July 2010 22

Page 23: Agile Mëtteg #5: Agile Testing

A PAGE OF ADVERTISMENT!

15 July 2010 23

Page 24: Agile Mëtteg #5: Agile Testing

http://www.dinoeggsrebirth.com/

COMING THIS SUMMER

Page 25: Agile Mëtteg #5: Agile Testing

UNIT TESTING

Page 26: Agile Mëtteg #5: Agile Testing

UNIT TESTING

Definitions

Unit : Smallest testable part of an application

Unit test : A method to test a unit

Page 27: Agile Mëtteg #5: Agile Testing

UNIT TESTING

The „3A“ pattern

ArrangeAct

Assert

Page 28: Agile Mëtteg #5: Agile Testing

UNIT TESTING

F.I.R.S.T.

FastIndependentRepeatable

Self-ValidatingTimely

[Clean Code – Robert C. Martin]

Page 29: Agile Mëtteg #5: Agile Testing

UNIT TESTING

DEMO

Page 30: Agile Mëtteg #5: Agile Testing

COLLISION DETECTION

Page 31: Agile Mëtteg #5: Agile Testing

COLLISION DETECTION

Page 32: Agile Mëtteg #5: Agile Testing

COLLISION DETECTION

Page 33: Agile Mëtteg #5: Agile Testing

COLLISION DETECTION

Page 34: Agile Mëtteg #5: Agile Testing

COLLISION DETECTION

Page 35: Agile Mëtteg #5: Agile Testing

COLLISION DETECTION

Page 36: Agile Mëtteg #5: Agile Testing

COLLISION DETECTION

Page 37: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

Page 38: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

What is TDD? Difference to unit testing Write the unit test

Unit TestCode

FIRST!

Page 39: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

Red – Green – Refactor

Make it failwrite the test first

Make it workwrite the simplest implementation

Make it betterrefactor without changing the behavior

15 July 2010 Agile Mëtteg - Agile testing 44

Test

CodeRefactor

Page 40: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

TDD is not only about testingAlso called Test Driven Design

TDD is a methodology that helps creating a good design when

developing code.

Page 41: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

TDD is not only about testingAlso called Test Driven Design

TDD consequencesYAGNIDRYLaw of DemeterSingle responsibility principleInterface segregation principleInversion of control

GO

OD

DE

SIG

N !

Page 42: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

DEMO

Page 43: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

Page 44: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

Page 45: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

Page 46: Agile Mëtteg #5: Agile Testing

TEST DRIVEN DEVELOPMENT (TDD)

Page 47: Agile Mëtteg #5: Agile Testing

ACCEPTANCE TESTING

Page 48: Agile Mëtteg #5: Agile Testing

ACCEPTANCE TESTING

Unit testing tells us that the code is meeting the programmer‘s expectationsUnit testing is essential but not sufficient

Acceptance tests are specifications for the

desired behaviour and functionality of a system.

Customer orientedAbout the what and not the howUsually black box system testsIntegration tests character15 July 2010 Agile Mëtteg - Agile testing 53

Page 49: Agile Mëtteg #5: Agile Testing

ACCEPTANCE TESTING

Implementing acceptance tests means automation

Examples of automation tools:Framework for Integrated Test (Fit) is an open-source tool for automated acceptance testFitnesse is a webserver, a wiki and an automated testing tool based on Fit

15 July 2010 Agile Mëtteg - Agile testing 54

Page 50: Agile Mëtteg #5: Agile Testing

ACCEPTANCE TESTING

DEMO

Page 51: Agile Mëtteg #5: Agile Testing

BEHAVIOUR DRIVEN DEVELOPMENT (BDD)

15 July 2010 Agile Mëtteg - Agile testing 56

Page 52: Agile Mëtteg #5: Agile Testing

BEHAVIOUR DRIVEN DEVELOPMENT

Behaviour Driven Development (BDD)

Evolution of TDD introduced by Dan NorthUsing terminology focused on the behavioural aspects of the system rather than testing

Unit ≠ behaviour Focus on why the code should be created Business value > Code Specification > Test

15 July 2010 Agile Mëtteg - Agile testing 57

Page 53: Agile Mëtteg #5: Agile Testing

BEHAVIOUR DRIVEN DEVELOPMENT

Outside-in methodology from the known to the unknown

Helps the developer to think YAGNI Leads to better design BDD = Behaviour Driven Design

Don‘t forget about the roots (TDD) Red – Green – Refactor

15 July 2010 Agile Mëtteg - Agile testing 58

Page 54: Agile Mëtteg #5: Agile Testing

BEHAVIOUR DRIVEN DEVELOPMENT

Ubiquitous language based on the business domain

Common vocabulary between participantsMinimizes translationAvoids miscommunicationMakes it easier to validate early

15 July 2010 Agile Mëtteg - Agile testing 59

Domain Expert

Programmer

Tester

Page 55: Agile Mëtteg #5: Agile Testing

BEHAVIOUR DRIVEN DEVELOPMENT

Story frameworkEach feature is captured in a „story“, which defines the scope of the feature along with its acceptance criteria

Feature

Feature: TitleAs a [role]I want [feature]So that [benefit] Feature: End of Agile Mëtteg session

As a speakerI want to end the session in a beautiful waySo that the audience is very impressed

Page 56: Agile Mëtteg #5: Agile Testing

BEHAVIOUR DRIVEN DEVELOPMENT

Scenario / Acceptance criteria

Scenario: TitleGiven some initial context,And some additional context,When an event occurs,Then ensure some outcomes

Scenario 1: Tim saves some dino eggsGiven Tim is on screenAnd Tim is holding 3 eggs,When Tim warps out,Then the eggs disappearAnd player‘s score is increased by 6 points

Scenario 2: Tim collects a red lockGiven Tim is on screenAnd a red lock is on screen,When Tim touches the red lock,Then the red lock disappearsAnd a nice message is shownAnd a wonderful music is played

Page 57: Agile Mëtteg #5: Agile Testing

BEHAVIOUR DRIVEN DEVELOPMENT

Several existing tools for automationJBehave, NBehave, JSpec, NSpec, CppSpec, PHPSpec, SpecFlow, RSpec, Cucumber, …

Executable specification Quick feedback and regression testing Requirements are tests Tests are documentation

15 July 2010 Agile Mëtteg - Agile testing 62

Page 58: Agile Mëtteg #5: Agile Testing

BEHAVIOUR DRIVEN DEVELOPMENT

DEMO

15 July 2010 Agile Mëtteg - Agile testing 63

Page 59: Agile Mëtteg #5: Agile Testing

SUMMARY

15 July 2010 Agile Mëtteg - Agile testing 64

Page 60: Agile Mëtteg #5: Agile Testing

SUMMARY

Some things to remember about Agile Testing:Testing is part of the development processWhole-team approach: roles are not strictly separated like in a traditional approachBuilding a testable architecture leads to a better designUnit tests and acceptance tests are complementaryUse agile practices: TDD, BDD, Continuous Integration

Page 61: Agile Mëtteg #5: Agile Testing

QUESTIONS & ANSWERS

28 Feb. 2013 Introduction to agile methods 66

Page 62: Agile Mëtteg #5: Agile Testing

67

YOUR FEEDBACK

28 Feb. 2013 Introduction to agile methods

Page 63: Agile Mëtteg #5: Agile Testing

Introduction to agile methods 68

R.O.T.I for this SESSION

28 Feb. 2013

Source: www.qualitystreet.fr

Page 64: Agile Mëtteg #5: Agile Testing

THANK YOU

28 Feb. 2013 72Introduction to agile methods

Retrouvez nous sur :

Agile Partner: www.agilepartner.net & http://blog.agilepartner.net