I second that as well. Good design + proper use of mock objects solve almost
100% of the needs for external dependencies on the unit tests, whether test
files or environment dependencies such as the need to have a DB running.
Keep in mind that the easiest and the fastest it is to run the unit tests,
the more you'll run them. And it is definitly easier to run a test without
external dependencies, since you remove the risk of having your test fail
because of invalid or missing resources.

Of course this only applies to unit tests. Integration tests and acceptance
tests are another story.

- Vincent

> -----Original Message-----
> From: Jeffrey D. Brekke [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 30, 2003 8:29 AM
> To: Maven Users List
> Subject: Re: "src/java" or "src/main/java" ?
>
>
>
> Yes, I agree 100% with this "school of thought".  I want the tests to
> be fast and no external dependencies, even files.  I treat the need to
> fall back on external resources in programmer tests as a potential
> code/design smell.  Same with extensive/complex fixture setup.
>
> >>>>> On Thu, 30 Oct 2003 21:48:02 +1100, Peter Donald
> <[EMAIL PROTECTED]> said:
>
> > On Thu, 30 Oct 2003 01:05 pm, Ben Walding wrote:
> >> The rationale is this:
> >>
> >> If you have src/java and src/test, then where do you put resources
> >> for testing?
> >>
> >> eg: src/resources, src/test-resources
>
> > One school of thought suggests that no test should NEVER require
> > resources external to the TestCase. You can always use Mock objects
> > or manually construct pre-conditions for test, run the test and then
> > test the output.
>
> > External resources for unit tests are only required if there is
> > badly written code or badly written tests. While I previously used
> > to litter my unit tests with other resources I now think it is a
> > really bad idea. Can you give an example where there is a good
> > reason to have resources associated with unit tests?
>
> > (Integration tests are another thing entirely).
>
> How would integration tests be handled in this respect?  ( Maybe this
> is another thread starting up ).  How do you handle integration
> testing, and their potential test resources, using Maven?
>
> --
> =====================================================================
> Jeffrey D. Brekke                                   [EMAIL PROTECTED]
> Wisconsin,  USA                                     [EMAIL PROTECTED]
>                                                     [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to