• Like

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

BDD e TDD (Café Ágil)

  • 1,856 views
Uploaded on

 

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,856
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
23
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Bdd e Tdd garantia de qualidade
  • 2. Daniel Lopes @danielvlopes
  • 3. e-Genial cursos area consultoria | desenvolvimento | UI
  • 4. voltando . . .
  • 5. Software !
  • 6. DEADLINE 48 horas
  • 7. BUGS ZERO
  • 8. CÓDIGO !
  • 9. Sou o cara !!!
  • 10. ! PESQUISAR
  • 11. Software = Automatização
  • 12. user = User.new user.do_something
  • 13. user = User.new x = user.do_something puts x
  • 14. user = User.new x = user.do_something if x == "magic" puts "OK" else puts "FAIL" end
  • 15. user = User.new x = user.do_something if x == "magic" puts "OK" else raise "FAIL" end
  • 16. user = User.new x = user.do_something unless x == "magic" raise "FAIL" end
  • 17. user = User.new x = user.do_something raise "FAIL" unless x == "magic"
  • 18. def assert(expr) raise "Fail" unless expr end
  • 19. class UserTest < TestUnit def test_do_something user = User.new assert user.do_something == "magic" end end
  • 20. Test::Unit
  • 21. Automatização ?
  • 22. Automatização ?
  • 23. def create(login, password, remember_me, auth_token) current_user = User.authenticate(login, password) if current_user.logged_in? if remember_me current_user.remember_me! cookies[:auth_token] = { :value => current_user.remember_token , :expires => current_user.remember_token_expires_at } end redirect_to home_page else redirect_to login_page end end
  • 24. def test_create session = User.new.create(...) assert ??? end
  • 25. Teste
  • 26. Teste
  • 27. Teste Código
  • 28. Teste Código
  • 29. Código bonito
  • 30. Código TESTÁVEL
  • 31. NT BE CK KE
  • 32. Test Driven Dev.
  • 33. Test Driven Dev.
  • 34.
  • 35. ClientDetailsValidatorTest test_fail_with_missing_name test_fail_with_missing_title assert ["missing name"], client.errors ☹
  • 36. Código = Comunicação
  • 37. Trecho do vídeo http://bigthink.com/ideas/21596
  • 38. def test_fail_with_missing_name assert_equal "missing name", client.errors.first end
  • 39. it should fail without name client errors should include "missing name" end
  • 40. N ORTH DAN
  • 41. Test method como sentenças
  • 42. Template simples de sentenças = foco
  • 43. Nomes de testes expressivos
  • 44. “Behaviour” é mais útil que “test”
  • 45. eli msky David Ch
  • 46. RSpec
  • 47. describe Client do it "should fail without name" do client.errors.should include("missing name") end end
  • 48. describe Client do it "should fail without name" do client.errors.should include("missing name") end end
  • 49. describe Client it should fail without name client errors should include “missing name”
  • 50. Teste como documentação
  • 51. Teste como documentação
  • 52. Requisitos do software?
  • 53. Requisitos = Comportamento
  • 54. In order to As I want
  • 55. In order to use the app As a guest I want register
  • 56. Detalhamento ou Passos
  • 57. Given When Then
  • 58. Given I am on signup page When I fill email with “jonh@gmail.com” And fill password with “123456” Then I should see a success message
  • 59. He lle søy As lak
  • 60. Cucumber
  • 61. # language: en Feature: Addition In order to avoid silly mistakes As a math idiot I want to be told the sum of two numbers Scenario Outline: Add two numbers Given I have entered 10 And I have entered 5 When I press add Then the result should be 15
  • 62. Before do @calc = Calculator.new end Given /I have entered (d+)/ do |n| @calc.push n.to_i end When /I press (w+)/ do |op| @result = @calc.send op end Then /the result should be (.*)/ do |result| @result.should == result.to_f end
  • 63. Mas meu projeto é web ...
  • 64. Behavior Driven Development
  • 65. Behavior Driven Development
  • 66. voltando . . .
  • 67. ☐ CÓDIGO ☐ BUGS ☐ REQUISITOS ☐ DOC’s
  • 68. ☑ CÓDIGO ☑ BUGS ☑ REQUISITOS ☑ DOC’s
  • 69. DEADLINE
  • 70. Por onde começo ?
  • 71. CURSOS egenial.com.br/cursorails egenial.com.br/imersaorubyonrails CONTATOS twitter @danielvlopes danielvlopes@gmail.com