Fuller documentation in README.md

This commit is contained in:
simon 2014-04-03 08:21:26 +01:00
parent 75a35a5043
commit 403d72b89c

View file

@ -2,6 +2,14 @@
A Clojure library designed to generate charaterisation tests. A Clojure library designed to generate charaterisation tests.
## What are 'characterisation tests'?
Characterisation tests are a suite of tests which characterise the behaviour of a corpus of code. That is to say, they describe, and test, what it does now, whether that's correct or not. Otherwise, they are like unit tests. In fact, they are unit tests - except that unit tests are normally written to describe the desired behaviour of a corpus of code; these describe the actual behaviour.
## Why use charaterisation tests?
When modifying a corpus of legacy code, one wants to make only the desired change to its behaviour, and not introduce any 'regressions' (undesired behaviour changes). One way to do this is to start by writing (or generating) a set of tests which fully exercise the code, and all pass. Then, change only the test which describes the particular aspect of the behaviour that you want to change. That test (presumably) now fails, but all the others continue to pass. Now change the code under test until all tests pass again. The behaviour change is made, and no regressions have been introduced.
## Usage ## Usage
At this stage, try At this stage, try
@ -36,6 +44,14 @@ for the code passed. For example:
Note, however, that it only works if the function for which tests are being generated already exists in the environment. Note, however, that it only works if the function for which tests are being generated already exists in the environment.
## Where this is going
What I intend to end up with is a function
(generate-tests <filename>)
which will read the file at <filename>, presumed to be Clojure source, and write a new file containing a complete test suite for that source file, which should exercise every branch and find as many as possible of the interesting corner cases. This does not work yet!
## License ## License
Copyright © 2014 FIXME Copyright © 2014 FIXME