vendredi 24 juillet 2020

Best practice with codeception fixture performance

At this moment my codeception tests execute half of hour, and obviously this time grows when I add new tests.

I try to achieve much better performance with my tests because after push I very often simply forget that I pushed something because of slow tests.

At this moment I see that my biggest problem is fixtures. Here very descriptive blackfire profile:

the screenshot

Only loading and unloading fixtures take 93% of the time, but the testing itself takes 5% of the time.

I thought that I could use a single set of fixtures for all my test and just rollback transactions after every test, but I found that with a large number of test cases it is becoming more and more difficult to maintain such data - adding new tests cases always broke some old tests.

So, any solution how can I decrease the time consumed by fixtures? Maybe some way here to use raw SQL dump for each set of tests? Or should I write a huge shell script that restore dumps to the database and run each set of tests separately?

Aucun commentaire:

Enregistrer un commentaire