Sometimes we have connection issues to run behat tests even if we creates wp-cli test user and give permission to that user to perform mysql tasks.
We can fix that with simple hack.
Original command
vendor/behat/behat/bin/behat features/comment-generate.feature
By above command we might have this error

Fix
Simple solution will be to add WP_CLI_TEST_DBTYPE=sqlite
in the begining of the command.
WP_CLI_TEST_DBTYPE=sqlite
vendor/behat/behat/bin/behat features/comment-generate.feature
This will test wp-cli to use sqlite instead of mysql. So we don’t need to worry about mysql connection