I just started using Dusk for one of my Laravel projects. It is very easy to use and I'm loving it so far.
I was just curious if you guys have any tips on using dusk for large projects. I have a fairly big application and wrote only 6 tests so far: one for logging in, one for registration, 2 for creating models, and 2 for testing that listing pages work properly. The six tests takes about 50 seconds and consumes 24MB of memory. The entire application has about 30 models and I think the 6 tests covers about only 5% of the entire application. That means that if I write test for the entire application, running each round of tests will take long time and consume too much memory.
That means that if I write test for the entire application, running each round of tests will take long time and consume too much memory.
Depends what you consider "too long", and why.
Is 20 minutes too long? Maybe, maybe not. If it gives you confidence that your application works properly, then I would say it's worth the wait.
On the other hand, there might be some parts that are not important to test. Perhaps it doesn't matter much if feature X breaks. Then you might choose not to write a test.
Memory should not be an issue. I would expect some amount of cleanup between tests.
Thank you for the comment. Based on your comment, it sounds like I will need to prioritize my tests. And maybe more mundane tests like logging in and registering may not need to run every time...
And maybe more mundane tests like logging in and registering may not need to run every time...
Yes, this is critical. You can "layer" your tests, and choose when to run them.
For example, my unit and feature tests run automatically, every time I save a related class. These typically take fractions of a second, and give immediate feedback.
But the rest of my tests, which are often slower, I run before deployment.
If you have a frequent release cycle, you might even choose not to run the slowest tests for some releases. Maybe you save them for the bigger releases. They are still useful to have available.