Top Banner
How it can help your team be more productive? BDD
24

Руслан Плахута - Внедрение BDD в распределенные команды

Aug 15, 2015

Download

ITSpringBY
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 в распределенные команды

How it can help your team be more productive?

BDD

Page 2: Руслан Плахута - Внедрение BDD в распределенные команды

CONTENT

• Introduction• How we came to BDD?• What is BDD in general?• BDD with SpecFlow• Benefits

Page 3: Руслан Плахута - Внедрение BDD в распределенные команды

• Started as developer in 2006 at Litera• In 2009 moved to USA• In 2011 started at Levi9 Ukraine• Currently

• Head of .Net department• .Net Architect • Lead of Agile competence area in Kiev delivery

center• Scrum Master at Exact, running 2 teams

HOW I AM ?

Page 4: Руслан Плахута - Внедрение BDD в распределенные команды

WHAT WE ARE DOING AT EXACT

• Code design • SOLID• Clean Code

• XP practices• UI testing• Unit Testing• Integration Testing • Pair programming • TDD

Page 5: Руслан Плахута - Внедрение BDD в распределенные команды

RESULT

• Developer really thinking about code design

• Better code (design, coupling, patters, cleaner…)

• Test coverage increased• More trust in code• Better cooperation between SE• Developer more happier

Page 6: Руслан Плахута - Внедрение BDD в распределенные команды

PROBLEM

Time of releasing a feature has increased!

Page 7: Руслан Плахута - Внедрение BDD в распределенные команды

WHY?

• User story acceptance criteria are well defined• We did not change requirements during the sprint• We already have some mockups, flow diagrams• Team became more experience • Team produces even more code than before• Etc

• Looks like nothing has changed …

Page 8: Руслан Плахута - Внедрение BDD в распределенные команды

DEVELOPMENT FLOW

Dev

Test

PO check

Production

Dev

TestPO check

Page 9: Руслан Плахута - Внедрение BDD в распределенные команды

SCRUM REFINEMENT

Page 10: Руслан Плахута - Внедрение BDD в распределенные команды

ILLUSTRATED WITH SHARED EXAMPLE

Page 11: Руслан Плахута - Внедрение BDD в распределенные команды

DISCOVERING NEW ASPECTS

Page 12: Руслан Плахута - Внедрение BDD в распределенные команды

SOUNDS LIKE BDD, DOESN`T IT?

Page 13: Руслан Плахута - Внедрение BDD в распределенные команды

• It’s more than just testing, it’s a process.• Automated tests specifications in human-readable language• More collaboration between domain experts, product owners, QA

and developers.

Most useful for achieving automated acceptance testing:Together with a domain expert you define the acceptance criteria in a specification.This specification can be executed against the system under test.

WHAT IS BEHAVIOUR-DRIVEN DEVELOPMENT?

Page 14: Руслан Плахута - Внедрение BDD в распределенные команды

• Example• Expectation• Should• Behavior• Specification• Given When Then

• Test →• Assertion →• assert →• Unit →• Verification →• Arrange Act Assert

• … and so on

BDD IS MORE THAN “TDD DONE RIGHT”

Page 15: Руслан Плахута - Внедрение BDD в распределенные команды

Story: Returns go to stockAs a store ownerI want to add items back to stock when they're returnedIn order to keep track of stock

Scenario 1: Refunded items should be returned to stockGiven a customer previously bought a black sweater from me And I currently have three black sweaters left in stockWhen he returns the sweater for a refundThen I should have four black sweaters in stock

Scenario 2: …

User story(just scrum)

All scenarios that should be handled for this user story to be “Done”

STORY TO BDD SCENARIO

Page 16: Руслан Плахута - Внедрение BDD в распределенные команды

System under testSpecificationStory: Returns go to stockAs a store ownerI want to add items back to stock when they're returnedIn order to keep track of stock

Scenario 1: Refunded items should be returned to stockGiven a customer previously bought a black sweater from me And I currently have three black sweaters left in stockWhen he returns the sweater for a refundThen I should have four black sweaters in stock

Scenario 2: …

Given: prepare test data in the

system

When: trigger a function in

the system

Then: validate the system state

WHAT IS BEHAVIOUR-DRIVEN DEVELOPMENT?

Page 17: Руслан Плахута - Внедрение BDD в распределенные команды

• xBehave – for everyone (SpecFlow, NBehave)

• xSpec – for developers (MSpec, NSpec, )

2 TYPES OF BDD

Page 18: Руслан Плахута - Внедрение BDD в распределенные команды

SPECFLOW

PM> Install-Package SpecFlow.NUnit

Page 19: Руслан Плахута - Внедрение BDD в распределенные команды

FEATURE FILE

Scenario: login a as user

Given I am logged in as CustomerTrade: When I execute GET /api/Accounts/{id}Then the status code should be 200 And the result should contain the following: | Name             | AddressLine1   | | ConnectivityTest | Main street 12 |

Page 20: Руслан Плахута - Внедрение BDD в распределенные команды

[Given(@"I am logged in as (.+)")]public void GivenIAmLoggedIn(string name){ // do something in the system under test // application.login(name);}

We create a test language of regular expressions.We bind recognized sentences to C#/VB.NET commands.That’s why we call these definitions bindings.

WHAT IS BEHAVIOUR-DRIVEN DEVELOPMENT?

Page 21: Руслан Плахута - Внедрение BDD в распределенные команды

SpecificationStory: Returns go to stockAs a store ownerI want to add items back to stock when they're returnedIn order to keep track of stock

Scenario 1: Refunded items should be returned to stockGiven a customer previously bought a black sweater from me And I currently have three black sweaters left in stockWhen he returns the sweater for a refundThen I should have four black sweaters in stock

Scenario 2: …

C# / VB.NETTest case for each scenario

Bindings definition of a Test Language

MSTest/nUnit/xinutTest Runner

PASS/FAIL per scenario

parse all steps

WHAT IS BEHAVIOUR-DRIVEN DEVELOPMENT?

Page 22: Руслан Плахута - Внедрение BDD в распределенные команды

Where does BDD fit in?BDD can actually be applied at many levels, but is most effective for automated acceptance tests.

Unit tests are about software verificationAre we building the software right?

Acceptance tests are about software validationAre we building the right software?

WHAT IS BEHAVIOUR-DRIVEN DEVELOPMENT?

Page 23: Руслан Плахута - Внедрение BDD в распределенные команды

BENEFITS

• Speed up feature delivering by decreasing defects

• Helped facilitate a conversations with the business through a common language

• Developers and non-developers both writing tests and taking ownership.

• Better understanding what is covered by SE and QE

Page 24: Руслан Плахута - Внедрение BDD в распределенные команды

QUESTIONS