[plt-scheme] Automating tests

From: Grant Rettke (grettke at acm.org)
Date: Thu Oct 4 22:16:56 EDT 2007

On 10/4/07, Stephen De Gabrielle <stephen at degabrielle.name> wrote:
> I'm looking at cleaning up and automating my modules tests, can anyone
> suggest best practice for this in drscheme?

The way I have set it up is that for every module file there is a
corresponding test file:

<my-module>.ss, <my-module>-test.ss

Every module test file exports a test suite named:


Note the addition of the 's'

Finally there is a file all-test.ss that requires all of the
individual module tests and assembles a test suit composed of all of
the individual test suites exported by each module test:

(require "<my-module>.ss 1-test.ss"
           "<my-module>.ss 2-test.ss"
(provide all-system-tests run run-ui)

  (define all-system-tests
     "All Tests for system"

  (define run
    (lambda ()
      (test/text-ui all-system-tests)))

  (define run-ui
    (lambda ()
      (test/graphical-ui all-system-tests)))


By setting it up this way all of the system tests get run by hitting
run with this file open within DrScheme.

Originally I had set it up that you accomplish the same thing within
the individual module tests, but finally decided that the unit tests
ought to run quickly enough that it is not an undue burden to run all
of them.

Posted on the users mailing list.