Question

Say my mvn Project has had a major version release.

So trunk is version 2, and I have a branch with Version 1. I want to allow developers to freely edit tests on trunk, But I would also like to maintain backwards compatibility from version 2 to 1. Is there an easy way to run version 1 branch integration tests against version 2 source code. I was thinking of compiling and moving the test jar (not sure if this would work), but that seems ugly.... Just to clarify, unit test classes are denoted with Test.java where as integration tests are denoted with IT.java. I only want to run the integration-tests

I would preferably be able to run something like

mvn integration-tests -Dfailsafe.plugin.src="branch/version1".

Alternatively, a Jenkins or Atlassian bamboo plugin would work.

Was it helpful?

Solution

Simply switch branch before executing mvn failsafe:integration-test. This is common pattern.

Maven Failsafe Plugin has no support for switching branches and no support for Version control systems (VCS) - and this is good, because this other plugin responsiblity.

This is easy to switch branch in tools like Jenkins. Create one job per branch, changes to code in branch should trigger jenkins build. Jenkis has support for private maven repositories, this will help with artifact collision. Also is possible to share workspace (results) from first job with second job.

In your case build job pipeline in jenkins, after first job from master execute job from branch to verify integration tests.

OTHER TIPS

The best idea I've seen so far is to do a switch on the version control system and then just to run the integration tests.

Steps

  1. svn co trunk
  2. mvn clean install
  3. svn switch branch
  4. mvn failsafe:integration-test
    • If you run mvn integration-test in this stage you will rebuild the project and you will thus be testing your branch/the older version

I have coded this up and tested it against svn/mvn/jenkins stack

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top