Now when I am creating/updating tests I can:mysqldump -d database > test_database.schema echo create database test_database | mysql mysql test_database < test_database.schema
Then I can recursively domysqldump test_database > test_database.schema
until I am happy with the tests. Then when I install of the new code base I should only need to runmysql test_database < test_database.schema mysql test_database < alter_database mysql test_database < add_test_data ./Build test
as an additional step. I then use this code to make sure that the databases have the same structure.mysql database < alter_database
use Algorithm::Diff; my @a = grep( !/Database:/, split('\n', `mysqldump -d tasker`)); my @b = grep( !/Database:/, split('\n', `mysqldump -d test_tasker`)); my $diff = Algorithm::Diff->new( \@a, \@b ); while($diff->Next()) { next if $diff->Same(); next if /Database:/; print "< $_\n" for $diff->Items(1); print "> $_\n" for $diff->Items(2); }
In reply to Re: A Framework for automated DB testing
by gam3
in thread A Framework for automated DB testing
by Mutant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |