difftest-runner
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "difftest-runner", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A simple utility to assist in the exeuction of diff based tests. ", | ||
@@ -5,0 +5,0 @@ "directories": { |
111
README.md
@@ -49,3 +49,3 @@ # difftest-runner | ||
don't have to care and can just interact with this through the commands provided | ||
but it's good to know what the hell al this is: | ||
but it's good to know what the hell all this is: | ||
@@ -58,66 +58,111 @@ difftest | ||
In the example, the root directory is called 'difftest' this is the default | ||
and is technically able to be changed but who wants to fuss with that. | ||
In the example, the root directory is called 'difftest' which is the default. | ||
While it's technically possible to change this, why would we want to have that | ||
complexity? | ||
* /difftest/tests - This directory contains the 'scripts' that are run to do | ||
* `/difftest/tests` - This directory contains the 'scripts' that are run to do | ||
the 'testing'. Generally I think of these items as scripts but they simply | ||
need to be exec-able, and return some deterministic output to stdout. | ||
* /difftest/expected - This is where the 'good' output of the scripts is stored | ||
for future comparison. This directory will contain a like named file for each | ||
test found in the tests/ directory, which contains the output from the test | ||
as considered good. | ||
* `/difftest/expected` - This is where the 'good' output of the scripts is stored | ||
for future comparison. Each test in the `tests/` directory should have a corresponding | ||
file here which contains the output from the test that is considered good. | ||
* /difftest/results - This is where the output of the last run of each test is | ||
stored. The directory will contain a like named file for each test that | ||
contains the output captured (stdout and stderr) from the most recent run | ||
of the test. | ||
* `/difftest/results` - This is where the output of the last run of each test is | ||
stored. Each test in the `tests/` directory will create a file in this directory | ||
containing the captured output from stdout and stderr from the most recent run | ||
of the tests. | ||
* /difftest/filters - This contains filters to be applied to test output to | ||
* `/difftest/filters` - This contains filters to be applied to test output to | ||
make things that vary (like time stamps) fixed so comparison of output | ||
is simplified. | ||
is simplified. Oh, and... If you put a filter in here named 'default' and ther is | ||
no test specific filter, that one (the default) will be used. | ||
### So how do I use it | ||
difftest-runner doesn't care what your tests do, a big part of this was to create | ||
something that worked the same regardless of implementation of the 'system under | ||
test'. The whole point is only that test produce output on stdout and stderr, | ||
difftest compares that to previous output. | ||
Install it *(not yet published)* | ||
### So how do I use it? | ||
npm install -g difftest-runner | ||
1. Install it | ||
Initialize the directory you want to have tests in, I find this to be the root | ||
npm install -g difftest-runner | ||
1. Initialize the directory you want to have tests in, I find this to be the root | ||
of my repository. | ||
difftest init | ||
difftest init | ||
Make a test, currently the template test is nothing more than a stub of a | ||
1. Make a test, currently the template test is nothing more than a stub of a | ||
bash script. | ||
difftest create my_first_test | ||
difftest create my_first_test | ||
See that the test is really there | ||
1. See that the test is really there | ||
difftest show tests | ||
difftest show tests | ||
Edit the test to make it do something, this relies on the environment variable | ||
1. Edit the test to make it do something, this relies on the environment variable | ||
```EDITOR``` being set. | ||
difftest edit my_first_test | ||
difftest edit my_first_test | ||
See that it fails (we haven't defined passing yet!) | ||
1. See that it fails (we haven't defined passing yet!) | ||
difftest run | ||
difftest run | ||
Check the results of the last test run for my\_first\_test | ||
1. Check the results of the last test run for my\_first\_test | ||
difftest show my_first_test | ||
difftest show my_first_test | ||
Tell difftest that the results of the test are good | ||
1. Tell difftest that the results of the test are good | ||
difftest pass my_first_test | ||
difftest pass my_first_test | ||
See what victory looks like! | ||
1. See what victory looks like! | ||
difftest run | ||
difftest run | ||
### Examples | ||
Here are some examples of actual tests from somewhere else: | ||
difftest/tests/non_existant_doc | ||
#! /usr/bin/env bash | ||
# vi:ft=sh | ||
curl -s -w "\n%{http_code}" http://localhost:8080/this/key/shouldnt/exist | ||
difftest/expected/non_existant_doc | ||
{ | ||
"message": "no document matching key" | ||
} | ||
200 | ||
difftest/tests/delete_doc | ||
#! /usr/bin/env bash | ||
# vi:ft=sh | ||
KEY_PATH=`uuidgen` | ||
curl -s http://localhost:8080/this/is/a/test/key/${KEY_PATH} | ||
curl -s -X PUT http://localhost:8080/this/is/a/test/key/${KEY_PATH} --data '{"name":"pants"}' -H 'Content-Type: application/json' | ||
curl -s http://localhost:8080/this/is/a/test/key/${KEY_PATH} | ||
curl -s -X DELETE http://localhost:8080/this/is/a/test/key/${KEY_PATH} | ||
curl -s http://localhost:8080/this/is/a/test/key/${KEY_PATH} | ||
difftest/results/delete_doc | ||
{ | ||
"message": "no document matching key" | ||
}{ | ||
"message": "it's put" | ||
}{"name":"pants"}{ | ||
"message": "deleted" | ||
}{ | ||
"message": "no document matching key" | ||
} | ||
### TODO | ||
* allow for the creation of custom test templates |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16415
167
14