sspec questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

sspec questions

Sophie424
I am considering using SSpec for my testing (really liked RSpec when I used
it). Do I need to unload SUnit before loading SSpec? If so, is that likely
to go away in the future (lots of existing stuff uses it, and would be nice
to be able to run their tests if I need to modify or extend). Is SSpec
becoming widely used? Any graphical test runner?

Thanks.



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: sspec questions

keith1y
itsme213 wrote:
> I am considering using SSpec for my testing (really liked RSpec when I used
> it). Do I need to unload SUnit before loading SSpec? If so, is that likely
> to go away in the future (lots of existing stuff uses it, and would be nice
> to be able to run their tests if I need to modify or extend). Is SSpec
> becoming widely used? Any graphical test runner?
>
> Thanks.
>  
I dont think SSpec depends upon SUnit at all. No you dont need to unload
SUnit.

As far as I am aware SSpec is not widely used, although there are about
3 people who have expressed an interest that I know of and one of the
architects of RSpec has been getting into squeak recently.

Someone was interested in implementing stubs but I have not heard
anything of progress recently.

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.

The ideas being to eventually be able to run SSpec specs with the
standard TestRunner.

Keith
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: sspec questions

keith1y

>
> 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.

Keith

 
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: sspec questions

Sophie424
Keith,

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.

Thanks.

"Keith Hodges" <[hidden email]> wrote in message
news:[hidden email]...

>
>>
>> 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.
>
> Keith



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: sspec questions

Sophie424
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 <..?..>

Alternately:
- subclass SpecContext
- <..?..>

Corrections welcome.


"itsme213" <[hidden email]> wrote in message
news:ffu9hb$us8$[hidden email]...

> Keith,
>
> 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.
>
> Thanks.
>
> "Keith Hodges" <[hidden email]> wrote in message
> news:[hidden email]...
>>
>>>
>>> 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.
>>
>> Keith



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: sspec questions

John Thornborrow
Hello,

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 [1],
however, you must not load the other packages, only the "SSpec" package,
otherwise it may not work.

To create your own SpecContext:

Subclass 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:

shouldBeEqual
        1 should equal: 1

shouldContainElement
        #(1 2 3 4 5) should include: 3

shouldRaiseError
        [ #() first ] should raise: Error

shouldNotRaiseError
        [ #(1) first ] should not raise: Error

shouldDoSomethingWithMock
        | mock |
        mock := self mock: 'A mock name'.
        (mock shouldReceive: #foo)
                twice
                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
handy. :)

[1] http://www.squeaksource.com/SSpec

I hope this helps,
John

www.pinesoft.co.uk

itsme213 wrote:

> 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 <..?..>
>
> Alternately:
> - subclass SpecContext
> - <..?..>
>
> Corrections welcome.
>
>
> "itsme213" <[hidden email]> wrote in message
> news:ffu9hb$us8$[hidden email]...
>> Keith,
>>
>> 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.
>>
>> Thanks.
>>
>> "Keith Hodges" <[hidden email]> wrote in message
>> news:[hidden email]...
>>>> 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.
>>>
>>> Keith
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


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

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: sspec questions

keith1y
John Thornborrow wrote:
> Hello,
>
> 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 [1],
> however, you must not load the other packages, only the "SSpec" package,
> otherwise it may not work.
>
>  
I attempted to reorganize TestRunner in SUnit-GUI-improved package to be
able to run Specs as well.

Modifications I made for SSpec included.

1. Tests/Specs may be defined by category
2. TestRunner does not assume that TestCase is the only root class.

I dont know what else would be needed... just that SSpecs may have to
pretend to be tests and perhaps to make TestResult and the SSpec
equivalent protocols match.

regards

Keith
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: sspec questions

Sophie424


> John Thornborrow wrote: ...
> 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 [1],

That was quite helpful, thank you. I am able to use SpecContext & your new
SpecRunner (not yet tried mocks).

> "Keith Hodges" <[hidden email]> wrote
> I attempted to reorganize TestRunner in SUnit-GUI-improved package to be
> able to run Specs as well.

This would be ideal. Might also lure more SUnit users :-)




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: sspec questions

John Thornborrow
In reply to this post by keith1y
Hi Keith,

Yes, I had a brief look into allowing SUnit to run SSPec's, but
unfortunately other projects meant I could not spend as much time as I
had liked on it, so I conjured up a new, separate runner instead. I'd
very much like full integration with Test Runner, too.

I'll try and work on it sometime. :)

John

www.pinesoft.co.uk

Keith Hodges wrote:

> John Thornborrow wrote:
>> Hello,
>>
>> 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 [1],
>> however, you must not load the other packages, only the "SSpec" package,
>> otherwise it may not work.
>>
>>  
> I attempted to reorganize TestRunner in SUnit-GUI-improved package to be
> able to run Specs as well.
>
> Modifications I made for SSpec included.
>
> 1. Tests/Specs may be defined by category
> 2. TestRunner does not assume that TestCase is the only root class.
>
> I dont know what else would be needed... just that SSpecs may have to
> pretend to be tests and perhaps to make TestResult and the SSpec
> equivalent protocols match.
>
> regards
>
> Keith
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


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

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: sspec questions

cnantais
In reply to this post by John Thornborrow
I've been using John's port for a little while now and it is working fine.  I just committed a change that adds #before and #after (like in RSpec) for setup and teardown routines.

The next thing I'd like to see is being able to call #shouldReceive: on objects and classes rather than just on mocks, as this fundamental functionality already exists in RSpec.  I am trying to add it right now, but my brain just spins at this hour.  Any volunteers?

Chad

John Thornborrow wrote
Hello,

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 [1],
however, you must not load the other packages, only the "SSpec" package,
otherwise it may not work.

To create your own SpecContext:

Subclass 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:

shouldBeEqual
        1 should equal: 1

shouldContainElement
        #(1 2 3 4 5) should include: 3

shouldRaiseError
        [ #() first ] should raise: Error

shouldNotRaiseError
        [ #(1) first ] should not raise: Error

shouldDoSomethingWithMock
        | mock |
        mock := self mock: 'A mock name'.
        (mock shouldReceive: #foo)
                twice
                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
handy. :)

[1] http://www.squeaksource.com/SSpec

I hope this helps,
John

www.pinesoft.co.uk

itsme213 wrote:
> 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 <..?..>
>
> Alternately:
> - subclass SpecContext
> - <..?..>
>
> Corrections welcome.
>
>
> "itsme213" <itsme213@hotmail.com> wrote in message
> news:ffu9hb$us8$1@ger.gmane.org...
>> Keith,
>>
>> 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.
>>
>> Thanks.
>>
>> "Keith Hodges" <keith_hodges@yahoo.co.uk> wrote in message
>> news:471EAD4E.1010006@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.
>>>
>>> Keith
>
>
>
> _______________________________________________
> seaside mailing list
> seaside@lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


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

_______________________________________________
seaside mailing list
seaside@lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside