As a creator of a software library, how can I verify backward compatibility with earlier versions?

When using a dependency management (here: Maven), multiple versions of my dependency could be (transitively) used:

+- com.example:my-library:jar:1.1.0:compile
+- org.example:another-library:jar:1.0.0:compile
   \- com.example:my-library:jar:1.0.0:compile

As you can see, some-project is directly using my-library, but it is also a transitive dependency of another-library in an older version. Maven will include version 1.1.0 (see dependency mediation) and I want to ensure backwards compatibility between different minor versions so this is guaranteed to work (no accidental API changes from 1.0.0 to 1.1.0).

Are there any common practices to verify compatibility? All I can think of is some kind of smoketest script that builds such scenarios and tries to run them.

  • Could someone please explain what is wrong with this question? (-2) – Matthias May 15 '20 at 7:15
  • 1
    maybe downvotes are because tools recommendations are off-topic per help center – gnat May 15 '20 at 8:39
  • @gnat Thanks for your hint. I removed that part. – Matthias May 15 '20 at 11:53

What I would do in such a scenario is create a separate project containing interface tests for version X. Once version X has been released, this test project should become effectively read-only.

When you are creating version X+1 that should be backward compatible with X, re-run the interface tests of version X in such a way that the project actually picks up version X+1 of the library. If the library is backward compatible, all tests should still pass.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.