How to run unit tests against multiple dependency versions

I am writing a foo java library that has a dependency on bar:1.1+ . But the bar library has changed quite a bit over time, and I want my library to be compatible with each version of bar ( 1.1 ... 1.10 ).

Therefore, I would like (during CI) to run each of my unit tests using the classpath, including bar:1.X , with each version available to bar .

I use gradle and junit / spock, but I'm open to solutions with options.

To the right, I can duplicate gradle test cases, but this is rather cumbersome, and test results can be difficult to aggregate. Ideally, I would determine next to my test in which versions of the bar it should work, for example:

 @RunWith("com.acme:bar:1.1..1.10") public class MyTest { ... } 

But I do not find for this tool / runner.

+7
java unit-testing junit gradle spock
source share
1 answer

This is due to Maven and not sure how it will comply with CI, but it can help you get started.

One option might be to use the archetype Maven <- Additional Information

Using mvn archetype:generate , you can generate a project with a dynamic version

 mvn archetype:generate -DarchetypeGroupId=<archetype-groupId> -DarchetypeArtifactId=<archetype-artifactId> -DarchetypeVersion=<archetype-version> -DgroupId=<my.groupid> -DartifactId=<my-artifactId> -Dversion=<custom-version> 
0
source share

All Articles