In Drupal 8, I am creating functional tests extending the
Launching a test though (even an empty one) requires about 2-3 minutes.
Is this normal, is it there a way to speed up the functional tests?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
Do not use standard (as you said in a comment).
Use testing and then create only what you need in the test. That's the main thing to speed up your tests.
They are still rather slow, but that should help.
Another thing to consider is to avoid having many test methods. Each runs in a completely new, isolated environment. A trick that is often used is to have a single testAll() method and many doTestSomething() methods, then they are faster by almost factor count(test methods), since set up is usually by far the slowest part.
You can also run tests in parallel with
--concurrency 8 (nummber of cpus is a pretty good value for concurrency)
Which one are you using? Do note that there are two BrowserTestBase classes, one is marked as deprecated:
Here is what I wrote for Taxonomy Views Integrator:
I can run that test and (if I recall) it is done in less than 60 seconds. Note that the more test methods you define, more modules you require, the longer it will take to set up the testing instance of Drupal.
On a VM I have dedicated 2GB of RAM, 256M for PHP 5.6 (or 7, depending on which VM) on DrupalVM.com instance.
Also, I am running them from the command line, not the UI test runner.