Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Test on Rails ✘╹◡╹✘

r7kamura
September 19, 2012

Test on Rails ✘╹◡╹✘

r7kamura

September 19, 2012
Tweet

More Decks by r7kamura

Other Decks in Programming

Transcript

  1. Test on Rails based on “Rails Test Prescriptions” by Noel

    Rappin Ryo Nakamura (@r7kamura) ✘ ╹◡╹ ✘
  2. * to speed up validation * to design architectures *

    to assure its quality ... Why test?
  3. to speed up validation automating test * open browser... *

    type the URL “h..tt..p://...” * check the contents...
  4. to design architecture * write clean and independent code (test

    behaves like a third-party code) * think the correct behavior of code (this would be an example of test)
  5. to assure its quality * prevent code from enbugging *

    maybe forced to write test ... ;(
  6. Unit Test of Model. It's easy to write Model Test.

    "Skinny Controller, Fat Model" Model Test
  7. Functional tests Verify the system satisfies requested features of user.

    In Rails, it tests Controller & View by 1 request
  8. 1. normal A normal request should pass expected data to

    the view. @foo, sessions, cookies, flash
  9. View Test Verify: * logic * structure (semantic mean) Used

    in Controller & Integration Test on Rails
  10. Good targets * logic in a view (necessary evil...;) *

    security problem * way to render structures
  11. Bad targets * text in HTML tag * look and

    feel verify only “semantic meanings”
  12. Good targets * interactions in multiple steps * dependency with

    prev state * legacy code (black-box) * with JavaScript