 [ ← blog / drupal ](/) May 23, 2016  ·  \#drupal  ·  1 min read 

# Run \\Drupal\\Tests\\BrowserTestBase with SQLite



As part of the push to deprecate SimpleTest and use PHPUnit as the test runner in Drupal 8, there is the `\Drupal\Tests\BrowserTestBase` class. The `BrowserTestBase` provides a Mink runner that tests web pages in Drupal. Unlike kernel tests, which require a database and can be run via PHPUnit as well, browser tests use your default database connection. I prefer to run my tests with SQLite as I do not need to have my Docker containers running.

The simplest solution I have found, thus far, is to check the HTTP\_USER\_AGRENT

```
if ($_SERVER['HTTP_USER_AGENT'] == 'Drupal command line') {
    $databases['default']['default'] = array(
      'driver' => 'sqlite',
      'database' => '/tmp/test.sqlite',
      'namespace' => 'Drupal\\Core\\Database\\Driver\\sqlite',
    );
}
```

With this, and running `php -S localhost:8080` I'm able to write my Drupal Commerce browser tests without having my normal Docker containers running.

 

  ![](/themes/custom/mglaman/images/headshot.webp)Thanks for reading

I write about Drupal, PHP, and the quiet infrastructure behind large sites — caching, config, and testing. New posts land every week or two.

 [Subscribe via RSS →](/rss.xml) [About me →](/about-me) 

 



 

  [← Older

Drupal Commerce and Migrate status

 ](/blog/drupal-commerce-and-migrate-status) [Newer →

Explore Drupal Commerce 2 with Commerce Demo!

 ](/blog/explore-drupal-commerce-2-commerce-demo)