behaviour-driven development - · pdf fileisso em código 10. ... behaviour-driven...
TRANSCRIPT
![Page 1: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/1.jpg)
Behaviour-Driven Developmentcom RSpec e RSpec on Rails
Danilo Satowww.dtsato.com
1
![Page 2: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/2.jpg)
Quem sou eu?
• Graduação/Mestrado no IME/USP
• AgilCoop
• Fundador do Dojo@SP
• ThoughtWorks UK
2
![Page 3: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/3.jpg)
Ponto de vista...3
Programar
Testar
![Page 4: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/4.jpg)
Ponto de vista...3
Programar
Testar
![Page 5: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/5.jpg)
<<RUP-man>>
4
![Page 6: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/6.jpg)
<<RUP-man>>
Programador, aqui
está sua especificação...
4
![Page 7: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/7.jpg)
<<RUP-man>>
Programador, aqui
está sua especificação...
Player
Recognize Poker Winner
4
![Page 8: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/8.jpg)
RSpec 5
![Page 9: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/9.jpg)
RSpec
Mas como se joga poker?
5
![Page 10: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/10.jpg)
RSpec
Mas como se joga poker?
<<RUP-man>>
Programador nunca entende nada!
5
![Page 11: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/11.jpg)
<<RUP-man>>
preste atenção...
Player
Recognize Poker Winner
6
![Page 12: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/12.jpg)
<<RUP-man>>
preste atenção...
“Straight flush ganha de quadra. Quadra ganha de full house… Empata no straight flush quando os índices são iguais…Desempate no straight flush pela carta maior…”
6
![Page 13: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/13.jpg)
<<RUP-man>>
Ah! Acho que esse diagrama deve te
ajudar...
7
![Page 14: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/14.jpg)
<<RUP-man>>
Ah! Acho que esse diagrama deve te
ajudar...
*1Hand rank
suit
Card
7
![Page 15: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/15.jpg)
RSpec
Mas o que faz uma carta? e a
mão? Como as construo?...
8
![Page 16: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/16.jpg)
RSpec
Mas o que faz uma carta? e a
mão? Como as construo?...
<<RUP-man>>
Ai ai...
8
![Page 17: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/17.jpg)
<<RUP-man>>
preste atenção...
*1Hand rank
suit
Card
9
![Page 18: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/18.jpg)
<<RUP-man>>
preste atenção...
“Uma Carta deve ter índice, naipe e é construída a partir de uma String. A Mão deve ter cartas (ordenadas) e um rank calculado com base nas suas cartas…”
9
![Page 19: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/19.jpg)
RSpec
Hmm... acho que consigo representar
isso em código
10
![Page 20: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/20.jpg)
Story "I can rank poker hands", %(As a game player I want to rank a poker hand So that I can decide a winner for the prize) do Scenario "Straight flush wins Four of a kind" do Given "A hand", :black, "2H 3H 4H 5H 6H" Given "A hand", :white, "AC AH AD AS KC" Then "Black should win" end Scenario "Four of a kind wins Full house" do Given "A hand", :white, "2C 2H 2D 2S AC" Given "A hand", :black, "AC AH AD KS KC" Then "White should win" endend
RSpec
Hmm... acho que consigo representar
isso em código
10
![Page 21: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/21.jpg)
describe Card do it 'should parse rank' it 'should parse suit' it 'should compare based on rank'end
describe Hand do it 'should have cards' it 'should sort cards' it 'should have rank' it 'should compare based on rank' it 'should detect straight' it 'should detect flush' it 'should detect full house'end
RSpec
Hmm... acho que consigo representar
isso em código
10
![Page 22: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/22.jpg)
RSpec
E isso é código executável!
11
![Page 23: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/23.jpg)
JUnit (Test::Unit)
Test-Driven Development
12
Teste
![Page 24: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/24.jpg)
Behaviour-Driven Development
JUnit (Test::Unit)
12
Teste
![Page 25: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/25.jpg)
Behaviour-Driven Development
Especificação (Executável)
JUnit (Test::Unit)
12
![Page 26: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/26.jpg)
Behaviour-Driven Development
Especificação (Executável)
RSpec
12
![Page 27: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/27.jpg)
Behaviour-Driven Development
Especificação (Executável)
RSpec
12
Documentação
![Page 28: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/28.jpg)
13
![Page 29: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/29.jpg)
13
# spec/card.rbrequire 'rubygems'require 'spec'require 'lib/card'
describe Card do it 'should parse rank' do Card.new('2H').rank.should == 2 Card.new('TS').rank.should == 10 Card.new('JC').rank.should == 11 Card.new('QD').rank.should == 12 Card.new('KC').rank.should == 13 Card.new('AS').rank.should == 14 end it 'should parse suit' do Card.new('2H').suit.should == 'H' Card.new('3S').suit.should == 'S' Card.new('4C').suit.should == 'C' Card.new('5D').suit.should == 'D' end
it 'should compare based on rank' do Card.new('AS').should > Card.new('KH') Card.new('QS').should == Card.new('QC') Card.new('TD').should < Card.new('JH') endend
![Page 30: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/30.jpg)
13
# spec/card.rbrequire 'rubygems'require 'spec'require 'lib/card'
describe Card do it 'should parse rank' do Card.new('2H').rank.should == 2 Card.new('TS').rank.should == 10 Card.new('JC').rank.should == 11 Card.new('QD').rank.should == 12 Card.new('KC').rank.should == 13 Card.new('AS').rank.should == 14 end it 'should parse suit' do Card.new('2H').suit.should == 'H' Card.new('3S').suit.should == 'S' Card.new('4C').suit.should == 'C' Card.new('5D').suit.should == 'D' end
it 'should compare based on rank' do Card.new('AS').should > Card.new('KH') Card.new('QS').should == Card.new('QC') Card.new('TD').should < Card.new('JH') endend
# lib/card.rbCARDS = '23456789TJQKA'
class Card include Comparable attr_reader :rank, :suit def initialize(str) @rank = CARDS.index(str[0, 1])+2 @suit = str[1,1] end def <=>(other) return rank <=> other.rank endend
![Page 31: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/31.jpg)
13
# spec/card.rbrequire 'rubygems'require 'spec'require 'lib/card'
describe Card do it 'should parse rank' do Card.new('2H').rank.should == 2 Card.new('TS').rank.should == 10 Card.new('JC').rank.should == 11 Card.new('QD').rank.should == 12 Card.new('KC').rank.should == 13 Card.new('AS').rank.should == 14 end it 'should parse suit' do Card.new('2H').suit.should == 'H' Card.new('3S').suit.should == 'S' Card.new('4C').suit.should == 'C' Card.new('5D').suit.should == 'D' end
it 'should compare based on rank' do Card.new('AS').should > Card.new('KH') Card.new('QS').should == Card.new('QC') Card.new('TD').should < Card.new('JH') endend
# lib/card.rbCARDS = '23456789TJQKA'
class Card include Comparable attr_reader :rank, :suit def initialize(str) @rank = CARDS.index(str[0, 1])+2 @suit = str[1,1] end def <=>(other) return rank <=> other.rank endend
$ spec spec/card.rb -f specdoc --colour
Card- should parse rank- should parse suit- should compare based on rank
Finished in 0.025488 seconds
3 examples, 0 failures$
![Page 32: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/32.jpg)
RSpec on Rails
• Instalação:$ ruby script/plugin install svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec
$ ruby script/plugin install svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec_on_rails
$ ruby script/generate rspec
14
![Page 33: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/33.jpg)
RSpec on Rails
• Permite especificar camadas isoladas:
• Model - View - Controller
• Helpers
• Testes de integração com “story tests”
• Integração com RCov (cobertura)
15
![Page 34: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/34.jpg)
Isolamento de Camadas
16
Model
Controller
View
![Page 35: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/35.jpg)
Isolamento de Camadas
16
Model
Controller
View
![Page 36: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/36.jpg)
Isolamento de Camadas
16
Model
Controller
View
![Page 37: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/37.jpg)
Isolamento de Camadas
16
Model
Controller
View
DB
![Page 38: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/38.jpg)
Isolamento de Camadas
16
Controller
View
![Page 39: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/39.jpg)
Isolamento de Camadas
16
Controller
View“Model”
![Page 40: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/40.jpg)
17
MocksStubs
![Page 41: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/41.jpg)
17
MocksStubs
Respostas Default(nil, false, 0, ...)
![Page 42: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/42.jpg)
17
MocksStubs
Respostas Default(nil, false, 0, ...)
Verifica chamadas
![Page 43: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/43.jpg)
RSpec on Rails
CÓDIGO!!
http://10.0.3.13:3000
18
![Page 44: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/44.jpg)
História #1“Como um conferencista
Gostaria de dar uma avaliação positiva ou negativa para a palestra que acabei de assistir
Pois quero dar um feedback para o palestrante”
19
![Page 45: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/45.jpg)
História #1“Como um conferencista
Gostaria de dar uma avaliação positiva ou negativa para a palestra que acabei de assistir
Pois quero dar um feedback para o palestrante”
19
Palestra 1 0
Palestra 2 2
Palestra 3 1
![Page 46: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/46.jpg)
História #1“Como um conferencista
Gostaria de dar uma avaliação positiva ou negativa para a palestra que acabei de assistir
Pois quero dar um feedback para o palestrante”
19
Palestra 1 0
Palestra 2 2
Palestra 3 1
/lectures/vote_for/1?vote=1
![Page 47: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/47.jpg)
História #1“Como um conferencista
Gostaria de dar uma avaliação positiva ou negativa para a palestra que acabei de assistir
Pois quero dar um feedback para o palestrante”
19
Palestra 1 0
Palestra 2 2
Palestra 3 1
/lectures/vote_for/1?vote=1
lectures_controller.rb
![Page 48: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/48.jpg)
História #1“Como um conferencista
Gostaria de dar uma avaliação positiva ou negativa para a palestra que acabei de assistir
Pois quero dar um feedback para o palestrante”
19
Palestra 1 0
Palestra 2 2
Palestra 3 1
/lectures/vote_for/1?vote=1
lectures_controller.rb
lecture.rb
![Page 49: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/49.jpg)
História #1“Como um conferencista
Gostaria de dar uma avaliação positiva ou negativa para a palestra que acabei de assistir
Pois quero dar um feedback para o palestrante”
19
Palestra 1 0
Palestra 2 2
Palestra 3 1
/lectures/vote_for/1?vote=1
lectures_controller.rb
lecture.rb
![Page 50: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/50.jpg)
História #2“Como um conferencista
Gostaria de destacar a palestra atual
Para facilitar a identificação na hora de votar”
20
![Page 51: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/51.jpg)
História #2“Como um conferencista
Gostaria de destacar a palestra atual
Para facilitar a identificação na hora de votar”
20
Palestra 1 14:00-14:00 0
Palestra 2 15:00-17:00 3
Palestra 3 17:00-18:00 2
![Page 52: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/52.jpg)
História #3“Como um conferencista
Gostaria de votar mais rápido
Pois dar um refresh na página inteira demora muito”
21
![Page 53: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/53.jpg)
História #3“Como um conferencista
Gostaria de votar mais rápido
Pois dar um refresh na página inteira demora muito”
21
![Page 54: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/54.jpg)
RSpec on Rails
• O que está acontecendo no trunk:
• Story tests (RBehave)
• Plain-text story tests
• Editor de histórias web
• Integração com Rails 2.0
• http://rspec.rubyforge.org
22
![Page 55: Behaviour-Driven Development - · PDF fileisso em código 10. ... Behaviour-Driven Development JUnit (Test::Unit) 12 Teste. Behaviour-Driven Development Especificação ... $ ruby](https://reader033.vdocuments.site/reader033/viewer/2022051406/5aba8a7a7f8b9a441d8bc0a3/html5/thumbnails/55.jpg)
Dúvidas?
• Danilo Sato
• www.dtsato.com
• Dojo@SP
• groups.google.com/group/dojo_sp
• AgilCoop
• www.agilcoop.org.br
23