|
1 | | -Directory structure |
2 | | -=================== |
| 1 | +# Netmockery Documentation |
| 2 | + |
| 3 | +* [Running netmockery](#running) |
| 4 | +* [Configuring netmockery](#configuring) |
| 5 | +* [Writing tests](#tests) |
| 6 | +* [Misc](#misc) |
| 7 | + |
| 8 | +<a name="running"></a> |
| 9 | +# Running netmockery |
| 10 | + |
| 11 | +Command line: |
| 12 | + |
| 13 | + netmockery.exe p:\ath\to\endpoint\directory |
| 14 | + |
| 15 | +Netmockery starts and listens on port ``5000``. |
| 16 | + |
| 17 | +## Installing as windows service |
| 18 | + |
| 19 | +To install: |
| 20 | + |
| 21 | + sc create netmockery binPath= "p:\ath\to\netmockery.exe p:\ath\to\endpoint\directory service" |
| 22 | + |
| 23 | +If ``p:\ath\to\netmockery.exe`` or ``p:\ath\to\endpoint\directory`` contains spaces, they must be escaped using ``\"`` . Example: |
| 24 | + |
| 25 | + sc create netmockery binPath= "p:\ath\to\netmockery.exe \"p:\ath\to\endpoint\directory\with space\" service" |
| 26 | + |
| 27 | +Start/stop service: |
| 28 | + |
| 29 | + net start netmockery |
| 30 | + net stop netmockery |
| 31 | + |
| 32 | +To uninstall: |
| 33 | + |
| 34 | + sc delete netmockery |
| 35 | + |
| 36 | +<a name="configuring"></a> |
| 37 | +# Configuring netmockery |
| 38 | + |
| 39 | +## Directory structure |
3 | 40 |
|
4 | 41 | TODO |
5 | 42 |
|
| 43 | +## Request matching |
6 | 44 |
|
7 | | -Request matching |
8 | | -================ |
| 45 | +TODO |
| 46 | + |
| 47 | +## Response creation |
9 | 48 |
|
10 | 49 | TODO |
11 | 50 |
|
| 51 | +<a name="tests"></a> |
| 52 | +# Writing tests |
| 53 | + |
| 54 | +Within a endpoint directory, a ``tests`` directory with a ``tests.json`` file defines test cases for the endpoint directory. |
| 55 | + |
| 56 | +Example ``tests.json`` file: |
| 57 | + |
| 58 | + [ |
| 59 | + { |
| 60 | + 'name': 'My first test', |
| 61 | + 'requestpath': '/somepath/', |
| 62 | + |
| 63 | + // optional request parameters: |
| 64 | + // querystring |
| 65 | + // requestbody |
| 66 | + |
| 67 | + // one or more test expectations: |
| 68 | + // expectedrequestmatcher |
| 69 | + // expectedresponsecreator |
| 70 | + // expectedresponsebody |
| 71 | + }, |
| 72 | + // More test cases |
| 73 | + ] |
| 74 | + |
| 75 | +Specifying the request: |
| 76 | + |
| 77 | +* ``name``: display name for test (required) |
| 78 | +* ``requestpath``: request path (required) |
| 79 | +* ``querystring``: request query string |
| 80 | +* ``requestbody``: request body |
| 81 | + |
| 82 | +Specifying the expectations: |
| 83 | + |
| 84 | +* ``expectedrequestmatcher``: Display name of request matcher |
| 85 | +* ``expectedresponsecreator``: Display name of response creator |
| 86 | +* ``expectedresponsebody``: Expected response body contents. If specified as ``file:filename``, the expected response body is read from the specified file. |
| 87 | + |
| 88 | +## Running tests |
| 89 | + |
| 90 | +Command line: |
| 91 | + |
| 92 | + # run all tests |
| 93 | + netmockery.exe p:\ath\to\endpoint\directory test |
| 94 | + |
| 95 | + # run single test, numeric parameter N specifies which test (first test is test 0 (zero)) |
| 96 | + netmockery.exe p:\ath\to\endpoint\directory test --only N |
| 97 | + |
| 98 | + # execute request specified by test N, but display respons (do not check test expectations) |
| 99 | + netmockery.exe p:\ath\to\endpoint\directory test --only N --showResponse |
| 100 | + |
| 101 | +<a name="misc"></a> |
| 102 | +# Misc |
| 103 | + |
| 104 | +TODO: delay parameter |
12 | 105 |
|
13 | | -Response creation |
14 | | -================= |
| 106 | +TODO: index.md documentation |
15 | 107 |
|
16 | | -TODO |
| 108 | +TODO: other commands, dump |
0 commit comments