7.1.
Background
Instead of wasting time running through the
litany of reasons why automated testing is probably the single most
important thing you can do to increase the quality and reliability
of your software, we'll get right down to it. If you haven't gotten
the testing religion yet, just Google for "benefits automated
testing."
Rails encourages you to create a well-tested
application by actively generating default test cases and setting
up scripts and tools to run three different kinds of tests. For
example, when you use script/generate to create your
models and controllers, Rails also generates skeleton test files
for you to fill out with tests for your application. Rails also
includes convenient console commands for running your tests.
Rails has a number of features that make it easy
to test your application. In particular, Rails uses a separate
runtime database dedicated to testing and can automatically
populate the test database with fresh sample data (that you
provide) before each test. Testing database-driven applications has
always been a headache for developers, but Rails has managed to
make it relatively painless.
|