[racket] rackunit vs test-engine

From: Joe Gilray (jgilray at gmail.com)
Date: Tue Aug 7 22:31:48 EDT 2012

Hi Matthias,

I will take you up on your offer of an example... thanks!

I've read about test-suite and test-case, but I'm not sure of the best way
to test each utility in a file.

Ideally the tests would be grouped with the functions:

(define f1 ...)
(module+ test
  (test-equal? "f1-tests" (f1 1 2) 1)
  (test-equal? "f1-tests" (f1 3 4) 4))

(define f2 ...)
(module+ test
  (test-equal? "f2-tests" (f2 1 2) 1)
  (test-equal? "f2-tests" (f2 3 4) 4))


I believe that the above scheme would work and run every time the enclosing
file/module is run... right?

What if I want to control when all the tests are run?  Can I somehow build
a trigger to fire off all the tests?  From the docs it looks like this is
the purpose of test-suite, but I don't know the mechanics when the test
cases are spread out in the file... maybe that isn't allowed and I will
need to group the tests?

Thanks again,

On Tue, Aug 7, 2012 at 6:00 PM, Matthias Felleisen <matthias at ccs.neu.edu>wrote:

> On Aug 7, 2012, at 8:24 PM, Joe Gilray wrote:
> > Now that 5.3 is out, I've been reading about submodules and their
> support for testing.  In the past I used test-engine/racket-tests for
> testing.
> >
> > Can someone please give me a rundown of when to use rackunit and
> advantages/disadvantages of test-engine and rackunit?
> -- test-engine provides test support for the teaching languages of
> DrRacket.
> -- rackunit is for 'adult' programmers, meaning programmers who have
> outgrown teaching languages.
> You can still use test-engine in plain #lang racket, and you could use
> rackunit in teaching languages.
> You can also use both with submodules especially (module+ test ...).
> Holler if you need examples -- Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120807/b5bea8a2/attachment-0001.html>

Posted on the users mailing list.