Introduction to Rails' Unit Testing

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.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Introduction to Rails' Unit Testing - Presentation Transcript

    1. Hello(Mic).Testing (1,2,3) { :by => { :name =>“ Manik Juneja ”, :company => “ vinsol ” } }
    2. Warning
      • This presentation is not about standards.
      • So let’s restore the sanity and look at some code here.
    3. Testing
      • Testing, one of the most important, yet most looked down upon component of software development
      • Most of us as developers, do certain amount of testing.
      • The question is how much of that is automated.
      • So that when we make a change here we are sure that we did not break something there.
    4. Testing and Rails
      • The Rails framework has inbuilt support for three levels of testing
      • Unit Testing of Models
      • Functional Testing of Controllers
      • Integration Testing of Applications
    5. Fixtures
      • Fixtures allow us to specify a set of known data to be available in the table, at the start of every unit test.
      • Fixtures are transactional
      • Fixtures are instantiated, allowing us to access them within the test cases.
    6. assertions
      • These are the most frequently used assertions.
      • assert(boolean, message)
      • assert_equal(expected, actual, message)
      • assert_not_equal(expected, actual, message)
      • assert_nil(object, message)
      • assert_not_nil(object, message)
      • There are a lot more, and it is easy to write your own customer assertions too.
    7. rake
      • To run all unit test cases for an application
      • $ rake test:units
    8. When to write unit tests.
      • From Agile Developer Venkat’s blog post titled
      • “ Walking along the development beach”
      • http://www.agiledeveloper.com
      • … ....Think of your code as your left foot. Think of your unit test as your right foot. It really does not matter which foot you put forward first. However, when taking a nice walk on the beach, you wouldn’t let one foot take a mile walk before dragging the other foot to catch up. To keep your balance and make the walk pleasant, you follow a rhythm, placing one foot forward and following it with the other foot within safe and comfortable distance. …..

    + mjunejamjuneja, 3 years ago

    custom

    1685 views, 0 favs, 0 embeds more stats

    More Info

    © All Rights Reserved

    Go to text version
    • Total Views 1685
      • 1685 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as innappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel

    Categories