BDD e TDD (Café Ágil)

2,003
-1

Published on

Published in: Technology, Education
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,003
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
26
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

BDD e TDD (Café Ágil)

  1. 1. garantia de qualidade Bdd e TddBdd e Tdd
  2. 2. @danielvlopes Daniel Lopes
  3. 3. cursos e-Genial consultoria | desenvolvimento | UI area
  4. 4. voltando . . .
  5. 5. Software !
  6. 6. DEADLINE 48 horas
  7. 7. BUGS ZERO
  8. 8. CÓDIGO !
  9. 9. Sou o cara !!!
  10. 10. PESQUISAR !
  11. 11. Software Automatização =
  12. 12. user = User.new user.do_something
  13. 13. user = User.new x = user.do_something puts x
  14. 14. user = User.new x = user.do_something if x == "magic" puts "OK" else puts "FAIL" end
  15. 15. user = User.new x = user.do_something if x == "magic" puts "OK" else raise "FAIL" end
  16. 16. user = User.new x = user.do_something unless x == "magic" raise "FAIL" end
  17. 17. user = User.new x = user.do_something raise "FAIL" unless x == "magic"
  18. 18. def assert(expr) raise "Fail" unless expr end
  19. 19. class UserTest < TestUnit def test_do_something user = User.new assert user.do_something == "magic" end end
  20. 20. Test::Unit
  21. 21. Automatização ?
  22. 22. Automatização ? CONFIRMADO
  23. 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. 24. def test_create session = User.new.create(...) assert ??? end
  25. 25. Teste
  26. 26. Teste
  27. 27. Teste Código
  28. 28. Teste Código
  29. 29. Código bonito
  30. 30. Código TESTÁVEL
  31. 31. KENT BECK
  32. 32. Test Driven Dev.
  33. 33. Test Driven Dev. APROVADO
  34. 34.
  35. 35. ClientDetailsValidatorTest test_fail_with_missing_name test_fail_with_missing_title assert ["missing name"], client.errors ☹
  36. 36. Código Comunicação =
  37. 37. Trecho do vídeo http://bigthink.com/ideas/21596
  38. 38. def test_fail_with_missing_name assert_equal "missing name", client.errors.first end
  39. 39. it should fail without name client errors should include "missing name" end
  40. 40. DAN NORTH
  41. 41. Test method como sentenças
  42. 42. Template simples de sentenças = foco
  43. 43. Nomes de testes expressivos
  44. 44. “Behaviour” é mais útil que “test”
  45. 45. David Chelimsky
  46. 46. RSpec
  47. 47. describe Client do it "should fail without name" do client.errors.should include("missing name") end end
  48. 48. describe Client do it "should fail without name" do client.errors.should include("missing name") end end
  49. 49. describe Client it should fail without name client errors should include “missing name”
  50. 50. Teste como documentação
  51. 51. Teste como documentaçãoAPROVADO
  52. 52. Requisitos do software?
  53. 53. Requisitos Comportamento =
  54. 54. In order to _______ As _______ I want _______
  55. 55. In order to use the app As a guest I want register
  56. 56. Detalhamento ou Passos
  57. 57. Given _______ When _______ Then _______
  58. 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. 59. Aslak Hellesøy
  60. 60. Cucumber
  61. 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. 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. 63. Mas meu projeto é web ...
  64. 64. Behavior Driven Development
  65. 65. Behavior Driven DevelopmentAPROVADO
  66. 66. voltando . . .
  67. 67. CÓDIGO BUGS REQUISITOS DOC’s ☐ ☐ ☐ ☐
  68. 68. CÓDIGO BUGS REQUISITOS DOC’s ☑ ☑ ☑ ☑
  69. 69. DEADLINE
  70. 70. • Rspec Book - http://bit.ly/3PxKUs • Kent Beck Vídeos - http://bit.ly/ahiFEX • Curso de BDD e-Genial - http://bit.ly/a0VqW6 Por onde começo ?
  71. 71. CURSOS egenial.com.br/cursorails egenial.com.br/imersaorubyonrails CONTATOS twitter @danielvlopes danielvlopes@gmail.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×