3

I am working on augmenting a test framework that uses Maven. Due to the nature of the code being tested, it is necessary to run tests in VMs. We are currently doing this in a sort of hack-ish way by running shell scripts that SSH into the VMs via Vagrant and run a list of tests. However, this list of tests has to be updated every time someone adds a new integration test to our tests. Ideally, we'd like to automatically gather the relevant tests that are flagged as Component / Integration tests with @Category JUnit flags in our Java code, and then run these tests within the VMs. It seems like Failsafe has no parameters to run the integration tests outside of the local machine. Is there any way to do this using existing Maven plugins?

Ideally, the flow of things would be as follows:

  1. Discover all component / integration tests using Failsafe.
  2. Pass the list of these tests into a VM
  3. Run the tests on that VM, preferably with vagrant.

The existing plugin for Vagrant in Maven shows how to run a VM during integration tests, but it doesn't make clear how to actually run the integration tests on the VMs within Maven: http://nicoulaj.github.io/vagrant-maven-plugin/examples/running-a-vm-during-integration-tests.html . The plugin hasn't been updated since 2013 either, which isn't very promising.

betawave92
  • 113
  • 1
  • 2
  • 9
  • What did you end up doing? – Dave Jul 12 '16 at 16:46
  • Lots of shell script magic. I gather tests based on whether they have specific @Category flags using grep to automate what tests are ran as component or integration tests. Then, I SSH in with vagrant to run the tests with JUnit. Not clean, but it gets the job done. There might be a way to remotely hook into failsafe running within a VM and get it to output via a socket on the host machine. I haven't pursued this, as I had to get it done quickly :) – betawave92 Jul 15 '16 at 22:37
  • Thanks for the update, you have confirmed what I am slowly realizing. There is no "magic" maven plugin or vagrant tool that is going to do what I need. I'll probably just do Bash scripts and use cygwin on the windows machines.... – Dave Jul 15 '16 at 23:35

0 Answers0