Your SlideShare is downloading. ×
0
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Testing in Rails 3.x
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Testing in Rails 3.x

1,082

Published on

http://www.meetup.com/IsraelRubyUnderground/events/24126891/ …

http://www.meetup.com/IsraelRubyUnderground/events/24126891/

The presentation was given in the last Israeli Ruby on Rails meetup. It gives a short overview for the latest testing technique in Rails 3.x.

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

  • Be the first to like this

No Downloads
Views
Total Views
1,082
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
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. Test Automation with RoR for dummies
    Aug, 2011
    Eran Nelinger, SAP Labs
    eran.nelinger@sap.com
  • 2. Why Test Automation
    Rails Testing Theory
    Deep dive into ‘Test’ directory
    Other automation investment tips
    8/22/2011
  • 3. Why Test Automation
    Rails Testing Theory
    Deep dive into ‘Test’ directory
    Other automation investment tips
    8/22/2011
  • 4. 8/22/2011
  • 5. 8/22/2011
  • 6. 8/22/2011
    Life’s too short for manual testing…
  • 7. 8/22/2011
    • Rails make it super-easy for us to write tests (Almost everything we need is already in place with scaffolding)
    • 8. Machine can better remember expected output
  • Why Test Automation
    Rails Testing Theory
    Deep dive into ‘Test’ directory
    Other automation investment tips
    8/22/2011
  • 9. 8/22/2011
    • Rails applications typically interacts heavily with databases
    • 10. If we would like to write efficient tests, they’ll need to interact with databases
  • 8/22/2011
    • We would like to be able to run our test in such environment where messing our data does not really make a difference
    • 11. On the other hand we want to rebuild our data each time before a test run
  • 8/22/2011
    • The Three Environments approach allows us to set up and interact with test data without any danger of your tests altering data from your production environment
  • 8/22/2011
    test/fixtures:
    Just a fancy word for ‘sample-data’
    Populate our test-schema with content each time before a test runs
    Database independent
    Supports YAML as well as CSV
  • 12. 8/22/2011
  • 13. 8/22/2011
  • 14. 8/22/2011
    test/unit:
    Unit-tests in rails are model-tests
    Logical assertions of our application’s business logic
    Should include at list one test method for every method in the model
  • 15. 8/22/2011
    test/unit/helpers:
    Any method that might be used in more then one test-case
  • 16. 8/22/2011
    test/unit/test_helper.rb:
    Define ActiveSupport::TestCase class which is the base class for each test (not only unit)
    Requires by each of the test files
    Switch to RAILS_ENV = “test”
    Brings us assertions from test test/unit
  • 17. 8/22/2011
    test/functional
    ActionController::TestCase
    Controller specific tests
    • was the web request successful?
    • 18. was the user redirected to the right page?
    • 19. was the user successfully authenticated?
    • 20. was the correct object stored in the response template?
    • 21. was the appropriate message displayed to the user in the view?
  • 8/22/2011
    test/integration
    ActionController::IntegrationTest
    Interaction among number of controllers
    Generally used to test important flows
    Fixtures -> to be included explicitly
  • 22. 8/22/2011
    test/performance
    ActionDispatch::PerformanceTest
    Runs a code profiler of each test method
    Flat and graph_html output is written by defauls
  • 23. 8/22/2011
    Before running the tests:
    $ rake db:migrate
    runs any pending migrations on the development environment and updatesdb/schema.rb
    $ rake db:test:load
    recreates the test database from the current db/schema.rb
  • 24. 8/22/2011
    • Assertions are the working bees of testing
    • 25. Actually performs a check to see if expected==actual
  • 8/22/2011
    • Assertions are the working bees of testing
    • 26. Actually performs a check to see if expected==actual
  • 8/22/2011
    • Rails specific assertions
  • Why Test Automation
    Rails Testing Theory
    Deep dive into ‘Test’ directory (Model testing)
    Other automation investment tips
    8/22/2011
  • 27. 8/22/2011
  • 28. 8/22/2011
  • 29. 8/22/2011
  • 30. 8/22/2011
  • 31. 8/22/2011
  • 32. 8/22/2011
  • 33. 8/22/2011
  • 34. 8/22/2011
  • 35. 8/22/2011
  • 36. 8/22/2011
  • 37. 8/22/2011
  • 38. 8/22/2011
  • 39. 8/22/2011
  • 40. Why Test Automation
    Rails Testing Theory
    Deep dive into ‘Test’ directory (Controller testing)
    Other automation investment tips
    8/22/2011
  • 41. 8/22/2011
  • 42. 8/22/2011
  • 43. 8/22/2011
  • 44. 8/22/2011
  • 45. 8/22/2011
  • 46. Why Test Automation
    Rails Testing Theory
    Deep dive into ‘Test’ directory (View testing)
    Other automation investment tips
    8/22/2011
  • 47. 8/22/2011
  • 48. 8/22/2011
  • 49. 8/22/2011
  • 50. 8/22/2011
  • 51. 8/22/2011
  • 52. 8/22/2011
  • 53. 8/22/2011
  • 54. 8/22/2011
  • 55. 8/22/2011
  • 56. 8/22/2011
    http://guides.rubyonrails.org/testing.html
    http://guides.rubyonrails.org/
    http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html
    http://ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit/Assertions.html
    http://api.rubyonrails.org/classes/ActiveSupport/TestCase.html
    http://api.rubyonrails.org/classes/ActionController/TestCase.html
    http://rdoc.info/github/rails/rails/master/ActionDispatch/IntegrationTest
    http://watir.com/
    http://pivotal.github.com/jasmine/
    http://railscasts.com/episodes/261-testing-javascript-with-jasmine
  • 57. 8/22/2011

×