Dear Pharo users and developers,
After my previous blog post on SUnit, I added a follow-up post https://all-objects-all-the-time.st/#/blog/posts/11 on the comparison of SUnit and RSpec for Ruby.
Happy reading!
This will be my last post for 2024. Happy holidays and all the best for 2025.
Ciao,
Koen
The difference between “example” and “test” is trivial, except that
Smalltalk already uses “example” for, well, examples. Sample code that is
intended to be read and imitated, not run for testing.
The difference between “expect” and “assert” is that “expect” asserts what
to expect while “assert” asserts what to expect. I hope that is clear.
A “rich expectation language” doesn’t strike me as a virtue. It has been a
long time since I regarded “rich formatting languages” like Fortran or
Common Lisp have as a good idea. Give me the basic building blocks I can
freely combine using my existing programming language. Indeed, that was
one of the great merits of sUnit: if you understand Smalltalk you
understand the test cases without having to learn a whole ‘nother “rich
language”.
As for the logging, there are two fairly clear issues. Nothing stops you
constructing such logs in Smalltalk. We could add a suitable “self log:
text” message to sUnit, which would make localisation easier. We could use
pragmas. But the second point is that nothing ensuresthat such messages
are true or accurate. For example, #pop DOESN’T remove the last item added
to a stack, and what’s more it shouldn’t. It removes the most recently
added REMAINING item, which is not at all the same thing.
As for “subject”, just as test cases normally check mutual consistency of
multiple methods, so it is not unusual for a test case to relate to
multiple objects. For example, to test the #copy method of some class, I
might make an instance, copy it, change one of the copies, and check that
the other did not change. Which one is the subject?
I like a programming language that makes me think, but not one that tries
to tell me how to think. Comparing RSpec with sUnit, I feel that RSpec is
trying to canalise my thinking, while sUnit offers me possibilities. Above
all, sUnit lets me extend it without drama.
On Mon, 30 Dec 2024 at 5:01 AM, Koen De
Hondt koen@all-objects-all-the-time.st wrote:
Dear Pharo users and developers,
After my previous blog post on SUnit, I added a follow-up post
https://all-objects-all-the-time.st/#/blog/posts/11 on the comparison
of SUnit and RSpec for Ruby.
Happy reading!
This will be my last post for 2024. Happy holidays and all the best for
2025.
Ciao,
Koen