And because testing is really all about preparing for and dealing with
problems and exceptions, we??™ll also spend a little time talking about the specific Active Record
exception types??”what each means and how to gracefully handle them all. We??™ll wrap up this
chapter by providing a number of tips and examples on debugging your Active Record programs
in the real world. So let??™s dive right in with unit testing.
Unit Testing
Let??™s face it; if you??™re like us (and most programmers), you were probably thinking about skipping
this chapter, because you hate testing, and writing tests seems like it would be a waste of
time (you could be writing real code instead of wasting time writing tests, right?). However,
there really are some big advantages to writing unit tests when you??™re building database-reliant
applications, so before we get into the details of writing unit tests, let??™s take a minute to outline
those advantages.
125
C H A P T E R 6
?– ?– ?–
Why Write Unit Tests?
In our opinion (and experience) formal testing doesn??™t really become an important part of
your programming tool set until you start to work on large applications over a lengthy period
of time.
Pages:
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295