|
From: Dean H. <dea...@Bo...> - 2005-04-25 14:08:38
|
Actually, the test is independent of the implementation(which allows =
easier refactoring). The implementation may fork a thread or not, and =
the test will still pass. The reason for forking occurs in many systems =
for many different reasons(disk i/o, talking to a slow legacy system =
through a stack, etc. etc.). On my current project, I am trying to =
write tests where I put a request to an api, and the implementation =
drops it in a thread pool to go to my mocktransport. I am doing =
subsystem testing. We do test first here, but we do subsystem testing =
and integration testing. We found subsystem testing gets more bang for =
the buck. It also results in very well defined apis for the subsystems. =
Lastly, it made refactoring of subsystems much easier without rewriting =
tests. Of course, this is just my personal experience. Some =
subsystems started out as just 3 classes, and others grew into 10,000 =
lines of code(but the api is still pretty small from the top(Low surface =
to volume ratio pattern).
One other thing I liked about mocklib was I didn't have to learn about =
isAnything(), isEquals()...instead, it returns the parameters to you and =
you can do what you like with them. Ie. I can do assertEquals(expected, =
param1) and assertSame(expected, param2) without learning more methods =
to use. That would be kind of nice to have.
Thanks,
dean
-----Original Message-----
From: nmo...@li... =
[mailto:nmo...@li...] On Behalf Of Steve =
Freeman
Sent: Sunday, April 24, 2005 3:12 PM
To: <nmo...@li...> =
<nmo...@li...>
Subject: Re: [Nmock-general] asynchronous testing
So what are we actually testing here? That SUT calls something that=20
incidentally forks a thread? Maybe the real solution is to encapsulate=20
that forking and mock /that/ behaviour.
On the other hand, when Nat finishes his port of jMock, it will be=20
possible to implement something like a InTime constraint within the=20
framework.
S.
On 18 Apr 2005, at 22:48, Dean Hiller wrote:
> Is there a way to use NMock to test subsystems that have different=20
> threads.
> =20
> Ie. I want to do something like this
> =20
> mockListener.setTimeout(10000);
> =20
> SysUnderTest.addClientListener(mockListener);
> SysUnderTest.invokeToStart();
> =20
> CalledMethod m =3D =
mockListener.expectMethodCall("someMethodOnListener");
> =20
> Where expectMethodCall actually does a Monitor.Wait(timeout) because=20
> the method "someMethodOnListener" is
> Invoked on a different thread and not invoked on the=20
> SysUnderTest.invokeToStart() client thread(ie. The test thread)
> =20
> Is there a way to do this? Java's mocklib does this very nicely for=20
> this type of testing.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id=14396&op=3Dick
_______________________________________________
Nmock-general mailing list
Nmo...@li...
https://lists.sourceforge.net/lists/listinfo/nmock-general
--------------------------------------------------------
The information contained in this e-mail and any attachments hereto are =
for the exclusive use of the addressee and may contain confidential, =
privileged and nondisclosable information. If the recipient of this =
e-mail is not the addressee, or a person responsible for delivering this =
e-mail to the addressee, such recipient is strictly prohibited from =
reading, printing, photocopying, distributing or otherwise using this =
e-mail or any attachments hereto in any way. If the recipient has =
received this e-mail in error, please send return e-mail immediately =
notifying us of your receipt of this e-mail and delete the e-mail from =
your inbox. Thank you.
|