Here’s the insight scoop of the person that implemented both plugins you mention above.
The plugin can start and stop a Vagrant box for you. You’d just have to point it to the Vagrantfile which contains the instructions. The downside is that you’ll have to ensure that Vagrant and some provider e.g. VirtualBox is installed on the machine running the build. That of course holds true for your CI machine as well. With Vagrant you can really install anything you want in the box you need for testing. For example this build script runs a Docker registry in a Vagrant box for testing purposes. A word of warning: Vagrant is horribly slow to start.
With Docker the story is slightly different. You can run Docker on a different machine and manage it with the remote API. That’s exactly what the Gradle Docker plugin does. It just calls off to Docker running on a different machine. Obviously that has benefits: you don’t need to install anything on the machine running the build. Before running your test you can simply start a Docker container with the setup you want to test and then tear it down after the fact. Also Docker containers are super fast to start. Constraint: You’ll have to set up Docker on a dedicated machine, create the images you need and add them to a Docker registry.
What you are basically looking for is a way to automatically provision infrastructure. There are some Gradle plugins out there that allow you to do exactly that e.g. provisioning-gradle-plugin. Downside is that they probably install the infrastructure on the machine running the build. That’s sub-optimal as it will persist and cannot be torn down after testing (except if you want to automate de-installing things that as well).