From be414ff7725180d521da201280bec0e8c2fd0871 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 14 Aug 2020 01:42:01 +0300 Subject: [PATCH] started work on docs + some notes... Signed-off-by: Alex A. Naanou --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ test.js | 4 ++++ 2 files changed, 45 insertions(+) diff --git a/README.md b/README.md index 4843641..6615318 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ # test.js experimental test runner.... + +## Architecture + +This package implements two testing schemes: +- Combinational testing + Here the user sets up a set of `Setup`, `Modifier` and `Test` functions and the system + chains different combinations of the three and runs them. +- Unit testing + Simple independent tests. + +### Combinational testing + +In general the idea here is that you define three things: + + - `Setups` that build a test context and objects (the _setup_), + - `Modifiers` that modify the _setup_ in some way, + - `Tests` that test some aspect of a _setup_. + +The system builds chains in the form: +``` +setup -> modifier* -> test +``` + +Where `modifier` can me either single or a chain of modifiers. + +A `setup` and `modifier` can also include assertions/tests for direct testing and +sanity checks. + +The system defines a blank pass-through modifier and test, to alleviate the requirement +on the user to define at least one modifier and test, so in cases where it makes no +sense only a setup is required. + +Note that each element can reference and re-use other elements so for example a +modifier can call (re-use) other modifiers to avoid code duplication. + +This makes it simple to define procedural/generative tests. + + +### Unit testing + +This is the traditional self-contained test approach. \ No newline at end of file diff --git a/test.js b/test.js index 5d89ae2..924bdbe 100644 --- a/test.js +++ b/test.js @@ -246,6 +246,8 @@ module.Modifier = module.Modifiers = object.Constructor('Modifiers', Merged, {}) // default blank pass-through... + // NOTE: we need at least one modifier and at least one test for the + // system to run.... .add({ '-': function(_, s){ return s }) @@ -254,6 +256,8 @@ module.Test = module.Tests = object.Constructor('Tests', Merged, {}) // default blank pass-through... + // NOTE: we need at least one modifier and at least one test for the + // system to run.... .add({ '-': function(_, s){ return s })