So you are suggesting an extension of SUnit. Great. You just forgot to attach your code ;-)

BTW: I think the current imnplementations of SUnit already carry a large amount of pollution. Just because JUnit and friends introduced special methods for testing equality and such, we also have this noise in SUnit. This is not to say your suggestion would be useless. Just make a proposal and let's discuss.


Joachim


Am 27.02.19 um 01:14 schrieb Tim Mackinnon:
Forgive me father, for I have sinned… but when I try to right good tests, that 
fail in a way I can understand them it seems that SUnit doesn’t want to help me…

Maybe I am missing something, but in 2019 it should be easy to write tests - 
particularly when we want people to contribute to adding more?

So when I want to right a test to assure that I’ve thrown an exception with the 
right message, why is it so hard (in the core image)? Am I missing something 
obvious?

My example model is supposed to throw a DomainException with a message 
indicating that the strings :are of different lengths” - I search Sunit and hit:


#should: raise: whoseDescriptionDoesNotInclude: description:

Awesome, so it fails - but does it make it easy to know what damn string I 
got….. nooooo that would be too easy? Its almost impossible to easily see what 
happened the way it works.

Instead I have to write:

self
                should: [ hammingCalculator distanceStrand1: 'AATG' strand2: 
'AAA' ]
                raise: DomainError
                withExceptionDo: [ :ex |
                        self assert: ex messageText equals: 'left and right 
strands must be of equal length' ].
                

And god forbid if I want to just ensure that the beginning of my error message 
is correct?

Why do we make this so hard? I know we don’t want to pollute the image, but 
testing is important, it should be easy for obvious cases and it should be more 
built in and less obscure. Is there something built in that makes this easier? 
Do I really have to load in more libraries for the easy cases?

Tim




--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:jtuc...@objektfabrik.de
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1



Reply via email to