In Drupal 8, I am creating functional tests extending the BrowserTestBase class.

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?

  • For a single test, that seems a bit long. For a test group, that could be fast! Are you executing in the UI or the command-line runner?
    – mona lisa
    Commented Aug 31, 2016 at 13:37
  • Command-line runner, initially I thought it was my test, so I created an empty one and got these results. Is there a way to know where the time is spent? Commented Aug 31, 2016 at 14:16
  • If you save the database tables from the test, it's watchdog log may help. Also, profiling with Blackfire, Xdebug, or xhprof will show you the slow functions.
    – mona lisa
    Commented Aug 31, 2016 at 15:04
  • What is your value of the PHP configuration opcache.enable_cli?
    – mona lisa
    Commented Aug 31, 2016 at 15:12
  • It's Off: $ php -i | grep enable_cli returns opcache.enable_cli => Off => Off Commented Aug 31, 2016 at 15:17

2 Answers 2


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)

  • how do I set the 'taxonomy.vocabulary.tags' required when using the 'testing' profile? Commented Sep 26, 2016 at 9:30
  • I decoupled some modules and now I am testing with the 'testing' profile and a minimal requirement of dependencies and I got down from 3 minutes to around 20-30 seconds. Thanks! Commented Sep 26, 2016 at 12:10

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.

  • Hello @kevin, I am using the same class Drupal\Tests\BrowserTestBase on a MacBook Air 8GB of memory, PHP 5.6, using the command line. For my functional tests I need to use the standard profile (I am using taxonomies), I enable the node and taxonomy modules and 2 custom modules. Commented Aug 31, 2016 at 14:14
  • Okay, I am using the default (testing), but I would gather that it would cause a test to take longer to spin up instead of start with only what you need if you use a full site install like standard. What happens if you don't set a profile? Does that reduce the time?
    – Kevin
    Commented Aug 31, 2016 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.