mardi 11 avril 2017

Testing a library split into multiple packages

I'm developing a database DSL which has multiple backends. To avoid forcing unwanted dependencies upon users, the DSL is split up into a "core" package, containing the DSL itself, and one package for each backend. The backend packages all depend on the core package, as it defines the API each backend needs to provide.

Now, I want to add a test suite for my DSL. Since most of the functionality being tested lives in the core package, that's where I want to put the test suite. However, in order to actually run any tests, at least one backend is needed. This means that the test suite depends on both the core package and a backend package, but the backend package in turn depends on the core package, creating a circular dependency.

The obvious solution is to create yet another package for the tests only which depends on both the core and a backend, or to move the backend API into its own package which the core and backend packages can depend on (allowing the backends to not depend on the core package). However, if possible I'd like to keep the package structure as it is, and have the test suite as part of the core package.

Is this possible?

Aucun commentaire:

Enregistrer un commentaire