[Seaside] Re: sspec questions
john at pinesoft.co.uk
Fri Nov 2 12:03:00 UTC 2007
I recently made a fresh port of SSpec from VW and added some refinements
to the mock object behaviour. This is available on Squeaksource.com ,
however, you must not load the other packages, only the "SSpec" package,
otherwise it may not work.
To create your own SpecContext:
Create method category "specs"
Only methods in the category named "specs" will be run as part of the
spec, so you can use helper methods in other categories which will not run.
A few examples of specs:
1 should equal: 1
#(1 2 3 4 5) should include: 3
[ #() first ] should raise: Error
[ #(1) first ] should not raise: Error
| mock |
mock := self mock: 'A mock name'.
(mock shouldReceive: #foo)
andReturnConsecutively: #('foo' 'bar').
SomeClass new on: mock; doSomething
Finally, to run the spec using the text runner:
TextSpecRunner verbose run: SampleContext. Transcript endEntry
I've also, literally just this second, added a Morphic spec runner to
the repository. (SSpec-jmt.11) It's quite primitive, but I find it very
I hope this helps,
> Ah, I was looking for very similar RSpec-like facilities, but think some of
> them are not really needed (or are just not there). Would the following be
> correct for a simplified first-start at using SSpec (<..?..> is not clear to
> me, yet):
> - define any (indirect) subclass of TestCase
> - define a testXYZ method (or write class-side #suite methods)
> - use sSpec protocols #should, Mock, #shouldReceive, etc.
> - run as usual in TestRunner
> - run in Refactoring or other Browser by <..?..>
> - subclass SpecContext
> - <..?..>
> Corrections welcome.
> "itsme213" <itsme213 at hotmail.com> wrote in message
> news:ffu9hb$us8$1 at ger.gmane.org...
>> I'm poking around with SSpec and can't figure out how to get started with
>> writing my first spec in Squeak. Basic stuff like
>> - to make a dest case subclass XYZTestCase ...,
>> - test a method category by ...
>> - run your tests with a TextRunner by ... or in the Refactoring Browser
>> by ...
>> I have the current SSPec loaded (from Monticello), have SUnit-Improved
>> etc. Astel's pdfs have not helped much. Any pointers?
>> I have done some simple SUnit-based testing before.
>> "Keith Hodges" <keith_hodges at yahoo.co.uk> wrote in message
>> news:471EAD4E.1010006 at yahoo.co.uk...
>>>> As far as graphical runners is concerned.... I spent a lot of time
>>>> changing SUnit so that it might be compatible with SSpec, so that you
>>>> can specify tests/specs based upon method category as sspec does.
>>> I should mention that these changes are part of the SUnit-improved
>>> package available from in the "development" package universe.
> seaside mailing list
> seaside at lists.squeakfoundation.org
Pinesoft Computers are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
More information about the seaside