Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Solving communication problems
in distributed teams with BDD
Rodrigo Urubatan
Developer, Writer, Crossfitter, Archer
What is the biggest problem in software
projects?
What is the root cause for this
problem?
What do we need to solve this
problem?
How to solve this problem?
Ok, but how’s that going to help design
software?
• Business value is the key
• What is the next important thing the syste...
User Stories!!
•As a …
•I want to ...
•So that ...
•AS A BANK CLIENT
•I WANT TO USE THE
CASH MACHINE
•SO THAT I CAN TAKE
M...
Need to see it everywhere
But it is not enough!
Behaviour Specification
• Context
• Actions
• Verification
•GIVEN THERE IS MONEY IN MY ACCOUNT
•AND I HAVE A VALID CARD
•A...
But how much details can I get?
Have you seen that sintaxe anywhere before?
Did you remember where?
• In tester spreadsheets, sometimes with columns
instead of given/when/then
• It is almost the syn...
What if I use the same business words to name things in
code?
Let’s try that!
• GIVEN THERE IS MONEY IN MY ACCOUNT
• AND I HAVE A VALID CARD
• AND THE MONEY DISPENSER HAS MONEY
• WHEN ...
Wow! Everyone talks the same
language!
BDD Development cycle
Talk to the client,
write a user story
or
Select a user
story
Detail the
story into
scenarions
Autom...
OK, how is that different from TDD “Red,
green, refactor”?
• The main focus is not the test, in reality the automate step ...
Haven’t we forgot about test automation?
That same context sintaxe can be
automated by:
• Cucumber using gherkin - https://cucumber.io/
• Thoughtworks gauge - http...
Sample gherkin code
Feature: A sample code for my presentation
As a speaker
I want to have some code samples
So that every...
Sample cucumber RuBY code
Given(/^I'm on the google home page$/) do
pending # express the regexp above with the code you w...
SAMPLE CUCUMBER JAVA CODE
public class MyStepdefs {
@cucumber.api.java.en.Then("^I want to see "([^"]*)" in the results$")...
Sample gauge code
A sample code for my presentation
=============
As a speaker, I want to have some code samples, So that ...
SAMPLE GAUGE JAVA CODE
public class SampleGauge {
@Step("I'm on the google home page")
public void goToGoogle() {
// Step ...
Sample gauge ruby code
step "I'm on the google home page" do
end
step "I fill the search field with <name>" do |name|
end
...
Rodrigo Urubatan
• http://www.urubatan.com.br
• http://sobrecodigo.com
• Twitter @urubatan
• http://github.com/urubatan
• ...
Rubyconf2016 - Solving communication problems in distributed teams with BDD
Rubyconf2016 - Solving communication problems in distributed teams with BDD
Upcoming SlideShare
Loading in …5
×

Rubyconf2016 - Solving communication problems in distributed teams with BDD

210 views

Published on

This was my talk in Rubyconf Brazil 2016, it summarises some of my experience using BDD to improve team interaction and communication in local and distributed teams, what are the differences, what benefits I found and how I used it.
I mainly focus in BDD as a communication tool, the automated tests are only a very good side effect, but I've already used it without test automation too.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Rubyconf2016 - Solving communication problems in distributed teams with BDD

  1. 1. Solving communication problems in distributed teams with BDD Rodrigo Urubatan Developer, Writer, Crossfitter, Archer
  2. 2. What is the biggest problem in software projects?
  3. 3. What is the root cause for this problem?
  4. 4. What do we need to solve this problem?
  5. 5. How to solve this problem?
  6. 6. Ok, but how’s that going to help design software? • Business value is the key • What is the next important thing the system does not do yet? • Use the business language to specify the software • Use the business language to test the software • Use the business language to write the software • Use the business language to validate the software
  7. 7. User Stories!! •As a … •I want to ... •So that ... •AS A BANK CLIENT •I WANT TO USE THE CASH MACHINE •SO THAT I CAN TAKE MONEY FROM MY ACCOUNT
  8. 8. Need to see it everywhere
  9. 9. But it is not enough!
  10. 10. Behaviour Specification • Context • Actions • Verification •GIVEN THERE IS MONEY IN MY ACCOUNT •AND I HAVE A VALID CARD •AND THE MONEY DISPENSER HAS MONEY •WHEN I ASK THE MACHINE FOR MONEY •THEN THE MONEY SHOULD BE SUBTRACTED FROM MY ACCOUNT •AND THE MONEY SHOULD BE DELIVERED TO ME •AND MY CARD SHOULD BE RETURNED
  11. 11. But how much details can I get?
  12. 12. Have you seen that sintaxe anywhere before?
  13. 13. Did you remember where? • In tester spreadsheets, sometimes with columns instead of given/when/then • It is almost the syntax for the gherkin language!!
  14. 14. What if I use the same business words to name things in code?
  15. 15. Let’s try that! • GIVEN THERE IS MONEY IN MY ACCOUNT • AND I HAVE A VALID CARD • AND THE MONEY DISPENSER HAS MONEY • WHEN I ASK THE MACHINE FOR MONEY • THEN THE MONEY SHOULD BE SUBTRACTED FROM MY ACCOUNT • AND THE MONEY SHOULD BE DELIVERED TO ME • AND MY CARD SHOULD BE RETURNED •ACCOUNT.HAS_ENOUGH_MONEY?(VALUE) •CARD.VALID? •DISPENSER.HAS_MONEY? •MACHINE.I_WANT(VALUE) •ACCOUNT.SUBTRACT(VALUE) •MACHINE.DELIVER_MONEY(VALUE) •MACHINE.RETURN_CARD
  16. 16. Wow! Everyone talks the same language!
  17. 17. BDD Development cycle Talk to the client, write a user story or Select a user story Detail the story into scenarions Automate scenarios with selected tool Run tests and see them fail Write ony the code to make tests pass Refactor Almost the same as TDD?
  18. 18. OK, how is that different from TDD “Red, green, refactor”? • The main focus is not the test, in reality the automate step can be skiped sometimes • The main focus is on communication • Test business behaviour not language dependent functions • Behaviour is more important to the software than how it was implemented • The main focus in using a ubiquitous language like in DDD • Using the ubiquitous language, the user story template and the scenario template the communication with the entire team will improve a lot
  19. 19. Haven’t we forgot about test automation?
  20. 20. That same context sintaxe can be automated by: • Cucumber using gherkin - https://cucumber.io/ • Thoughtworks gauge - http://getgauge.io/ • Rspec can use that syntax to name the test specs • Jbehave was created thinking about that • Specflow using gherkin - http://www.specflow.org/
  21. 21. Sample gherkin code Feature: A sample code for my presentation As a speaker I want to have some code samples So that everyone understand what I'm talking about Scenario: doing a simple google search Given I'm on the google home page When I fill the search field with "Urubatan" Then I want to see "my web page" in the results And I want to see "my facebook profile" in the results
  22. 22. Sample cucumber RuBY code Given(/^I'm on the google home page$/) do pending # express the regexp above with the code you wish you had end When(/^I fill the search field with "(.*?)"$/) do |arg1| pending # express the regexp above with the code you wish you had end Then(/^I want to see "(.*?)" in the results$/) do |arg1| pending # express the regexp above with the code you wish you had end
  23. 23. SAMPLE CUCUMBER JAVA CODE public class MyStepdefs { @cucumber.api.java.en.Then("^I want to see "([^"]*)" in the results$") public void iWantToSeeInTheResults(String arg0) throws Throwable { // Write code here that turns the phrase above into concrete actions throw new cucumber.api.PendingException(); } @cucumber.api.java.en.When("^I fill the search field with "([^"]*)"$") public void iFillTheSearchFieldWith(String arg0) throws Throwable { // Write code here that turns the phrase above into concrete actions throw new cucumber.api.PendingException(); } @cucumber.api.java.en.Given("^I'm on the google home page$") public void iMOnTheGoogleHomePage() throws Throwable { // Write code here that turns the phrase above into concrete actions throw new cucumber.api.PendingException(); } }
  24. 24. Sample gauge code A sample code for my presentation ============= As a speaker, I want to have some code samples, So that everyone understand what I'm talking about doing a simple google search ----------- * I'm on the google home page * I fill the search field with "Urubatan" * I want to see "my web page" in the results * I want to see "my facebook profile" in the results
  25. 25. SAMPLE GAUGE JAVA CODE public class SampleGauge { @Step("I'm on the google home page") public void goToGoogle() { // Step implementation } @Step("I fill the search field with <value>") public void fillField(String value) { // Step implementation } @Step("I want to see <addr> in the results") public void checkValue(String value) { // Step implementation } }
  26. 26. Sample gauge ruby code step "I'm on the google home page" do end step "I fill the search field with <name>" do |name| end step "I want to see <address> in the results" |address| end
  27. 27. Rodrigo Urubatan • http://www.urubatan.com.br • http://sobrecodigo.com • Twitter @urubatan • http://github.com/urubatan • http://linkedin.com/in/urubatan • http://fb.com/urubatan

×