@mbtest/mountebank 2.9.2-beta.9050
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +94 -0
- package/bin/mb +136 -0
- package/package.json +71 -0
- package/releases.json +52 -0
- package/src/cli/api.js +112 -0
- package/src/cli/cli.js +420 -0
- package/src/controllers/configController.js +64 -0
- package/src/controllers/feedController.js +115 -0
- package/src/controllers/homeController.js +58 -0
- package/src/controllers/imposterController.js +328 -0
- package/src/controllers/impostersController.js +215 -0
- package/src/controllers/logsController.js +52 -0
- package/src/models/behaviors.js +553 -0
- package/src/models/behaviorsValidator.js +186 -0
- package/src/models/compatibility.js +133 -0
- package/src/models/dryRunValidator.js +261 -0
- package/src/models/filesystemBackedImpostersRepository.js +908 -0
- package/src/models/http/baseHttpServer.js +207 -0
- package/src/models/http/headersMap.js +87 -0
- package/src/models/http/httpProxy.js +230 -0
- package/src/models/http/httpRequest.js +82 -0
- package/src/models/http/httpServer.js +18 -0
- package/src/models/http/index.js +18 -0
- package/src/models/https/cert/mb-cert.pem +20 -0
- package/src/models/https/cert/mb-csr.pem +16 -0
- package/src/models/https/cert/mb-key.pem +27 -0
- package/src/models/https/httpsServer.js +42 -0
- package/src/models/https/index.js +18 -0
- package/src/models/imposter.js +243 -0
- package/src/models/imposterPrinter.js +120 -0
- package/src/models/impostersRepository.js +49 -0
- package/src/models/inMemoryImpostersRepository.js +418 -0
- package/src/models/jsonpath.js +44 -0
- package/src/models/mbConnection.js +107 -0
- package/src/models/predicates.js +438 -0
- package/src/models/protocols.js +242 -0
- package/src/models/responseResolver.js +398 -0
- package/src/models/smtp/index.js +16 -0
- package/src/models/smtp/smtpRequest.js +60 -0
- package/src/models/smtp/smtpServer.js +109 -0
- package/src/models/tcp/index.js +18 -0
- package/src/models/tcp/tcpProxy.js +110 -0
- package/src/models/tcp/tcpRequest.js +23 -0
- package/src/models/tcp/tcpServer.js +156 -0
- package/src/models/tcp/tcpValidator.js +19 -0
- package/src/models/xpath.js +95 -0
- package/src/mountebank.js +245 -0
- package/src/public/images/arrow_down.png +0 -0
- package/src/public/images/arrow_up.png +0 -0
- package/src/public/images/book.jpg +0 -0
- package/src/public/images/dataflow.png +0 -0
- package/src/public/images/favicon.ico +0 -0
- package/src/public/images/forkme_right_orange_ff7600.png +0 -0
- package/src/public/images/mountebank.png +0 -0
- package/src/public/images/overview.gif +0 -0
- package/src/public/images/quote.png +0 -0
- package/src/public/images/tw-logo.png +0 -0
- package/src/public/scripts/jquery/jquery-3.6.1.min.js +2 -0
- package/src/public/scripts/urlHashHandler.js +31 -0
- package/src/public/stylesheets/application.css +424 -0
- package/src/public/stylesheets/ie.css +14 -0
- package/src/public/stylesheets/imposters.css +121 -0
- package/src/public/stylesheets/jqueryui/1.10.4/themes/smoothness/jquery-ui.css +1178 -0
- package/src/util/combinators.js +68 -0
- package/src/util/date.js +51 -0
- package/src/util/errors.js +55 -0
- package/src/util/helpers.js +131 -0
- package/src/util/inherit.js +28 -0
- package/src/util/ip.js +54 -0
- package/src/util/logger.js +83 -0
- package/src/util/middleware.js +256 -0
- package/src/util/scopedLogger.js +47 -0
- package/src/views/_footer.ejs +20 -0
- package/src/views/_header.ejs +113 -0
- package/src/views/_imposter.ejs +8 -0
- package/src/views/config.ejs +71 -0
- package/src/views/docs/api/behaviors/copy.ejs +427 -0
- package/src/views/docs/api/behaviors/decorate.ejs +182 -0
- package/src/views/docs/api/behaviors/lookup.ejs +220 -0
- package/src/views/docs/api/behaviors/shellTransform.ejs +153 -0
- package/src/views/docs/api/behaviors/wait.ejs +121 -0
- package/src/views/docs/api/behaviors.ejs +141 -0
- package/src/views/docs/api/contracts/addStub-description.ejs +10 -0
- package/src/views/docs/api/contracts/addStub.ejs +10 -0
- package/src/views/docs/api/contracts/config-description.ejs +32 -0
- package/src/views/docs/api/contracts/config.ejs +23 -0
- package/src/views/docs/api/contracts/home-description.ejs +18 -0
- package/src/views/docs/api/contracts/home.ejs +13 -0
- package/src/views/docs/api/contracts/imposter-description.ejs +439 -0
- package/src/views/docs/api/contracts/imposter.ejs +182 -0
- package/src/views/docs/api/contracts/imposters-description.ejs +13 -0
- package/src/views/docs/api/contracts/imposters.ejs +13 -0
- package/src/views/docs/api/contracts/logs-description.ejs +3 -0
- package/src/views/docs/api/contracts/logs.ejs +14 -0
- package/src/views/docs/api/contracts/stub-description.ejs +4 -0
- package/src/views/docs/api/contracts/stub.ejs +7 -0
- package/src/views/docs/api/contracts/stubs-description.ejs +4 -0
- package/src/views/docs/api/contracts/stubs.ejs +11 -0
- package/src/views/docs/api/contracts.ejs +133 -0
- package/src/views/docs/api/errors.ejs +64 -0
- package/src/views/docs/api/fault/connectionReset.ejs +31 -0
- package/src/views/docs/api/fault/randomDataThenClose.ejs +31 -0
- package/src/views/docs/api/faults.ejs +57 -0
- package/src/views/docs/api/injection.ejs +426 -0
- package/src/views/docs/api/json.ejs +205 -0
- package/src/views/docs/api/jsonpath.ejs +210 -0
- package/src/views/docs/api/mocks.ejs +130 -0
- package/src/views/docs/api/overview.ejs +968 -0
- package/src/views/docs/api/predicates/and.ejs +62 -0
- package/src/views/docs/api/predicates/contains.ejs +64 -0
- package/src/views/docs/api/predicates/deepEquals.ejs +114 -0
- package/src/views/docs/api/predicates/endsWith.ejs +66 -0
- package/src/views/docs/api/predicates/equals.ejs +125 -0
- package/src/views/docs/api/predicates/exists.ejs +118 -0
- package/src/views/docs/api/predicates/inject.ejs +67 -0
- package/src/views/docs/api/predicates/matches.ejs +66 -0
- package/src/views/docs/api/predicates/not.ejs +52 -0
- package/src/views/docs/api/predicates/or.ejs +79 -0
- package/src/views/docs/api/predicates/startsWith.ejs +62 -0
- package/src/views/docs/api/predicates.ejs +382 -0
- package/src/views/docs/api/proxies.ejs +191 -0
- package/src/views/docs/api/proxy/addDecorateBehavior.ejs +115 -0
- package/src/views/docs/api/proxy/addWaitBehavior.ejs +96 -0
- package/src/views/docs/api/proxy/injectHeaders.ejs +91 -0
- package/src/views/docs/api/proxy/predicateGenerators.ejs +600 -0
- package/src/views/docs/api/proxy/proxyModes.ejs +495 -0
- package/src/views/docs/api/stubs.ejs +391 -0
- package/src/views/docs/api/xpath.ejs +281 -0
- package/src/views/docs/cli/configFiles.ejs +133 -0
- package/src/views/docs/cli/customFormatters.ejs +53 -0
- package/src/views/docs/cli/help.ejs +6 -0
- package/src/views/docs/cli/replay.ejs +42 -0
- package/src/views/docs/cli/restart.ejs +10 -0
- package/src/views/docs/cli/save.ejs +68 -0
- package/src/views/docs/cli/start.ejs +234 -0
- package/src/views/docs/cli/stop.ejs +32 -0
- package/src/views/docs/commandLine.ejs +93 -0
- package/src/views/docs/communityExtensions.ejs +233 -0
- package/src/views/docs/gettingStarted.ejs +146 -0
- package/src/views/docs/mentalModel.ejs +51 -0
- package/src/views/docs/protocols/custom.ejs +231 -0
- package/src/views/docs/protocols/http.ejs +238 -0
- package/src/views/docs/protocols/https.ejs +246 -0
- package/src/views/docs/protocols/smtp.ejs +142 -0
- package/src/views/docs/protocols/tcp.ejs +431 -0
- package/src/views/docs/security.ejs +38 -0
- package/src/views/faqs.ejs +65 -0
- package/src/views/feed.ejs +33 -0
- package/src/views/imposter.ejs +22 -0
- package/src/views/imposters.ejs +33 -0
- package/src/views/index.ejs +89 -0
- package/src/views/license.ejs +30 -0
- package/src/views/logs.ejs +77 -0
- package/src/views/releases/v1.1.0.ejs +55 -0
- package/src/views/releases/v1.1.36.ejs +84 -0
- package/src/views/releases/v1.1.72.ejs +92 -0
- package/src/views/releases/v1.10.0.ejs +108 -0
- package/src/views/releases/v1.11.0.ejs +109 -0
- package/src/views/releases/v1.12.0.ejs +96 -0
- package/src/views/releases/v1.13.0.ejs +118 -0
- package/src/views/releases/v1.14.0.ejs +107 -0
- package/src/views/releases/v1.14.1.ejs +94 -0
- package/src/views/releases/v1.15.0.ejs +113 -0
- package/src/views/releases/v1.16.0.ejs +104 -0
- package/src/views/releases/v1.2.0.ejs +78 -0
- package/src/views/releases/v1.2.103.ejs +86 -0
- package/src/views/releases/v1.2.122.ejs +86 -0
- package/src/views/releases/v1.2.30.ejs +84 -0
- package/src/views/releases/v1.2.45.ejs +84 -0
- package/src/views/releases/v1.2.56.ejs +79 -0
- package/src/views/releases/v1.3.0.ejs +86 -0
- package/src/views/releases/v1.3.1.ejs +100 -0
- package/src/views/releases/v1.4.0.ejs +96 -0
- package/src/views/releases/v1.4.1.ejs +103 -0
- package/src/views/releases/v1.4.2.ejs +100 -0
- package/src/views/releases/v1.4.3.ejs +113 -0
- package/src/views/releases/v1.5.0.ejs +104 -0
- package/src/views/releases/v1.5.1.ejs +91 -0
- package/src/views/releases/v1.6.0.ejs +109 -0
- package/src/views/releases/v1.7.0.ejs +113 -0
- package/src/views/releases/v1.7.1.ejs +90 -0
- package/src/views/releases/v1.7.2.ejs +96 -0
- package/src/views/releases/v1.8.0.ejs +121 -0
- package/src/views/releases/v1.9.0.ejs +111 -0
- package/src/views/releases/v2.0.0.ejs +159 -0
- package/src/views/releases/v2.1.0.ejs +121 -0
- package/src/views/releases/v2.1.1.ejs +106 -0
- package/src/views/releases/v2.1.2.ejs +84 -0
- package/src/views/releases/v2.2.0.ejs +115 -0
- package/src/views/releases/v2.2.1.ejs +102 -0
- package/src/views/releases/v2.3.0.ejs +121 -0
- package/src/views/releases/v2.3.1.ejs +100 -0
- package/src/views/releases/v2.3.2.ejs +102 -0
- package/src/views/releases/v2.3.3.ejs +97 -0
- package/src/views/releases/v2.4.0.ejs +114 -0
- package/src/views/releases/v2.5.0.ejs +51 -0
- package/src/views/releases/v2.6.0.ejs +35 -0
- package/src/views/releases/v2.7.0.ejs +32 -0
- package/src/views/releases/v2.8.0.ejs +36 -0
- package/src/views/releases/v2.8.1.ejs +7 -0
- package/src/views/releases/v2.8.2.ejs +26 -0
- package/src/views/releases/v2.9.0.ejs +32 -0
- package/src/views/releases/v2.9.1.ejs +10 -0
- package/src/views/releases.ejs +26 -0
- package/src/views/sitemap.ejs +36 -0
- package/src/views/support.ejs +14 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<%
|
|
2
|
+
title = 'command line'
|
|
3
|
+
description = 'Command line parameters for starting mountebank'
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
<%- include('../_header') -%>
|
|
7
|
+
|
|
8
|
+
<h1>Configuring mountebank</h1>
|
|
9
|
+
|
|
10
|
+
<p>The basic command line structure is:</p>
|
|
11
|
+
|
|
12
|
+
<pre><code>mb [command=start] [options...]</code></pre>
|
|
13
|
+
|
|
14
|
+
<h2>mountebank commands</h2>
|
|
15
|
+
|
|
16
|
+
<p>As mountebank has grown in functionality, the number of commands and options
|
|
17
|
+
has increased significantly. The links below attempt to simplify that configuration
|
|
18
|
+
based on the core mountebank commands.</p>
|
|
19
|
+
|
|
20
|
+
<section class='accordion'>
|
|
21
|
+
<div>
|
|
22
|
+
<a class='section-toggler' id='start' name='start' href='#start'>mb start</a>
|
|
23
|
+
<section>
|
|
24
|
+
<%- include('cli/start') -%>
|
|
25
|
+
</section>
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
<a class='section-toggler' id='stop' name='stop' href='#stop'>mb stop</a>
|
|
29
|
+
<section>
|
|
30
|
+
<%- include('cli/stop') -%>
|
|
31
|
+
</section>
|
|
32
|
+
</div>
|
|
33
|
+
<div>
|
|
34
|
+
<a class='section-toggler' id='restart' name='restart' href='#restart'>mb restart</a>
|
|
35
|
+
<section>
|
|
36
|
+
<%- include('cli/restart') -%>
|
|
37
|
+
</section>
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
<a class='section-toggler' id='save' name='save' href='#save'>mb save</a>
|
|
41
|
+
<section>
|
|
42
|
+
<%- include('cli/save') -%>
|
|
43
|
+
</section>
|
|
44
|
+
</div>
|
|
45
|
+
<div>
|
|
46
|
+
<a class='section-toggler' id='replay' name='replay' href='#replay'>mb replay</a>
|
|
47
|
+
<section>
|
|
48
|
+
<%- include('cli/replay') -%>
|
|
49
|
+
</section>
|
|
50
|
+
</div>
|
|
51
|
+
<div>
|
|
52
|
+
<a class='section-toggler' id='help' name='help' href='#help'>mb help</a>
|
|
53
|
+
<section>
|
|
54
|
+
<%- include('cli/help') -%>
|
|
55
|
+
</section>
|
|
56
|
+
</div>
|
|
57
|
+
</section>
|
|
58
|
+
|
|
59
|
+
<h2>Saving test data: config files and formatters</h2>
|
|
60
|
+
|
|
61
|
+
<p>Note that <code>mb</code> is not persistent by default. Absent the <code>datadir</code>
|
|
62
|
+
or <code>impostersRepository</code> options,
|
|
63
|
+
stopping and restarting <code>mb</code> will lose all stubs and all requests. The following two
|
|
64
|
+
<code>mb</code> commands work in tandem to allow you to save and reload test data:</p>
|
|
65
|
+
|
|
66
|
+
<pre><code>mb save --savefile mb.json --formatter path/to/module
|
|
67
|
+
mb restart --configfile mb.json --formatter path/to/module</code></pre>
|
|
68
|
+
|
|
69
|
+
<p>The <code>configfile</code> sends a <a href='/docs/api/overview#change-stubs'><code>PUT</code> command</a>
|
|
70
|
+
to <code>/imposters</code>. View the <a href='/docs/api/contracts?type=imposters'>JSON contract</a>
|
|
71
|
+
to see what the contents should look like.</p>
|
|
72
|
+
|
|
73
|
+
<p>The <code>formatter</code> is optional. If specified, it gives you total control over the format of
|
|
74
|
+
the test data saved to disk, which allows you to split the content in separate files or convert
|
|
75
|
+
to a format used by other service virtualization tools. The links below describe the default
|
|
76
|
+
formatter for configuration files as well as how to define a custom formatter.</p>
|
|
77
|
+
|
|
78
|
+
<section class='accordion'>
|
|
79
|
+
<div>
|
|
80
|
+
<a class='section-toggler' id='config-files' name='config-files' href='#config-files'>Default config file parsing</a>
|
|
81
|
+
<section>
|
|
82
|
+
<%- include('cli/configFiles') -%>
|
|
83
|
+
</section>
|
|
84
|
+
</div>
|
|
85
|
+
<div>
|
|
86
|
+
<a class='section-toggler' id='custom-formatters' name='custom-formatters' href='#custom-formatters'>Custom formatters</a>
|
|
87
|
+
<section>
|
|
88
|
+
<%- include('cli/customFormatters') -%>
|
|
89
|
+
</section>
|
|
90
|
+
</div>
|
|
91
|
+
</section>
|
|
92
|
+
|
|
93
|
+
<%- include('../_footer') -%>
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
<%
|
|
2
|
+
title = 'client libraries'
|
|
3
|
+
description = 'Native client libraries for your favorite language'
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
<%- include('../_header') -%>
|
|
7
|
+
|
|
8
|
+
<h1>Client Libraries</h1>
|
|
9
|
+
|
|
10
|
+
<p>While mountebank speaks <a href='/docs/api/overview'>REST</a>, he truly loves your native language
|
|
11
|
+
and has no desire to make you learn another language. If you have a native library you'd like others
|
|
12
|
+
to be able to use, please send mountebank a note on the <a href='/support'>support page</a> or through
|
|
13
|
+
a pull request to this page and he will add it to the list below.</p>
|
|
14
|
+
|
|
15
|
+
<p>Some of these are still in their early stages. Feel free to help the authors out ;></p>
|
|
16
|
+
|
|
17
|
+
<table>
|
|
18
|
+
<tr>
|
|
19
|
+
<th>Language</th>
|
|
20
|
+
<th>Name</th>
|
|
21
|
+
<th>Author</th>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td>C#</td>
|
|
25
|
+
<td><a href='https://github.com/mattherman/MbDotNet'>MbDotNet</a></td>
|
|
26
|
+
<td>Matthew Herman</td>
|
|
27
|
+
</tr>
|
|
28
|
+
<tr>
|
|
29
|
+
<td>Clojure</td>
|
|
30
|
+
<td><a href='https://github.com/mdaley/charlatan'>Charlatan</a></td>
|
|
31
|
+
<td>Matthew Daley</td>
|
|
32
|
+
</tr>
|
|
33
|
+
<tr>
|
|
34
|
+
<td>Delphi</td>
|
|
35
|
+
<td><a href='https://github.com/JamieGeddes/mountebank-delphi'>mountebank-delphi</a></td>
|
|
36
|
+
<td>Jamie Geddes</td>
|
|
37
|
+
</tr>
|
|
38
|
+
<tr>
|
|
39
|
+
<td>F#</td>
|
|
40
|
+
<td><a href='https://github.com/mattherman/MbDotNet.FSharp'>MbDotNet.FSharp</a></td>
|
|
41
|
+
<td>Matthew Herman</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td rowspan='2'>Go</td>
|
|
45
|
+
<td><a href='https://github.com/durmaze/gobank'>GoBank</a></td>
|
|
46
|
+
<td>Erkan</td>
|
|
47
|
+
</tr>
|
|
48
|
+
<tr>
|
|
49
|
+
<td><a href='https://github.com/senseyeio/mbgo'>mbgo</a></td>
|
|
50
|
+
<td>Senseye</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td>Java</td>
|
|
54
|
+
<td><a href='https://github.com/thejamesthomas/javabank'>javabank</a></td>
|
|
55
|
+
<td>James Thomas</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td>JavaScript</td>
|
|
59
|
+
<td><a href='https://www.npmjs.com/package/mountebank-helper'>mountebank-helper</a></td>
|
|
60
|
+
<td>Alex</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<td>Perl</td>
|
|
64
|
+
<td><a href='https://metacpan.org/release/Test-Mountebank'>Test::Mountebank</a></td>
|
|
65
|
+
<td>Dagfinn Reiersøl</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td rowspan='3'>PHP</td>
|
|
69
|
+
<td><a href="https://github.com/meare/juggler">Juggler</a></td>
|
|
70
|
+
<td>Andrejs Mironovs</td>
|
|
71
|
+
</tr>
|
|
72
|
+
<tr>
|
|
73
|
+
<td><a href='https://github.com/demyan112rv/mountebank-api-php'>mountebank-api-php</a></td>
|
|
74
|
+
<td>Demyanovsky Ruslan</td>
|
|
75
|
+
</tr>
|
|
76
|
+
<tr>
|
|
77
|
+
<td><a href='https://packagist.org/packages/abevallez/mountebank-php'>mountebank-php</a></td>
|
|
78
|
+
<td>Abraham Vallez</td>
|
|
79
|
+
</tr>
|
|
80
|
+
<tr>
|
|
81
|
+
<td rowspan='5'>Python</td>
|
|
82
|
+
<td><a href='https://pypi.python.org/pypi/mountepy'>mountepy</a></td>
|
|
83
|
+
<td>Michał Bultrowicz</td>
|
|
84
|
+
</tr>
|
|
85
|
+
<tr>
|
|
86
|
+
<td><a href='https://github.com/kevinjqiu/py-mountebank'>py-mountebank</a></td>
|
|
87
|
+
<td>Kevin Qiu</td>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td><a href='https://pypi.python.org/pypi/mountebank-python'>mountebank-python</a></td>
|
|
91
|
+
<td>Alex Holyoke</td>
|
|
92
|
+
</tr>
|
|
93
|
+
<tr>
|
|
94
|
+
<td><a href='https://pypi.org/project/mbtest'>mbtest</a></td>
|
|
95
|
+
<td>Simon Brunning</td>
|
|
96
|
+
</tr>
|
|
97
|
+
<tr>
|
|
98
|
+
<td><a href='https://pypi.org/project/mounty/'>mounty</a></td>
|
|
99
|
+
<td>Vasile Pop</td>
|
|
100
|
+
</tr>
|
|
101
|
+
<tr>
|
|
102
|
+
<td>Ruby</td>
|
|
103
|
+
<td><a href='https://github.com/CoderKungfu/mountebank-gem'>mountebank-gem</a></td>
|
|
104
|
+
<td>Michael Cheng</td>
|
|
105
|
+
</tr>
|
|
106
|
+
<tr>
|
|
107
|
+
<td>Shell</td>
|
|
108
|
+
<td><a href='https://github.com/sebero/mountebank-sh'>mountebank-sh</a></td>
|
|
109
|
+
<td>Sergi Bech Robleda</td>
|
|
110
|
+
</tr>
|
|
111
|
+
<tr>
|
|
112
|
+
<td>TypeScript</td>
|
|
113
|
+
<td><a href='https://www.npmjs.com/package/@anev/ts-mountebank'>ts-mountebank</a></td>
|
|
114
|
+
<td>Angela Evans</td>
|
|
115
|
+
</tr>
|
|
116
|
+
<tr>
|
|
117
|
+
<td>Swift</td>
|
|
118
|
+
<td><a href='https://github.com/MountebankSwift/MountebankSwift/'>MountebankSwift</a></td>
|
|
119
|
+
<td>Teameh & Mat1th</td>
|
|
120
|
+
</tr>
|
|
121
|
+
</table>
|
|
122
|
+
|
|
123
|
+
<h1>Persistence Stores</h1>
|
|
124
|
+
|
|
125
|
+
<p>By default, mountebank stores everything in memory, which becomes a performance bottleneck
|
|
126
|
+
at scale. The <a href='//docs/commandLine#start'><code>--datadir</code></a> option creates
|
|
127
|
+
a local file-based data store, but the community has created (or is creating) more performant
|
|
128
|
+
and robust options using first-class databases using the <code>--impostersRepository</code>
|
|
129
|
+
command line option.</p>
|
|
130
|
+
|
|
131
|
+
<table>
|
|
132
|
+
<tr>
|
|
133
|
+
<th>Database</th>
|
|
134
|
+
<th>Name</th>
|
|
135
|
+
<th>Author</th>
|
|
136
|
+
</tr>
|
|
137
|
+
<tr>
|
|
138
|
+
<td>Redis</td>
|
|
139
|
+
<td><a href='https://github.com/eljusto/mountebank-redis-repository'>mountebank-redis-repository</a></td>
|
|
140
|
+
<td>Boris Zhidkov</td>
|
|
141
|
+
</tr>
|
|
142
|
+
<tr>
|
|
143
|
+
<td>Mongo</td>
|
|
144
|
+
<td><a href='https://github.com/ibnc/mountebankMongo'>mountebankMongo</a></td>
|
|
145
|
+
<td>Isabelle Carter (who created the plugin capability)</td>
|
|
146
|
+
</tr>
|
|
147
|
+
</table>
|
|
148
|
+
|
|
149
|
+
<h1>Build Plugins</h1>
|
|
150
|
+
|
|
151
|
+
<p>Since <code>mb</code> is another process to manage during your build, having a
|
|
152
|
+
plugin for your build tool is handy. If you have a plugin, please add it to this page
|
|
153
|
+
or let me know about it.</p>
|
|
154
|
+
|
|
155
|
+
<table>
|
|
156
|
+
<tr>
|
|
157
|
+
<th>Build tool</th>
|
|
158
|
+
<th>Name</th>
|
|
159
|
+
<th>Author</th>
|
|
160
|
+
</tr>
|
|
161
|
+
<tr>
|
|
162
|
+
<td>Grunt</td>
|
|
163
|
+
<td><a href='https://github.com/mountebank-testing/mountebank-grunt'>grunt-mountebank</a></td>
|
|
164
|
+
<td>Brandon Byars</td>
|
|
165
|
+
</tr>
|
|
166
|
+
<tr>
|
|
167
|
+
<td>Gradle</td>
|
|
168
|
+
<td><a href='https://github.com/ndrwdn/mountebank-gradle'>mountebank-gradle</a></td>
|
|
169
|
+
<td>Andrew Dean</td>
|
|
170
|
+
</tr>
|
|
171
|
+
<tr>
|
|
172
|
+
<td>Maven</td>
|
|
173
|
+
<td><a href='https://github.com/thejamesthomas/mountebank-maven-plugin'>mountebank-maven-plugin</a></td>
|
|
174
|
+
<td>James Thomas</td>
|
|
175
|
+
</tr>
|
|
176
|
+
</table>
|
|
177
|
+
|
|
178
|
+
<h2>Build Plugin Implementation Notes</h2>
|
|
179
|
+
|
|
180
|
+
<p>As of v1.4.3, <code>mb</code> writes the pidfile (mb.pid by default, although it can be overridden on the
|
|
181
|
+
command line) only after it has fully initialized, including binding to the socket and initializing any
|
|
182
|
+
imposters passed in a config file. You can use this fact to wait for the pidfile creation before returning
|
|
183
|
+
from a build task to guarantee initialization before the next task runs.</p>
|
|
184
|
+
|
|
185
|
+
<p>Also note that the command to actually run mountebank can vary depending on both the platform and the installation
|
|
186
|
+
package. To support all options, you will need to dynamically determine the executable command to run.</p>
|
|
187
|
+
|
|
188
|
+
<p>See the <a href='https://github.com/bbyars/grunt-mountebank/blob/master/tasks/mb.js'>grunt-mountebank code</a>
|
|
189
|
+
that mountebank uses for its build for an example.</p>
|
|
190
|
+
|
|
191
|
+
<h1>User Interfaces</h1>
|
|
192
|
+
|
|
193
|
+
<p>The following help drive mountebank through a user interface.</p>
|
|
194
|
+
|
|
195
|
+
<table>
|
|
196
|
+
<tr>
|
|
197
|
+
<th>Name</th>
|
|
198
|
+
<th>Author</th>
|
|
199
|
+
</tr>
|
|
200
|
+
<tr>
|
|
201
|
+
<td><a href='http://donhenton.github.io/mountebank-UI/public_html/index.html#/'>Mountebank-UI</a></td>
|
|
202
|
+
<td>Don Henton</td>
|
|
203
|
+
</tr>
|
|
204
|
+
<tr>
|
|
205
|
+
<td><a href='https://github.com/Opus-Software/disguise'>Disguise</a></td>
|
|
206
|
+
<td>Opus Software</td>
|
|
207
|
+
</tr>
|
|
208
|
+
</table>
|
|
209
|
+
|
|
210
|
+
<h1>Additional tools</h1>
|
|
211
|
+
|
|
212
|
+
<p>The following are higher level tools that augment mountebank with additional functionality.</p>
|
|
213
|
+
|
|
214
|
+
<table>
|
|
215
|
+
<tr>
|
|
216
|
+
<th>Name</th>
|
|
217
|
+
<th>Description</th>
|
|
218
|
+
<th>Author</th>
|
|
219
|
+
</tr>
|
|
220
|
+
<tr>
|
|
221
|
+
<td><a href='https://github.com/DevTestSolutions/TestDoubles'>TestDoubles</a></td>
|
|
222
|
+
<td>Adds cluster support, named REST APIs, persisted request/response pairs, enhanced command
|
|
223
|
+
line interface (CLI), with packaging mechanisms including Node.js, Docker, Vagrant, PM2 etc</td>
|
|
224
|
+
<td>CA Technologies</td>
|
|
225
|
+
</tr>
|
|
226
|
+
<tr>
|
|
227
|
+
<td><a href='https://github.com/Tzinov15/swagger-bank'>swagger-bank</a></td>
|
|
228
|
+
<td>A library to bridge Swagger API specifications and the Mountebank Test-Double tool</td>
|
|
229
|
+
<td>Alex</td>
|
|
230
|
+
</tr>
|
|
231
|
+
</table>
|
|
232
|
+
|
|
233
|
+
<%- include('../_footer') -%>
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<%
|
|
2
|
+
title = 'getting started'
|
|
3
|
+
description = 'A getting started guide for using mountebank'
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
<%- include('../_header') -%>
|
|
7
|
+
|
|
8
|
+
<h1>Getting Started</h1>
|
|
9
|
+
|
|
10
|
+
<p><b>Install:</b></p>
|
|
11
|
+
|
|
12
|
+
<pre><code>npm install -g mountebank</code></pre>
|
|
13
|
+
|
|
14
|
+
<p><b>Run:</b></p>
|
|
15
|
+
|
|
16
|
+
<pre><code>mb</code></pre>
|
|
17
|
+
|
|
18
|
+
<p><b>Alternative install methods:</b></p>
|
|
19
|
+
|
|
20
|
+
<p>You can avoid a global install with <code>npm install mountebank</code>, in which
|
|
21
|
+
case you can run mountebank using the <code>npx mb</code> command.</p>
|
|
22
|
+
|
|
23
|
+
<p>Alternatively, you can download the Docker image and run:</p>
|
|
24
|
+
|
|
25
|
+
<pre><code>docker pull bbyars/mountebank:<%= version %>
|
|
26
|
+
docker run --rm -p 2525:2525 -p 4545:4545 -p 5555:5555 bbyars/mountebank:<%= version %> start </code></pre>
|
|
27
|
+
|
|
28
|
+
<p><b>Use:</b></p>
|
|
29
|
+
|
|
30
|
+
<p>By default, mountebank listens on port 2525, but that's not the port that your
|
|
31
|
+
imposters (test doubles) will listen on. To show a couple different kinds of
|
|
32
|
+
imposters, let's create both an http imposter and a tcp one. We'll use the
|
|
33
|
+
<code>curl</code> command line tool to call mountebank's
|
|
34
|
+
<a href='/docs/api/overview'>api</a>. The following command creates the
|
|
35
|
+
http imposter, listening on port 4545, by <code>POST</code>ing to
|
|
36
|
+
http://localhost:2525/imposters with the given body.
|
|
37
|
+
The <code>predicates</code> are optional - if you don't include any, the stub
|
|
38
|
+
always matches, and the response is always sent.</p>
|
|
39
|
+
|
|
40
|
+
<p class='info-icon'>The <a href='/docs/api/contracts'>contracts page</a>
|
|
41
|
+
provides an easy to use exploration of the JSON structure.</p>
|
|
42
|
+
|
|
43
|
+
<testScenario name='getting-started'>
|
|
44
|
+
<step type='exec'>
|
|
45
|
+
<pre><code>curl -i -X POST -H 'Content-Type: application/json' http://localhost:<change to='<%= port %>'>2525</change>/imposters --data '{
|
|
46
|
+
"port": 4545,
|
|
47
|
+
"protocol": "http",
|
|
48
|
+
"stubs": [{
|
|
49
|
+
"responses": [
|
|
50
|
+
{ "is": { <strong class='highlight1'>"statusCode": 400</strong> }}
|
|
51
|
+
],
|
|
52
|
+
"predicates": [{
|
|
53
|
+
"and": [
|
|
54
|
+
{
|
|
55
|
+
"equals": {
|
|
56
|
+
"path": "/test",
|
|
57
|
+
"method": "POST",
|
|
58
|
+
"headers": { "Content-Type": "application/json" }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"not": {
|
|
63
|
+
"contains": { "body": "requiredField" },
|
|
64
|
+
"caseSensitive": true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}]
|
|
69
|
+
}]
|
|
70
|
+
}'
|
|
71
|
+
</code></pre>
|
|
72
|
+
</step>
|
|
73
|
+
|
|
74
|
+
<p>Let's test it out:</p>
|
|
75
|
+
|
|
76
|
+
<step type='exec'>
|
|
77
|
+
<pre><code>curl -i -X POST -H 'Content-Type: application/json' http://localhost:4545/test --data '{"optionalField": true}'</code></pre>
|
|
78
|
+
|
|
79
|
+
<assertResponse>
|
|
80
|
+
<pre><code>HTTP/1.1 <strong class='highlight1'>400</strong> Bad Request
|
|
81
|
+
Connection: close
|
|
82
|
+
Date: <volatile>Sat, 04 Jan 2014 02:48:16 GMT</volatile>
|
|
83
|
+
Transfer-Encoding: chunked</code></pre>
|
|
84
|
+
</assertResponse>
|
|
85
|
+
</step>
|
|
86
|
+
|
|
87
|
+
<p>Had we not tailored the request to match the predicates, we would have instead received
|
|
88
|
+
the default response. For instance, let's send a request that leaves off the Content-Type:</p>
|
|
89
|
+
|
|
90
|
+
<step type='exec'>
|
|
91
|
+
<pre><code>curl -i -X POST http://localhost:4545/test --data '{"optionalField": true}'</code></pre>
|
|
92
|
+
|
|
93
|
+
<assertResponse>
|
|
94
|
+
<pre><code>HTTP/1.1 200 OK
|
|
95
|
+
Connection: close
|
|
96
|
+
Date: <volatile>Sat, 04 Jan 2014 02:48:16 GMT</volatile>
|
|
97
|
+
Transfer-Encoding: chunked</code></pre>
|
|
98
|
+
</assertResponse>
|
|
99
|
+
</step>
|
|
100
|
+
|
|
101
|
+
<p>mountebank can stub binary tcp equally well, which is convenient when your application integrates
|
|
102
|
+
with a downstream system using one of the myriad binary RPC
|
|
103
|
+
protocols. Those protocols tend to rely on language-specific serialization to return an object
|
|
104
|
+
graph. Your test can use the same serialization code to create a binary stream of the object you want
|
|
105
|
+
the imposter to return during an RPC call, and encode it as a base64 string. That string is what you
|
|
106
|
+
send to the imposter. In the example below, we're telling the imposter to respond with a base64-encoded
|
|
107
|
+
string of "hello, world!" when a tcp request containing the string "sayHello" is sent to port 5555, which
|
|
108
|
+
could correspond to the method name serialized in the RPC call:</p>
|
|
109
|
+
|
|
110
|
+
<step type='exec'>
|
|
111
|
+
<pre><code>curl -i -X POST -H 'Content-Type: application/json' http://localhost:<change to='<%= port %>'>2525</change>/imposters --data '{
|
|
112
|
+
"port": 5555,
|
|
113
|
+
"protocol": "tcp",
|
|
114
|
+
"mode": "binary",
|
|
115
|
+
"stubs": [{
|
|
116
|
+
"responses": [
|
|
117
|
+
{ "is": { <strong class='highlight1'>"data": "aGVsbG8sIHdvcmxkIQ=="</strong> }}
|
|
118
|
+
],
|
|
119
|
+
"predicates": [{ "contains": { "data": "c2F5SGVsbG8=" } }]
|
|
120
|
+
}]
|
|
121
|
+
}'</code></pre>
|
|
122
|
+
</step>
|
|
123
|
+
|
|
124
|
+
<p>We'll use <code>nc</code> (netcat) to make the tcp request, which is like <code>telnet</code>
|
|
125
|
+
but easier to script.</p>
|
|
126
|
+
|
|
127
|
+
<step type='exec'>
|
|
128
|
+
<pre><code>echo "Calling sayHello over binary protocol" | nc localhost 5555</code></pre>
|
|
129
|
+
|
|
130
|
+
<assertResponse>
|
|
131
|
+
<pre><code><strong class='highlight1'>hello, world!</strong></code></pre>
|
|
132
|
+
</assertResponse>
|
|
133
|
+
</step>
|
|
134
|
+
|
|
135
|
+
<p>Finally, we can shut down both imposters by issuing an HTTP <code>DELETE</code> to
|
|
136
|
+
both imposters, which are identified by the port number on the URL:</p>
|
|
137
|
+
|
|
138
|
+
<step type='exec'>
|
|
139
|
+
<pre><code>curl -X DELETE http://localhost:<change to='<%= port %>'>2525</change>/imposters/4545
|
|
140
|
+
curl -X DELETE http://localhost:<change to='<%= port %>'>2525</change>/imposters/5555</code></pre>
|
|
141
|
+
</step>
|
|
142
|
+
</testScenario>
|
|
143
|
+
|
|
144
|
+
<p>Explore more in the links on the left. Don't hesitate to <a href='/support'>ask</a> for help!</p>
|
|
145
|
+
|
|
146
|
+
<%- include('../_footer') -%>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<%
|
|
2
|
+
title = 'mental model'
|
|
3
|
+
description = 'A mental model of how mountebank works'
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
<%- include('../_header') -%>
|
|
7
|
+
|
|
8
|
+
<h1>Mental model</h1>
|
|
9
|
+
|
|
10
|
+
<p><a href='https://www.manning.com/'>Manning Publishing</a> has been kind enough to help diagram
|
|
11
|
+
the following mental model, describing how mountebank works:</p>
|
|
12
|
+
|
|
13
|
+
<a href='https://www.manning.com/books/testing-microservices-with-mountebank?a_aid=mb&a_bid=ee3288f4'>
|
|
14
|
+
<img alt='mental model' src='https://freecontent.manning.com/wp-content/uploads/mentalmodel-testing-microservices-with-mountebank2.png'
|
|
15
|
+
style='width: 50em' />
|
|
16
|
+
</a>
|
|
17
|
+
|
|
18
|
+
<h2>Lexicon</h2>
|
|
19
|
+
|
|
20
|
+
<dl>
|
|
21
|
+
<dt>imposter</dt>
|
|
22
|
+
<dd>A server representing a test double. An <em>imposter</em> is identified by a port and
|
|
23
|
+
a protocol. mountebank is non-modal and can create as many <em>imposters</em> as your test requires.</dd>
|
|
24
|
+
|
|
25
|
+
<dt>stub</dt>
|
|
26
|
+
<dd>A set of configuration used to generate a response for an <em>imposter</em>. An <em>imposter</em>
|
|
27
|
+
can have 0 or more <em>stubs</em>, each of which are associated with different <em>predicates</em>.</dd>
|
|
28
|
+
|
|
29
|
+
<dt>predicate</dt>
|
|
30
|
+
<dd>A condition that determines whether a given <em>stub</em> is responsible for responding. Each
|
|
31
|
+
<em>stub</em> can have 0 or more <em>predicates</em>.</dd>
|
|
32
|
+
|
|
33
|
+
<dt>response</dt>
|
|
34
|
+
<dd>The configuration that generates the response for a <em>stub</em>. Each <em>stub</em> can have
|
|
35
|
+
0 or more <em>responses</em>.</dd>
|
|
36
|
+
|
|
37
|
+
<dt>response type</dt>
|
|
38
|
+
<dd>Defines the specific type of configuration used to generate a response. The simplest type is called
|
|
39
|
+
<em>is</em>, and allows you to define the <em>imposter's</em> response directly. mountebank also
|
|
40
|
+
supports a <em>proxy</em> response type, which allows record-replay behavior, and an <em>inject</em>
|
|
41
|
+
response type, which allows you to script mountebank responses. Each <em>response</em> has exactly
|
|
42
|
+
one <em>response type</em>.</dd>
|
|
43
|
+
|
|
44
|
+
<dt>stub behavior</dt>
|
|
45
|
+
<dd>Adds additional post-processing to a response, for example by adding latency to the
|
|
46
|
+
response or augmenting the response with more information. A <em>response</em> can have zero
|
|
47
|
+
or more <em>behaviors</em>, which represent a pipeline of such transformations.</dd>
|
|
48
|
+
|
|
49
|
+
</dl>
|
|
50
|
+
|
|
51
|
+
<%- include('../_footer') -%>
|