Hello Panu,

Welcome to Pharo!

The free Pharo By Example book ( http://pharobyexample.org/ ) has a chapter (7) 
on SUnit, the Smalltalk Unit Testing framework. This should get you started.

The best place to learn about Smalltalk is by looking at code in your current 
image. There should be thousands of unit test there that can serve as examples.

I am not sure how to answer your specific question. If you need a MockObject it 
seems that you should just define it in your test package and use it right 
there. I can see several examples in my image. Search for classes *Mock*

Sven

On 31 Aug 2010, at 21:01, Panu Suominen wrote:

> Hi all,
> 
> I am quite new to smalltalk and I am probably having "cultural"
> difficulties. I mostly work with Java.
> So it is possible that there is trivial answer for my question or my
> question is just wrong. But here
> it goes.
> 
> I am implementing object that should make a call to some other object.
> I need to test that the
> caller works correctly based on the return value it receives. So
> basically the code and the test
> looks like this and I need to fill the XXXX part:
> 
> Object>>doSomething
>    result:=innerObject makeACall.
>    "based on result do something"
> 
> Test>>test
>    "get bogus object for testing from somewhere"
>    mockForTest := XXXX.
>    (Object new)
>        innerObject: mockForTest.
>        doSomething.
>    "check that something was done."
> 
> I am used to resolve this kind of problems using mock objects. I
> tought it would be easy to implement
> in smalltalk too because it is dynamic language. However with my limited
> searches I did not found much usable code or examples how to do it.
> So, my question is: is there some easy way to resolve this problem or
> does it require
> a bigger library? If it does, is there a library already for that?
> 
> -- 
> Panu
> 
> _______________________________________________
> Pharo-users mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users

Reply via email to