~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/activerecord/RUNNING_UNIT_TESTS

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
== Creating the test database
2
 
 
3
 
The default names for the test databases are "activerecord_unittest" and 
4
 
"activerecord_unittest2". If you want to use another database name then be sure 
5
 
to update the connection adapter setups you want to test with in 
6
 
test/connections/<your database>/connection.rb. 
7
 
When you have the database online, you can import the fixture tables with 
8
 
the test/schema/*.sql files.
9
 
 
10
 
Make sure that you create database objects with the same user that you specified in 
11
 
connection.rb otherwise (on Postgres, at least) tests for default values will fail.
12
 
 
13
 
== Running with Rake
14
 
 
15
 
The easiest way to run the unit tests is through Rake. The default task runs
16
 
the entire test suite for all the adapters. You can also run the suite on just
17
 
one adapter by using the tasks test_mysql, test_sqlite, test_postgresql or any
18
 
of the other test_ tasks. For more information, checkout the full array of rake
19
 
tasks with "rake -T"
20
 
 
21
 
Rake can be found at http://rake.rubyforge.org
22
 
 
23
 
== Running by hand
24
 
 
25
 
Unit tests are located in test/cases directory. If you only want to run a single test suite, 
26
 
you can do so with:
27
 
 
28
 
   rake test_mysql TEST=test/cases/base_test.rb
29
 
   
30
 
That'll run the base suite using the MySQL-Ruby adapter.  Some tests rely on the schema
31
 
being initialized - you can initialize the schema with:
32
 
 
33
 
  rake test_mysql TEST=test/cases/aaa_create_tables_test.rb
34
 
 
35
 
 
36