Results 1 to 1 of 1
- 01-19-2012, 11:15 AM #1Member
- Join Date
- Jan 2012
- Rep Power
Several Projects & test dependencies, best practices.
Hiya. I'm working on an OSGi project (although that's kind of beside the point), divided into several projects (each compiled to a jar using maven).
Rather than having interdependencies all over the place, I have a single project called "types" which defines all the interfaces, enums, reusable classes, etc. All other projects depend on "types" and nothing else (of my code that is, of course they depend on external jars; spring, jdbc, apache commons etc).
This works fine, until I try to implement unit testing. There are several common tasks that need to be performed during the tests, including testing of types. However, some of these tasks themselves depend on Types defined in the "types" project (such as creation of mock objects).
What's the best way to do this?
My first attempt didn't work. Rough outline is the following projects, in dependency order
- testutils (no dependencies). Provides common setUp code, and some custom assertions
- types (depends on testutils). Provides all types used in the oveall project set. Unit tests can only use testutils.
- testmocks (depends on types). Provides mock objects, and other common test code that depends on "types"
- all other projects (depend on all of the above). Can use whatever
This doesn't work; I'm writing code that is used in testing the "types" project, which depends on Types defined in "types", that should be available for testing other projects. I've got nowhere to put it.
So my next idea is to get rid of the two test projects and put the common unit testing code into the "types" project itself, but I'm not sure on how to do this. If I put it in src/main/java, it'll be available during regular runtime, which I don't think I want. If I put it in src/test/java, it won't be exported at all, so it won't be usable by any of the other projects.
What's the best way of doing this?
- By GaRajan in forum IntelliJ IDEAReplies: 0Last Post: 06-25-2009, 01:07 PM
- By bmelloni in forum EclipseReplies: 2Last Post: 04-03-2009, 04:03 PM
- By sardare in forum New To JavaReplies: 0Last Post: 04-02-2009, 11:59 PM
- By michelle in forum Jobs OfferedReplies: 0Last Post: 04-05-2008, 01:38 AM
- By pringle in forum New To JavaReplies: 0Last Post: 01-09-2008, 01:44 AM