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.
Globalcode	– Open4education
Testes – Solving communication
problems in distributed teams with
BDD
Rodrigo Urubatan
Develop...
Globalcode	– Open4education
What is the biggest
problem in software
projects?
Globalcode	– Open4education
What is the root cause
for this problem?
Globalcode	– Open4education
What do we need to
solve this problem?
Globalcode	– Open4education
How to solve this problem?
Globalcode	– Open4education
Ok, but how’s that going
to help design software?
Business value is the key
What is the next i...
Globalcode	– Open4education
Globalcode	– Open4education
User Stories!!
As a …
I want to ...
So that ...
• AS A BANK CLIENT
• I WANT TO USE THE CASH MA...
Globalcode	– Open4education
Need to see it everywhere
Globalcode	– Open4education
But it is not enough!
Globalcode	– Open4education
Behaviour Specification
Context
Actions
Verification
• GIVEN THERE IS MONEY IN MY ACCOUNT
• AN...
Globalcode	– Open4education
But how much details can I
get?
Globalcode	– Open4education
Have you seen that sintaxe anywhere before?
Globalcode	– Open4education
Did you remember where?
In tester spreadsheets, sometimes with
columns instead of given/when/t...
Globalcode	– Open4education
What if I use the same business words to name
things in code?
Globalcode	– Open4education
Let’s try that!
• GIVEN THERE IS MONEY IN MY
ACCOUNT
• AND I HAVE A VALID CARD
• AND THE MONEY...
Globalcode	– Open4education
Wow! Everyone talks
the same language!
Globalcode	– Open4education
Globalcode	– Open4education
BDD Development cycle
Talk to the client,
write a user story
or
Select a user
story
Detail the...
Globalcode	– Open4education
OK, how is that different from
TDD “Red, green, refactor”?
The main focus is not the test, in ...
Globalcode	– Open4education
Haven’t we forgot about test automation?
Globalcode	– Open4education
That same context sintaxe
can be automated by:
Cucumber using gherkin - https://cucumber.io/
T...
Globalcode	– Open4education
Sample gherkin code
Feature:A sample code for my presentation
As a speaker
I wantto have some ...
Globalcode	– Open4education
Sample cucumber RuBY
code
Given(/^I'm on the google home page$/) do
pending# express the regex...
Globalcode	– Open4education
SAMPLE CUCUMBER
JAVA CODE
public class MyStepdefs {
@cucumber.api.java.en.Then("^I want to see...
Globalcode	– Open4education
Sample gauge code
A sample code for my presentation
=============
As a speaker,Iwantto have so...
Globalcode	– Open4education
SAMPLE GAUGE JAVA
CODE
public class SampleGauge {
@Step("I'm on the google home page")
public ...
Globalcode	– Open4education
Sample gauge ruby code
step "I'm on the google home page" do
end
step "I fill the search field...
Globalcode	– Open4education
Rodrigo Urubatan
http://www.urubatan.com.br
http://sobrecodigo.com
Twitter @urubatan
http://gi...
Upcoming SlideShare
Loading in …5
×

resolvendo problemas de comunicação em equipes distribuídas com bdd

579 views

Published on

Slides da palestra sobre como usar BDD para resolver problems de comunicação em equipes distribuidas apresentado no TDC Florianopolis 2016

Published in: Technology
  • Be the first to comment

resolvendo problemas de comunicação em equipes distribuídas com bdd

  1. 1. Globalcode – Open4education Testes – Solving communication problems in distributed teams with BDD Rodrigo Urubatan Developer, Writer, Crossfitter, Archer
  2. 2. Globalcode – Open4education What is the biggest problem in software projects?
  3. 3. Globalcode – Open4education What is the root cause for this problem?
  4. 4. Globalcode – Open4education What do we need to solve this problem?
  5. 5. Globalcode – Open4education How to solve this problem?
  6. 6. Globalcode – Open4education 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. Globalcode – Open4education
  8. 8. Globalcode – Open4education 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
  9. 9. Globalcode – Open4education Need to see it everywhere
  10. 10. Globalcode – Open4education But it is not enough!
  11. 11. Globalcode – Open4education 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
  12. 12. Globalcode – Open4education But how much details can I get?
  13. 13. Globalcode – Open4education Have you seen that sintaxe anywhere before?
  14. 14. Globalcode – Open4education Did you remember where? In tester spreadsheets, sometimes with columns instead of given/when/then It is almost the syntax for the gherkin language!!
  15. 15. Globalcode – Open4education What if I use the same business words to name things in code?
  16. 16. Globalcode – Open4education 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?(VALU E) • CARD.VALID? • DISPENSER.HAS_MONEY? • MACHINE.I_WANT(VALUE) • ACCOUNT.SUBTRACT(VALUE) • MACHINE.DELIVER_MONEY(VALUE) • MACHINE.RETURN_CARD
  17. 17. Globalcode – Open4education Wow! Everyone talks the same language!
  18. 18. Globalcode – Open4education
  19. 19. Globalcode – Open4education 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 toolRun tests and see them fail Write ony the code to make tests pass Refactor Almost the same as TDD?
  20. 20. Globalcode – Open4education 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
  21. 21. Globalcode – Open4education Haven’t we forgot about test automation?
  22. 22. Globalcode – Open4education 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/
  23. 23. Globalcode – Open4education Sample gherkin code Feature:A sample code for my presentation As a speaker I wantto have some code samples So thateveryone understand whatI'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 wantto see "my web page"in the results And I wantto see "my facebook profile"in the results
  24. 24. Globalcode – Open4education 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(/^Ifill the search field with "(.*?)"$/) do |arg1| pending# express the regexp above with the code you wish you had end Then(/^Iwantto see "(.*?)" in the results$/) do |arg1| pending# express the regexp above with the code you wish you had end
  25. 25. Globalcode – Open4education 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(); } }
  26. 26. Globalcode – Open4education Sample gauge code A sample code for my presentation ============= As a speaker,Iwantto have some code samples,So thateveryone understandwhatI'm talking about doing a simple googlesearch ----------- * I'm on the google home page * I fill the search field with "Urubatan" * I wantto see "my web page"in the results * I wantto see "my facebook profile"in the results
  27. 27. Globalcode – Open4education 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 } }
  28. 28. Globalcode – Open4education 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
  29. 29. Globalcode – Open4education 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

×