Welcome Guest, Not a member yet? Register   Sign In
Testing: Database refresh and migrations
#1

I've run into a particular issue a few times and I'd like the community's input on it. Here's the scenario:

You have an e-commerce project. It's time to write your feature tests but in order for most pages to load you need a semi-complete set of data so you the framework tools for creating a fake set of test data. The catch is this requires dozens of users, hundreds of items, shopping carts, images, groups, privileges, etc etc etc and by the time you hit "go" every one of your 240 feature tests takes 30 seconds to run.
Well, no problem - how about you group feature tests into compatible classes and turn off database refresh between tests? Well now you don't get migrations unless they were run prior to your test case, so the seeder starts failing.

Sounds pretty specific but I've had to do acrobatics in a couple projects to get this working. My opinion is that `CIDatabaseTestCase::$refresh` should control wiping the database between each test, but if migrations are specified to run then they should run regardless of `$refresh`, same as seeders.

Anyone else running project tests care to weigh in?
Reply


Messages In This Thread
Testing: Database refresh and migrations - by MGatner - 07-03-2020, 12:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB