Stefil

Simple TEst Framework In Lisp

Introduction

Simplicity is power!

After extensively using some of the other test frameworks we wanted something that is much more out of the way then usual unit test libraries and better fits our daily routine with Slime.

The interesting primitives of Stefil are deftest, defsuite, defixture and some assertion macros like is, signals and finishes, and probably that's about it. The novel (ehhh) idea in Stefil is that tests are basically instrumented defun's that ensure a runtime dynamic environment where the assertion macros can record various information about the assertions and failures, and provide useful restarts when dealing with errors and/or failures. The process of the dynamic environment setup properly handles nesting, so you can call any of your tests from the REPL (assuming that you properly defined your fixtures if you happen to need them). Also, instead of textual descriptions of the test results, we customized Slime's inspector which include things like actions to rerun tests.

As you can see, we look at (unit) testing as writing an ordinary application using slightly modified versions of the well known Lisp primitives, that uses as much functionality of the base lib with as little user interaction as possible. And to be a bit more useful, in the process this test application executes as much assertions as it can. Stefil provides ways to annotate your program with constructs that help storing the results of those assertions together with other contextual information (e.g. the test backtrace) that helps finding regressions and failures.

Now if I mention a few more features then I think we've given a full documentation of Stefil:

See the demo page or self-tests.lisp for more examples. There's also an extensive test framework comparision at Phil Gregory's blog.

Mailing Lists

Project members

Attila Lendvai
Tamás Borbély
Levente Mészáros

Repo

You can browse the Stefil darcs repository or get the tree with

darcs get http://common-lisp.net/project/stefil/darcs/stefil

We are using a branched Slime, but from time to time I test with the official Slime and guard features that need our branch with #+slime-wdim-branch. If you are interested, you can get that branch from the link below, but Stefil should be fully functional with the official Slime assuming it's recent enough. Please note that the relevant differences between the two Slime branches are subtle and mostly aesthetic ones in the inspector.

darcs get --partial http://common-lisp.net/project/cl-wdim/darcs/slime

License

BSD / Public Domain