SchemeUnit can be found at
http://schematics.sourceforge.net/
Documentation is online at
http://schematics.sourceforge.net/schemeunit/index.htm
Noel
What we really need is an SRFI for unit testing. We want to encourage
people to write and run testsuites. This is easier if the api for
doing so is standardized and portable. I've been thinking about
proposing a SRFI myself if no-one else does it.
I suspect that it is better to not require that all tests be wrapped
in a top-level macro, like your make-test-case. While that is probably
a cleaner solution, I think it is easier to modify existing testsuites
if you instead do something like:
(test-begin "My test")
;; optional top-level definitions and expressions
;; tests:
(assert-xxx ...)
(test-end [number-of-tests])
test-begin initializes the framework, while test-end writes
out a summary of successes and failues. If the total number of
tests does not match the optional number-of-tests, then that is
an error. This can catch errors not caught by the test framework.
--
--Per Bothner
p...@bothner.com http://www.bothner.com/per/
I'm all for SRFIication and have planned to do so for SchemeUnit
around the 1.3 release (i.e. the next release). Obviously I think
SchemeUnit's design is at least converging to a local maximum or I
wouldn't have designed it that way. :)
The only other Scheme testing framework that I am aware of is Guile's
Greg
http://www.gnu.org/software/greg/greg.html
> I suspect that it is better to not require that all tests be wrapped
> in a top-level macro,
[...]
> test-begin initializes the framework, while test-end writes
> out a summary of successes and failues. If the total number of
> tests does not match the optional number-of-tests, then that is
> an error. This can catch errors not caught by the test framework.
Hmmm. How do you compose test suites then? For example, if I define
test suites in three different files how do I compose them into one
test suite containing all the tests?
Noel
[snipped]
> The only other Scheme testing framework that I am aware of is Guile's
> Greg
>
> http://www.gnu.org/software/greg/greg.html
From the XP (Extreme Programming) community:
http://www.c2.com/cgi/wiki?SchemeUnit is the bare minimum (like R5RS).
Like R5RS, you'll need to extend it yourself.
http://c2.com/cgi/wiki?LispMeUnit is a bit more extensive.
[snipped]
--
Darren Bane
PGP key available from keyservers or my .plan
Key ID: 2DA0C6EF. Call me for the fingerprint.
> (test-begin "My test")
> ;; optional top-level definitions and expressions
> ;; tests:
> (assert-xxx ...)
> (test-end [number-of-tests])
I can't think of a more unSchemeish solution. The beauty of Scheme is
its ability to define new scoping operators to define non-standard
scopes. (Not to mention the ability to easily nest scopes, to find
the end of a beginning scope (forward-sexp!), etc.) The creation of
scopes through begin-end pairs is the province of lame and halt
languages (C libraries, ASP, etc).
Shriram
--
Shriram Krishnamurthi
Assistant Professor of Computer Science
Brown University
I agree it is not an elegant solution. The main virtue is that it is
relatively easy to convert an existing program or test-case into this
format. Specifically, top-level code and definitions can remain
top-level code and definitions. That is an advantage, but I can't say
if that makes for for its problems, including clumy "non-Scheme" syntax
and poor composability.
I have a number of test case as part of Kawa. It should be trivial to
convert the existing tests into a test-begin/test-end faremwork. It
may harder to some of these tests into a more structured framework.
If such a framework has other advantages (such as better flexibility
into how the tests are run), it may be worth it changing the tests.
But if you want to test top-level forms, then that may not be an
option.