DDEV is a local development stack built on top of Docker. It gives you all of your environment needs without messy configured on your host machine, without needing to know Docker or configure your own containers. Which is great, and makes life easier. Instead of just using DDEV to develop your site or application locally, why not also run your tests within it?
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