1 | FBP Network Protocol
|
2 | ====================
|
3 |
|
4 | Tests, schemas, and specifications for the Flow Based Programming Network Protocol.
|
5 |
|
6 | The primary purpose of this project is to provide an easy way for developers to test their runtimes for compatibility with the [FBP Network Protocol](http://noflojs.org/documentation/protocol/). It also contains files useful to runtime developers, such as message schemas.
|
7 |
|
8 | The test suite currently works for runtimes based on the websocket transport.
|
9 |
|
10 | Installing the test suite
|
11 | -------------------------
|
12 |
|
13 | 1. Install Node.js using their [installer](http://nodejs.org/download/) or a [package manager](https://github.com/joyent/node/wiki/installing-node.js-via-package-manager)
|
14 |
|
15 | 2. Install this package.
|
16 |
|
17 | You can install it within your project, which will place the executables in `./node_modules/.bin`:
|
18 |
|
19 | ```
|
20 | cd /path/to/my/project
|
21 | npm install fbp-protocol
|
22 | ```
|
23 |
|
24 | Or globally, which should put executables on the `PATH`:
|
25 |
|
26 | ```
|
27 | sudo npm install fbp-protocol -g
|
28 | ```
|
29 |
|
30 |
|
31 | Testing a runtime
|
32 | -----------------
|
33 |
|
34 | 1. Before you can run the tests (successfully), your runtime needs to provide a few basic components. These are currently Repeat, Drop, and Output.
|
35 |
|
36 | By default, the tests will look for these in the "core" collection, however this is configurable. For example, if you want to implement these components as a one-off just for the tests, you can place them in a "tests" collection and pass `--collection tests` to `fbp-init`.
|
37 |
|
38 | 2. Use `fbp-init` to save a configuration file for your runtime into the current directory (keep in mind that if you used the local install method, you'll need to run `./node_modules/.bin/fbp-init`). Use `fbp-init -h` to see the available options and their defaults.
|
39 |
|
40 | Here's an example:
|
41 |
|
42 | ```
|
43 | fbp-init --name protoflo --port 3569 --command "python -m protoflo runtime"
|
44 | ```
|
45 |
|
46 | This will produce the file `fbp-protocol.json` in the current directory. Its location within your project is not important, but it needs to be in the current working directory when you run the tests.
|
47 |
|
48 | 3. Run the tests:
|
49 |
|
50 | ```
|
51 | fbp-test
|
52 | ```
|
53 |
|
54 | Examples
|
55 | --------
|
56 |
|
57 | A Node.js package using grunt: https://github.com/chadrik/noflo-runtime-websocket/tree/fbp-protocol
|
58 |
|
59 |
|
60 | TODO
|
61 | ----
|
62 | - capture server output to a log
|
63 | - isolate tests, so that one failure does not cause subsequent tests to fail
|
64 | - don't test capabilities that the runtime does not claim to support (as returned by `getruntime`)
|
65 | - add more tests:
|
66 | - `getsource` / `source`
|
67 | - topology restrictions
|
68 | - capturing output
|
69 | - add separate, optional tests for "classical" or "noflo" behaviors
|
70 | - use library for more flexible json comparison?
|
71 | - [joi](https://github.com/hapijs/joi)
|
72 | - [chai-json-schema](http://chaijs.com/plugins/chai-json-schema)
|
73 | - dynamically build tests based on separate json command / response files?
|
74 | - validate options read from `fbp-config.json`
|
75 | - make `fbp-init` prompt-based?
|
76 | - allow passing a path to `fbp-config.json` to `fbp-test`
|
77 | - make `init` and `test` subcommands of a `fbp` command?
|
78 |
|
\ | No newline at end of file |