learning about ClassTestCase

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

learning about ClassTestCase

Ben Coman
I bumped into ClassTestCase for the first time, with class comment...
"This class is intended for unit tests of individual classes and their metaclasses.
It provides methods to determine the coverage of the unit tests.

Subclasses are expected to re-implement:
    #classesToBeTested and 
    #selectorsToBeIgnored.
They should also implement to confirm that all methods have been tested.
    #testCoverage
        super testCoverage.
"

A few questions to improve my knowledge of how to use this...

  a. there are no implementors of #classesToBeTested but several of #classToBeTested. I presume the class comment is wrong?

  b. there are no implementors of #testCoverage, so I presume I can ignore that? (and I've no example to work from)

  c. ClassTestCase is subclassed 73 times, but #selectorsToBeIgnored is only implemented 9 times.  So this seems not critical? But btw, every of those at least ignores #printOn:.  I'm curious why?  These are tagged "private", but is that a good reason not to test it?

My purpose was to add a new class MagnitudeTest for a new 
new method to Magnitude in response to the recent #min:max: discussion.

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: learning about ClassTestCase

Stephane Ducasse-3
No idea. May be people were thinking that printOn: were not worth tests.
Now I would like to revisit some unused features of Sunit such as the history.

On Sun, Apr 22, 2018 at 3:44 AM, Ben Coman <[hidden email]> wrote:

> I bumped into ClassTestCase for the first time, with class comment...
> "This class is intended for unit tests of individual classes and their
> metaclasses.
> It provides methods to determine the coverage of the unit tests.
>
> Subclasses are expected to re-implement:
>     #classesToBeTested and
>     #selectorsToBeIgnored.
> They should also implement to confirm that all methods have been tested.
>     #testCoverage
>         super testCoverage.
> "
>
> A few questions to improve my knowledge of how to use this...
>
>   a. there are no implementors of #classesToBeTested but several of
> #classToBeTested. I presume the class comment is wrong?
>
>   b. there are no implementors of #testCoverage, so I presume I can ignore
> that? (and I've no example to work from)
>
>   c. ClassTestCase is subclassed 73 times, but #selectorsToBeIgnored is only
> implemented 9 times.  So this seems not critical? But btw, every of those at
> least ignores #printOn:.  I'm curious why?  These are tagged "private", but
> is that a good reason not to test it?
>
> My purpose was to add a new class MagnitudeTest for a new
> new method to Magnitude in response to the recent #min:max: discussion.
>
> cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: learning about ClassTestCase

Ben Coman


On 23 April 2018 at 00:48, Stephane Ducasse <[hidden email]> wrote:
No idea. May be people were thinking that printOn: were not worth tests.
Now I would like to revisit some unused features of Sunit such as the history.

On Sun, Apr 22, 2018 at 3:44 AM, Ben Coman <[hidden email]> wrote:
> I bumped into ClassTestCase for the first time, with class comment...
> "This class is intended for unit tests of individual classes and their
> metaclasses.
> It provides methods to determine the coverage of the unit tests.
>
> Subclasses are expected to re-implement:
>     #classesToBeTested and
>     #selectorsToBeIgnored

btw, I see in Pharo6.1 that most implementors of #selectorsToBeIgnored are circa 2003
authored by "brb".   Note it was useful to be able to see this info in "Versions"
which is currently not available in Pharo 7.

cheers -ben
 
> They should also implement to confirm that all methods have been tested.
>     #testCoverage
>         super testCoverage.
> "
>
> A few questions to improve my knowledge of how to use this...
>
>   a. there are no implementors of #classesToBeTested but several of
> #classToBeTested. I presume the class comment is wrong?
>
>   b. there are no implementors of #testCoverage, so I presume I can ignore
> that? (and I've no example to work from)
>
>   c. ClassTestCase is subclassed 73 times, but #selectorsToBeIgnored is only
> implemented 9 times.  So this seems not critical? But btw, every of those at
> least ignores #printOn:.  I'm curious why?  These are tagged "private", but
> is that a good reason not to test it?
>
> My purpose was to add a new class MagnitudeTest for a new
> new method to Magnitude in response to the recent #min:max: discussion.
>
> cheers -ben