Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

automatic testing, behat with mysql

I'm currently building an automatic tests using selenium and Behat for a PHP application that is uses MySQL for database with InnoDB engine. The database is around 50GB with a lot of data in it. The tests are running fine, but currently I'm struggling with the cleanup before every new test run.

Since the tests are inserting data (creating users for e.g) I would like to put the DB in known state before each tests is running. A cleanup script is pretty complicated to do without side effects because of the many relations between data.

My question is if there any good practice for restoring the DB to a known state in a fast way (50GB is a lot of data) just before the Behat features are executed?

like image 864
Ferencz Farkas Avatar asked Apr 26 '26 14:04

Ferencz Farkas


1 Answers

Don't test with 50GB of data. Create a database with less data specifically for testing.

like image 141
Oswald Avatar answered Apr 29 '26 02:04

Oswald



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!