I need lots of help in figuring out how to test legacy ActiveRecord data
models.
Here are my constraints:
Almost all of my models have set_table_name, set_primary_key etc and
HABTM.
At my work place we have DEV, QA and PROD environment. DEV is for
developers only and QA for QA team only (no developers).
Here are my questions.
In database.yml there is a comment for ‘test:’ data source which
states
Warning: The database defined as ‘test’ will be erased and
re-generated from your development database when you run ‘rake’.
Do not set this db to the same as development or production.
I cannot afford to let this happen, since table creation and loading
lots of
data is under DBA’s control and not in my (developer) control.
—> Is there a way I can avoid erasing and regeneration of data? Can I
set
the test db to same as development without risking data loss?
Will I have to use set_table_name, set_primary_key in my test cases?
If I want to use fixtures how do I select a particular fixture from
a list of fixtures in my test?
(developer) control.
—> Is there a way I can avoid erasing and regeneration of data?
Can I set the test db to same as development without risking data
loss?
Your QA database is not equivalent to a test database; you should see
if you can create a new, possibly local db on developer machines to
act as test. The QA database probably doesn’t need to be included;
as you say, it isn’t for devs.
The only way to set test the same as production is if you never run
tests. The test database is for unit testing, and requires that you
be able to set it to a default state between tests, hence the way it
works.
Do not set this db to the same as development or production.
act as test. The QA database probably doesn’t need to be included;
as you say, it isn’t for devs.
The only way to set test the same as production is if you never run
tests. The test database is for unit testing, and requires that you
be able to set it to a default state between tests, hence the way it
works.
Paul
Thanks Paul
I was thinking on the similar lines but couldn’t express it completely
in my
head
-daya
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.