From: Steve F. <st...@m3...> - 2005-05-28 13:25:16
|
several points: - the jdbc API is all interfaces, so I'd still suggest using jmock because it's easier to work with - yes, the jmock library is largely about mocking your own interfaces, but there's a reason for that. The intention is to drive the design. At first glance, it looks like your code would benefit from being broken up into smaller objects, which can be tested individually. MO tests should be focussed and readable. - if you want to test at this level, then it's more like a little integration test. Frankly, I'd think seriously about having little database and container instances to run against. - What's all this mock container and aspect weaving about? If you want to use mocks, then write a domain layer that fits just insider the container and test that independently. Then all the container does is assemble the pieces and pass them through to the domain layer. - Also consider a domain layer to manage persistence. This can be mocked out when testing the domain application code, and its real DB implementation tested separately. S. On 27 May 2005, at 08:14, Dmitri Colebatch wrote: > At this stage I'm really only using the java apis - I did look briefly > at jmock but it seemed more interested in allowing you to mock your > own apis, rather than supplying mocks of the java apis. as we use > soap for pretty well any communication than spans system boundaries I > don't have that requirement. > > I've attached the test that I'm working on atm.... would be interested > in some comments. > > cheers > dim > > On 5/27/05, Steve Freeman <st...@m3...> wrote: >> As a first step, you should consider moving to jmock, www.jmock,org, >> which is where we've been for a couple of weeks. >> >> Can you send an example of one of your SQL tests? >> S. >> >> On 27 May 2005, at 02:20, Dmitri Colebatch wrote: >>> hey dev list, >>> >>> I've been using mockobjects on and off where I've been able to >>> wrestle >>> enough control over what I'm working on, and generally have been >>> pretty happy with the project. However I'm finding that I'm starting >>> to need to extend things and would like to get a bit of a picture on >>> what's going on. I notice that there are several patches >>> outstanding, >>> and that the last release was in 2003, is anyone actively working on >>> mockobjects (I assume not)? Is there anyone who will apply patches >>> if >>> I submit them, or should I just keep my own copy of the build? >>> >>> At the moment I'm working with the SQL package, and am finding that I >>> need to add more checks regarding SQL statements executed. To do >>> this >>> I want to increment the actual count when >>> PreparedStatement.executeQuery is called, but I cant do that at >>> present because there's no way (that I can see) of finding the >>> current >>> count in ExpectationValue. To get around this I've made my own copy >>> of ExpecationValue and added a getActual method and would like to >>> submit this (and a few other changes) back to the project. Anyone >>> here >>> have any thoughts on it? |