Search the web
Sign In
New User? Sign Up
testdrivendevelopment · Test-driven Development
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Mocking concrete objects   Message List  
Reply | Forward Message #27602 of 32000 |
Re: [TDD] Re: Mocking concrete objects

On 01/02/2008, Colin Jack <colin.jack@...> wrote:
> So I think I get your position now.
>
> You focus on testing behavior. Where this gets complex, because
> information is currently stored but not used in behavior, you test
> the end result (affect on GUI/other systems).

No.

I *start* with an automated end-to-end test of the desired *system*
behaviour that interacts with the boundaries of the system only
(client GUIs, events to/from from external systems, web-based reports,
etc.).

I then use unit-tests (with and without mock objects) to develop the
behaviour of the classes that implement the system-wide behaviour. If
that gets complex, I refactor the code to make it simpler to
unit-test. If information is stored but has no effect on the
behaviour of classes or the system as a whole, I delete it from the
system.

> The same presumably goes for the results of calls that return values.
> So if you are testing a method on a service/entity, and even if that
> method returned a value, you wouldn't directly test the value
> returned in a domain test. Instead you would verify that that the
> result is used in the correct way.

No. If a method returns a value, I test what it returns. But I do
try to minimise the number of methods that return values.

--Nat



Fri Feb 1, 2008 10:49 am

nat_pryce
Offline Offline
Send Email Send Email

Forward
Message #27602 of 32000 |
Expand Messages Author Sort by Date

... the ... and ... So I think I get your position now. You focus on testing behavior. Where this gets complex, because information is currently stored but not...
Colin Jack
colin.jack
Offline Send Email
Feb 1, 2008
9:53 am

... No. I *start* with an automated end-to-end test of the desired *system* behaviour that interacts with the boundaries of the system only (client GUIs,...
Nat Pryce
nat_pryce
Offline Send Email
Feb 1, 2008
10:49 am

... If that gets complex, I refactor the code to make it simpler to ... Sorry for taking to long to fully get it, its very different to the way we work which...
Colin Jack
colin.jack
Offline Send Email
Feb 2, 2008
11:17 pm

... Does the entity/service have tests that prove it works? If yes, then you can just use it with confidence. If not, write a wrapper for it, and the tests...
Gary Brown
gb70840
Offline Send Email
Jan 31, 2008
3:31 pm

... Ahh ok, what I meant is that if I am testing a method on an entity/service and if that method produces a result or a state change then at some point I'll...
Colin Jack
colin.jack
Offline Send Email
Jan 31, 2008
4:34 pm

... If you're not driving the development of each feature with a test, then, strictly, you're not doing test-driven development. If you start with some code in...
Nat Pryce
nat_pryce
Offline Send Email
Jan 31, 2008
1:49 pm

... Yeah I agree, we'd definitely be driving it from a user story and acceptance tests. I just don't necessarily then start work from our view/presenter and...
Colin Jack
colin.jack
Offline Send Email
Jan 31, 2008
3:13 pm

... Sorry, I wasn't very clear. And maybe we're using the term "layer" with different meanings. I wouldn't want an object in the domain model to work in terms...
Nat Pryce
nat_pryce
Offline Send Email
Jan 31, 2008
2:06 pm

... Oh yeah I was thinking that's what you meant. We'd probably do it in a service, a very thin service but a service none the less, because we *usually* even...
Colin Jack
colin.jack
Offline Send Email
Jan 31, 2008
4:43 pm

... but that's part of what the object /does/, it decides how to describe itself to it neighbours. I wouldn't want to put that somewhere I can't see it. S ...
Steve Freeman
smg_freeman
Online Now Send Email
Jan 31, 2008
5:00 pm

... It depends on the situation, I would say that its perfectly valid for your upper layers to do this sort of coordination. It depends though, if you are...
Colin Jack
colin.jack
Offline Send Email
Jan 31, 2008
6:36 pm

... I find that Domain Driven Design book contains some pretty dubious guidelines/patterns for domain modelling. For example, Repositories: when I see a...
Nat Pryce
nat_pryce
Offline Send Email
Jan 31, 2008
7:46 pm

... Note there are no dependencies *from* the domain. The adapter packages depend *on* the domain and *on* technology layers. --Nat...
Nat Pryce
nat_pryce
Offline Send Email
Jan 31, 2008
5:22 pm

... Sure, what I was trying to say with the indirect part is we just wouldn't do this too often....
Colin Jack
colin.jack
Offline Send Email
Jan 31, 2008
6:38 pm

... Why? You have the "application service" layer depend on the domain layer. What's the difference? --Nat...
Nat Pryce
nat_pryce
Offline Send Email
Jan 31, 2008
7:36 pm

... The main difference is that it makes it easier to view the domain in isolation, to me the need to (for example) send an e-mail is an application...
Colin Jack
colin.jack
Offline Send Email
Jan 31, 2008
8:04 pm

... I think I've not explained myself very well. The domain classes know nothing about email. They only work in terms of domain concepts. E.g. a domain...
Nat Pryce
nat_pryce
Offline Send Email
Jan 31, 2008
8:43 pm

... I pretty much understood and it's a good example. I guess the question is whether you want to see the act of calling the ComplianceRecording service in the...
Colin Jack
colin.jack
Offline Send Email
Jan 31, 2008
9:47 pm

Hi Nat, Steve and Colin, This has been a most informative exchange. Nat and Steve: Do/Will you discuss this in your book? Cheers, Rick ... [Non-text portions...
Rick Mugridge
rickmugridge
Offline Send Email
Feb 2, 2008
2:07 am

Not directly, but this is how we work and we're including a long worked example. S [sitting next to Nat] ... Steve Freeman http://www.mockobjects.com Winner of...
Steve Freeman
smg_freeman
Online Now Send Email
Feb 2, 2008
5:46 pm

Look forward to it, definitely a very interesting topic....
Colin Jack
colin.jack
Offline Send Email
Feb 2, 2008
11:15 pm
 First  |  |  Next > Last 
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help