James, see my response. It sounds to me like you may need to use Failsafe- particularly if you need to deploy your artifact to your application server and access system resources. If you are doing simple HTTP requests and want to set it up as a unit test- my advise if capture a response and save it- then create a mock out of that. If you need to run a test which depends on the current state of the external resource- it may be a better idea to think of it in terms of integration. Again though, i completely depends on what you are testing for and what effects you expect from the change in state. (A test which grabs a webpage and scrapes off the title and manipulates it somehow- can easily be treated in terms of a unit test if you set it up properly.... though some might feel that is an abuse of the idea.)
On Wed, Nov 13, 2013 at 9:09 AM, James Green <james.mk.gr...@gmail.com> wrote: > So where should one place a test that intends on exercising code against > something real? We have bits here that involve http calls that pre-date > soap and we therefore have no mock. > > A repeat of the second question from my original post: does the integrate > test execute against the artefact produced or against the original source > code? > > > On 13 November 2013 15:59, Stephen Connolly <stephen.alan.conno...@gmail.com >> wrote: > >> On 13 November 2013 15:20, James Green <james.mk.gr...@gmail.com> wrote: >> >> > I love the FAQ entry that states that it is intended for running >> > integration tests. >> > >> > The next entry should read: What do you call an integration test? >> > >> >> Any test that takes more than 1 second to run is *not* a unit test. >> >> Most tests that take more than 50ms to run are *not* unit tests... but >> there can be some exceptions >> >> If a unit test needs to call out to other systems, it will typically use a >> mock. >> >> If your test is actually calling out to other systems (which could be code >> from a dependency, etc - i.e. not just a TCP socket, could be a call within >> JVM) then it is testing the integration of those two parts... therefore it >> is not a unit test. >> >> There is no hard and fast rule as to where the transition occurs... but we >> know that tests who's execution time is greater than 1 second are not unit >> tests... and hence are integration tests... >> >> HTH >> >> > >> > I've asked around and no-one comes up with a consistent answer. I guess >> it >> > depends on what is executing the integration test. In this case maven is >> > invoking someone after the packaging phase so should I expect to run >> tests >> > against the packaged binary artefact? Is that the purpose here? >> > >> > Thanks, >> > >> > James >> > >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org