por que testar é importante e algumas boas práticas
DESCRIPTION
Bio Labs #1TRANSCRIPT
![Page 1: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/1.jpg)
Por que testar é importantee algumas boas práticas.
Lucas Catón
Bio Labs #1
![Page 2: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/2.jpg)
Por que testar é importante?
Garantir que nada que fizemos anteriormente irá quebrar.
![Page 3: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/3.jpg)
Por que testar é importante?
Facilidade para refatorar código.
![Page 4: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/4.jpg)
Por que testar é importante?
Entendimento do projeto.
![Page 5: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/5.jpg)
Por que testar é importante?
Testes irão garantir que tudo funciona quando as camadas são
executadas juntas.
![Page 6: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/6.jpg)
Por que testar é importante?
E o mais importante...
Testes são guias, os quais podem te ajudar no desenvolvimento e na qualidade do seu código.
![Page 7: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/7.jpg)
Resumindo...
![Page 8: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/8.jpg)
![Page 9: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/9.jpg)
Por que testar ANTES é importante?
Simples!
Testar antes garante que você irá implementar o que foi previsto e
não o que é mais fácil.
![Page 10: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/10.jpg)
Por que testar ANTES é importante?
Para que você não “force” o teste a passar.
![Page 11: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/11.jpg)
!
![Page 12: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/12.jpg)
Ferramentas para testes(em Ruby)
“A coisa importante, é claro, é que consigamos fazer as pessoas testarem, então ferramentas
não deveriam importar muito.” (DHH)
![Page 13: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/13.jpg)
Ferramentas para testes(em Ruby)
Testes unitários
Test::Unit, RSpec, Shoulda
![Page 14: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/14.jpg)
Ferramentas para testes(em Ruby)
Macros para testes unitários
Remarkable, Shoulda-machers
![Page 15: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/15.jpg)
Ferramentas para testes(em Ruby)
Factories
Machinist, Factory Girl, Object Daddy
![Page 16: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/16.jpg)
Ferramentas para testes(em Ruby)
Testes de integração
RSpec, Cucumber, Steak
![Page 17: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/17.jpg)
Ferramentas para testes(em Ruby)
Frameworks para testes de integração
Capybara, WebRat
![Page 18: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/18.jpg)
Ferramentas para testes(em Ruby)
Drivers para frameworks de testes de integração
Selenium Webdriver, env.js,Capybara-webkit
![Page 19: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/19.jpg)
Ferramentas para testes(em Ruby)
Geradores de exemplos
Faker, Forgery
![Page 20: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/20.jpg)
Ferramentas para testes(em Ruby)
Mocking de recursos externos
FakeWeb, WebMock
![Page 21: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/21.jpg)
Ok, uma variedade de ferramentas, mas...O que e como usar?
?
![Page 22: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/22.jpg)
Primera coisa:Saia da zona de conforto!
![Page 23: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/23.jpg)
O que usamos hoje na
![Page 24: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/24.jpg)
!
RSpec
Para testes de models, helpers, libs...
![Page 25: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/25.jpg)
Shoulda-matchers
![Page 26: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/26.jpg)
Shoulda-matchers
![Page 27: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/27.jpg)
Factories
Factory.define :user do |u| u.name(Faker::Name.name) u.username(Faker::Internet.user_name) u.email(Faker::Internet.email) u.password('secret')end
Factory Girl + Faker
![Page 28: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/28.jpg)
Testes de integração
RSpec + Capybara (com nova DSL)
![Page 29: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/29.jpg)
Testes de integraçãocom JS
RSpec + Capybara (com nova DSL)+ Selenium Webdriver + browser
![Page 30: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/30.jpg)
O que NÃO testamos!
Métodos privados
![Page 31: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/31.jpg)
O que NÃO testamos!
Views
![Page 32: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/32.jpg)
O que NÃO testamos!
Controllers
(coisas que já seriam cobertaspelos testes de integração)
![Page 33: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/33.jpg)
O que NÃO testamos!
Javascript (ainda!)
![Page 34: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/34.jpg)
Thanks!
@lucascatonhttp://blog.lucascaton.com.br
![Page 35: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/35.jpg)
Referências
http://logbr.reflectivesurface.com/
http://cassiomarques.wordpress.com/
http://twitter.com/danielvlopes
http://akitaonrails.com/
![Page 36: Por que testar é importante e algumas boas práticas](https://reader034.vdocuments.com.br/reader034/viewer/2022052600/55799da1d8b42ac1148b45b2/html5/thumbnails/36.jpg)
Dúvidas?