Prev | Current Page 309 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

While they are real tests that involve Active Record and our database and are great
for helping you to understand each method, they aren??™t the best examples of the proper way
to test against your Active Record programs.
The problem is that many of this chapter??™s previous examples rely heavily on the tester
knowing what values are in the database at the time of testing and on those values remaining
unchanged over time (or else our tests would have to be updated to match the data changes).
While there are definitely situations where you want to do this type of testing, on another level,
it defeats the whole idea of a database, that is, that your data should be somewhat dynamic. It??™s
just unrealistic to think that your data values will not change as you develop, test, and mold
your application, even if you have a dedicated test database, as is recommended for proper
testing.
But here??™s the dilemma: you often need to know specific data values to be able to ensure
your application logic is correct, but you also need a way to test various data values to see just
what sort of data will cause your application to break down (which they all do eventually).


Pages:
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321