How can I run the Drupal 8 & Drupal 9 Webform CiviCRM unit tests on my local?
Ok here are the steps!
I'm on a Mac/MAMP and I use PhpStorm
A. Get Drupal
composer create-project drupal/recommended-project:8.9.13 d8civicrm.local
cd d8civicrm.local

composer config extra.enable-patching true
composer config minimum-stability dev

B. Get CiviCRM
composer require civicrm/civicrm-core:5.35.0 civicrm/civicrm-packages:5.35.0 civicrm/civicrm-drupal-8:5.35.0 civicrm/civicrm-asset-plugin:~1.1

C. Install Drupal
Browser to your new website -&gt; in my case: http://d8civicrm.local
and follow the install step in the UI.
D. Make it writeable
chmod -R +w d8civicrm.local

we need to write e.g. the civicrm.settings.php file next!
E. Install CiviCRM
Go to the UI -&gt; Extend -&gt; or use drush!
F. Patch alert!
No longer needed!
G. PHPUnit configuration
copy this file: https://gist.github.com/mglaman/efcdb804dcced6ddc856e9e0050aad1e
-&gt; into /Applications/MAMP/htdocs/d8civicrm.local (i.e. where your composer.json is) and make updates specifically add in your BASE_URL and your DB location and credentials:
19c19
&lt;     &lt;env name=&quot;SIMPLETEST_BASE_URL&quot; value=&quot;http://d8civicrm.local&quot;/&gt;
---
&gt;     &lt;env name=&quot;SIMPLETEST_BASE_URL&quot; value=&quot;&quot;/&gt;
21c21
&lt;     &lt;env name=&quot;SIMPLETEST_DB&quot; value=&quot;mysql://myadminuser:db^88*@localhost:3306/d8civicrm_local&quot;/&gt;
---
&gt;     &lt;env name=&quot;SIMPLETEST_DB&quot; value=&quot;&quot;/&gt;

Note: when testing CiviCRM Extensions -&gt; add this line as well - as per docs:
docs -&gt; https://docs.civicrm.org/dev/en/latest/testing/mink/
&lt;env name=&quot;DEV_EXTENSION_DIR&quot; value=&quot;/Applications/MAMP/htdocs/d9civicrm.local/web/sites/default/files/civicrm/ext/&quot;/&gt;

H. Install webform module
composer require 'drupal/webform:^6.0'
I. Install webform_civicrm module
-&gt; (at this points the tests have not been released yet so you'll need to clone the webform civicrm github repo):
git clone https://github.com/colemanw/webform_civicrm.git --branch 8.x-5.x

J. Get the Drupal Dev tools
We started with drupal-recommended - now let's get the dev tools:
composer config minimum-stability dev
composer require drupal/core-dev-pinned:^8.9 --no-suggest
Note: reproducing this just now - I ended up having to rm composer.lock and rm -r vendor as it was spitting out a symfony conflict. Ah looks like in the .github/workflows/main.yml file we install the drupal dev tools before we install CiviCRM
K. Configure PHPStorm
PHPStorm -&gt; Preferences -&gt; Language &amp; Frameworks -&gt; PHP -&gt; Test Frameworks.

If running into autoloading issues - things to try:
add the entire path to phpunit -&gt; /Applications/MAMP/htdocs/d9civicrm.local/vendor/phpunit/phpunit as a PHP include path in Languages and Frameworks in the PhpStorm settings - hit Apply -&gt; then check the Test Frameworks page again.

L. Install Chromedriver
https://chromedriver.chromium.org/
and start it
/usr/local/bin/chromedriver
To check that it's running:
karins-MBP:bin sysadmin$ ps -ax |grep chromedriver
62821 ttys004 0:00.18 chromedriver

M. Run a test!

PS - Note to self: if you run into:
Error : Call to undefined method CRM_Utils_System_UnitTests::parseUrl()
Go into -&gt; Run/Debug Configurations and hit Environment Variables and SWITCH OFF -&gt; Include system environment variables (as one may have included variables specific to CiviCRM Unit Testing)
I'm still working on getting xdebug to work with phpunit test - in the mean time -&gt; to debug variables within your unit test -&gt;
throw new \Exception(var_export($api_result, TRUE));