Summer Sale! All accounts are 50% off this week.

Stacky's avatar

Laravel large scale testing strategy

Looking for advice or some reading material. I have an app which I redistribute. I have over 400 tests across a suite of feature tests. It takes 5 mins and can be unreliable in the results. Mainly because I use a mix of seeded data and generated data. I would like to refresh the db after every feature test. But having the seeded data is handed. This will only scale larger so seeking some advice as I will need to pause Dev and make my testing more reliable.

Thanks

0 likes
2 replies
Sinnbeck's avatar

I would suggest you use this trait lluminate\Foundation\Testing\RefreshDatabase It will migrate the database from new in the first test. Then in all the tests it will use transactions to easily (and automatically) roll back the database after the test is done. You can also give parallel testing a shot to speed it up

Stacky's avatar

THanks @sinnbeck I may need to refactor some of my tests to abstract the data enough that I can run parallell tests and use RefreshDatabase. Thats on me though :)

Please or to participate in this conversation.