Is it possible for you to refactor the TestSupport classes that the Model unit tests depend on into a third artifact, which both projects (Model and TestSupport) can then rely on (with scope=testing)?
As others have pointed out circular dependencies like this are a bad design. This might be hard to really say for sure without knowing what the Model code looks like, but I would say that if the Model core code is so convoluted/hard-to-use that you need to employ other objects just to build and test them, then something is off with the design of the Model - and you could probably re-design those classes to make a lot of things easier. -----Original Message----- From: David C. Hicks [mailto:[email protected]] Sent: Tuesday, June 16, 2009 12:17 PM To: Maven Users List Subject: Re: Quandary over testing support classes. Barrie Treloar wrote: > I think I see what you are saying. > > Model (test) depends upon Test Support (main and test jars) I am going > to assume that Test Support does not depend upon Model (either main or > test) > Almost, but not quite. TestSupport does depend on Model, because it includes the Builder classes that create Model objects for unit and functional tests. It just works out that some of the more complex unit tests for Model classes *also* use the builders. So, Model must be built before TestSupport, and TestSupport depends on Model. I just have these few unit tests that really belong in the Model module but are currently in the TestSupport module because of their dependencies on the builders. I've only been able to see a few ways out of this: 1) Move business logic out of the Model and into some intermediate module. (This moves me away from an OO paradigm. IMO) 2) Rewrite my Model unit tests so that they don't use builders. (This makes the tests less readable/maintainable.) 3) Create a new module that is nothing more than just the unit tests on the Model module. Then dependencies can be resolved pretty easily. 4) Keep it as I have it now, with a few "special" Model unit tests living in the TestSupport module. (I don't like this. I think it will cause confusion in the future.) I just figured that I couldn't possibly be the first person to run into this problem. So, I was curious how others resolved it. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
