One of the cons of Homebrew for the use of testing your DB stuff is how tightly coupled the DB is to your local environment.
You'll inevitably end up needing to manage the details of what services are running, and possibly needing to manage the versions of multiple installations. This can get complex if you need to install software that needs different versions of dependencies, or if you need to pin a very specific version on your test DB.
Docker can probably be a good fit for your usecase.
One of the pros of Docker is the ability to quickly set-up and tear-down. Here's an example:
Because containers have their own filesystem that is isolated from your host, you can start up a mysql:5.6 container, perform whatever operations you need to do for your testing, and stop the container. You can start up another mysql:5.6, (or even a mysql:5.7 container), and it will not matter than you could have destroyed that first container. The instances are independent of each other.
You can even easily stand up several DBs, and do some very complex A-B testing that would take a lot more effort if you were to manage the process with a homebrew installation.
It was not mentioned as a need for your usage, but Docker makes it easier to work with developers who use different operating systems, (but can also run docker locally). You can write one set of local development setup/test scripts, and it will generally not require any changes in order to have the same results.
It's a great tool for filtering out "it works on my machine".