-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
314 lines (314 loc) · 16.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Teacup - Testing Framework</title>
</head>
<body>
<h1>Teacup - Testing Framework for Communication Protocols and Web Services</h1>
<p>Teacup makes it possible to test communication protocols. The core project is not dependent on any engine,
protocol or reporter, making the framework flexible and powerful.</p>
<p>The idea is that it should be easy to add/change/remove engines, protocols and reporters without changing
any of the API's.</p>
<ol>
<li>Create your test project</li>
<li>Choose engine(s)</li>
<li>Choose protocol(s)</li>
<li>Choose reporter(s)</li>
</ol>
<img alt="framework" src="img/framework.png"><br>
<ul>
<li><a href="#core" title="Core">Core</a></li>
<li>
<a href="#engine" title="engine">Engine</a>
<ul>
<li><a href="#engine-junit" title="Engine JUnit">JUnit</a></li>
</ul>
</li>
<li>
<a href="#protocol" title="protocol">Protocol</a>
<ul>
<li><a href="#protocol-http" title="Protocol HTTP">FTP/FTPS</a></li>
</ul>
<ul>
<li><a href="#protocol-http" title="Protocol HTTP">HTTP/HTTPS</a></li>
</ul>
<ul>
<li><a href="#protocol-http" title="Protocol HTTP">Telnet</a></li>
</ul>
</li>
<li>
<a href="#report" title="report">Report</a>
<ul>
<li><a href="#report-file" title="Report file">File</a></li>
</ul>
<ul>
<li><a href="#report-mysql" title="Report MySQL">MySQL</a></li>
</ul>
</li>
<li>
<a href="#visualization" title="Visualization">Visualization</a>
<ul>
<li>
<a href="#visualization-back" title="Visualization back">Back-end</a>
</li>
</ul>
<ul>
<li><a href="#visualization-front" title="Visualization front">Front-end</a></li>
</ul>
</li>
<li>
<a href="#service" title="service">Service</a>
<ul>
<li><a href="#service-report-mysql" title="Service report MySQL">Report MySQL</a></li>
<li><a href="#service-visualization-mysql"
title="Service visualization MySQL">Visualization MySQL</a></li>
</ul>
</li>
<li><a href="#example" title="Example">Example</a></li>
</ul>
<h1 id="core">Core</h1>
<h3>What</h3>
<p>The core project has three main responsibilities and does not rely on any special test engine or protocol:
</p>
<h4>Assertions</h4>
<p>A big library with all the base assertions such as arrays, lists and primitives.</p>
<h4>Interfaces</h4>
<p>Interfaces such as Node, Result and Reporter.</p>
<h4>Setup</h4>
<p>Support for fixtures and other setup-related functionality.</p>
<h3>Why</h3>
<p>The framework does not rely on any specific test engine or protocol.<br>
It is built to be able to be easy to use, extend and maintain.</p>
<h3>How</h3>
<p>This is possible due to highly use of interfaces and almost none of the implementation classes are exposed
to the public.</p>
<p>The core project does not know anything about the test engine or protocols implemented, which makes the
project very isolated.</p>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-core" title="core">here</a>:</p>
<h1 id="engine">Engine</h1>
<h3>What</h3>
<p>Parent project for all engine implementations.<br>
This project contains engine specific interfaces and base classes.</p>
<h3>Why</h3>
<p>It should be easy to add support for a new engines.</p>
<h3>How</h3>
<p>By extracting repeated code as much as possible.</p>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-engine" title="engine">
here</a>:</p>
<h2 id="engine-junit">JUnit</h2>
<h3>What</h3>
<p>Custom JUnit 5 engine.<br>
This engine interacts with the Teacup core project to get fixture data, such as the current fixture and
added clients/servers.</p>
<h3>Why</h3>
<p>It can be time and resource consuming to use fixtures.<br>
Therefore this engine will change the order of the tests before executing them so that the minimal fixture
changes are required.</p>
<h3>How</h3>
<p>This is done by extending the Jupiter engine.<br><br>
To use the Teacup engine, do as follows:<br></p>
<ol>
<li>Create a file named org.junit.platform.engine.TestEngine in src/main/resources/META-INF/services</li>
<li>Add the content org.teacup.engine.junit.TeacupTestEngine</li>
<li>Add the engine to the build file, this is different depending on the build tool you are using.<br>
The best thing is to check this
<a href="https://junit.org/junit5/docs/current/user-guide/#running-tests-build" title="guide">
guide</a>:</li>
<li>Write your tests as you would normally do with JUnit.</li>
</ol>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-engine-junit" title="junit">
here</a>:</p>
<h1 id="protocol">Protocol</h1>
<h3>What</h3>
<p>Parent project for all protocol implementations.<br>
This project contains protocol specific interfaces and base classes.</p>
<h3>Why</h3>
<p>It should be easy to add support for a new protocols.</p>
<h3>How</h3>
<p>By extracting repeated code as much as possible.</p>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-protocol"
title="http">here</a>:</p>
<h2 id="protocol-ftp">FTP/FTPS</h2>
<h3>What</h3>
<p>FTP/FTPS support.<br><br>There is also support for an FTP server.</p>
<h3>Why</h3>
<p>This makes it possible to test FTP with the framework, both the client and the server.</p>
<h3>How</h3>
<p>Add this repository as a dependency.<br><br>
The Client interface holds all the functionality that the FTP client can do.<br>
The SecureClient interface holds all the functionality that the secure FTP client can do.<br>
New clients can be created with the Factory class in the client package.<br><br>
The SimpleServer interface holds all the functionality that the FTP server can do.<br>
New servers can be created with the Factory class in the server package.</p>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-protocol-ftp"
title="ftp">here</a>:</p>
<h2 id="protocol-http">HTTP/HTTPS</h2>
<h3>What</h3>
<p>HTTP version 1.1 and 2 support.<br><br>
The framework supports asynchronously and synchronously requests.<br><br>
There is also support for an HTTP/HTTPS server.</p>
<h3>Why</h3>
<p>This makes it possible to test HTTP with the framework, both the client and the server.</p>
<h3>How</h3>
<p>Add this repository as a dependency.<br><br>
The Simple interface holds all the functionality that the HTTP client can do.<br>
New clients can be created with the Factory class in the client package.<br><br>
The Simple interface holds all the functionality that the HTTP server can do.<br>
New servers can be created with the Factory class in the server package.</p>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-protocol-http"
title="http">here</a>:</p>
<h2 id="protocol-telnet">Telnet</h2>
<h3>What</h3>
<p>Telnet support.<br><br>There is also support for an Telnet server.</p>
<h3>Why</h3>
<p>This makes it possible to test Telnet with the framework, both the client and the server.</p>
<h3>How</h3>
<p>Add this repository as a dependency.<br><br>
The Client interface holds all the functionality that the Telnet client can do.<br>
New clients can be created with the Factory class in the client package.<br><br>
The Simple interface holds all the functionality that the Telnet server can do.<br>
New servers can be created with the Factory class in the server package.</p>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-protocol-telnet"
title="telnet">here</a>:</p>
<h1 id="report">Report</h1>
<h2 id="report-file">File</h2>
<h3>What</h3>
<p>This project makes it possible to save logs on disc rather than just publish on the screen.</p>
<h3>Why</h3>
<p>Save the logs on disc so that they are not deleted after each test execution, no matter what test engine
you are using.</p>
<h3>How</h3>
<p>Follow the steps below:</p>
<ol>
<li>Add this repository as a dependency</li>
<li>Create a file named teacup.properties in a folder named .teacup in your home folder</li>
<li>Add reporter=io.githb.henryssondaniel.teacup.report.file.DefaultReporter to the file</li>
</ol>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-report-file"
title="file">here</a>:</p>
<h2 id="report-mysql">MySQL</h2>
<h3>What</h3>
<p>This project makes it possible to save logs in a MySQL database rather than just publish on the screen.</p>
<h3>Why</h3>
<p>Save the logs to a MySQL database so that they are not deleted after each test execution, no matter what
test engine you are using.</p>
<h3>How</h3>
<p>Follow the steps below:</p>
<ol>
<li>Add this repository as a dependency</li>
<li>Create a file named teacup.properties in a folder named .teacup in your home folder</li>
<li>Add reporter=io.githb.henryssondaniel.teacup.report.mysql.DefaultReporter to the file</li>
<li>Also add
<ol>
<li>reporter.mysql.password=[password]</li>
<li>reporter.mysql.server.name=[name]</li>
<li>reporter.mysql.user=[user]</li>
</ol>
</li>
</ol>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-report-mysql"
title="mysql">here</a>:</p>
<h1 id="visualization">Visualization</h1>
<h2 id="visualization-back">Back-end</h2>
<h3>What</h3>
<p>Visualization web back-end. Choose between an implementation in either Java or Python.</p>
<h4>Why</h4>
<p>This project is needed so that the web front-end can interact with the server side and other Teacup
projects.</p>
<h3>How</h3>
<p>Follow this <a href="http://flask.pocoo.org/docs/1.0/tutorial/deploy/" title="flask">guide</a> to deploy to
production.</p>
<h3>Where</h3>
<p>The Java project is found <a href="https://github.com/HenryssonDaniel/teacup-visualization-web-back-java"
title="back">here</a>:</p>
<p>The Python project is found <a href="https://github.com/HenryssonDaniel/teacup-visualization-web-back-python"
title="back">here</a>:</p>
<h2 id="visualization-front">Front-end</h2>
<h3>What</h3>
<p>Web front-end.</p>
<h4>Why</h4>
<p>To visualize the content from the reporters on a web page.</p>
<h3>How</h3>
<p>Deploy the application on your web server.</p>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-visualization-web-front"
title="front">here</a>:</p>
<h1 id="service">Service</h1>
<h2 id="service-report-mysql">Report MySQL</h2>
<h3>What</h3>
<p>This project makes it possible to interact with a MySQL database to be used in the report projects.</p>
<h3>Why</h3>
<p>The report back-end does and should not know anything about where the data comes from. This makes it easy to
switch from one database to another.</p>
<h3>How</h3>
<p>Follow the steps below:</p>
<ul>
<li>Deploy the war file on your server</li>
</ul>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-service-report-mysql-java"
title="mysql">here</a>:</p>
<h2 id="service-visualization-mysql">Visualization MySQL</h2>
<h3>What</h3>
<p>This project makes it possible to interact with a MySQL database to be used in the visualization
projects.</p>
<h3>Why</h3>
<p>The visualization back-end does and should not know anything about where the data comes from. This makes it
easy to switch from one database to another.</p>
<h3>How</h3>
<p>Follow the steps below:</p>
<ul>
<li>Deploy the war file on your server</li>
</ul>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-service-visualization-mysql-java"
title="mysql">here</a>:</p>
<h1 id="example">Example</h1>
<h3>What</h3>
<p>Examples using the JUnit test engine.</p>
<h3>Why</h3>
<p>It can be used as a reference to set up and write your first test case.</p>
<h3>How</h3>
<h4>Add the dependencies</h4>
<p>It has three dependencies:</p>
<ul>
<li>Core (io.github.henryssondaniel.teacup:core)</li>
<li>JUnit test engine (io.github.henryssondaniel.teacup.engine:junit)</li>
<li>HTTP protocol (io.github.henryssondaniel.teacup.protocol:http)</li>
</ul>
<h4>Add the test engine</h4>
<ul>
<li>Create a file named io.github.henryssondaniel.junit.platform.engine.TestEngine in
src/main/resources/META-INF/services</li>
<li>Add the content io.github.henryssondaniel.teacup.engine.junit.TeacupTestEngine</li>
<li>Add the engine to the build file, this is different depending on the build tool you are using.</li>
<li>The best thing is to check: https://junit.org/junit5/docs/current/user-guide/#running-tests-build</li>
</ul>
<h4>Write your test (pseudocode)</h4>
<p>Writing your test can be divided into three steps:</p>
<ul>
<li>response = client.send(request) // send the request</li>
<li>node = responseBuilder.setStatusCode(statusCode).setVersion(version).build() // define the
assertions</li>
<li>node.verify(response) // verify</li>
</ul>
<p>All assertions can be chained and all setters take an assertion rather than a value.<br>
This means that statusCode and version represents assertions as well. The code could look similar to this:
<br>statusCode = integerBuilder.isLessThan(300).isGreaterThanOrEqualTo(200).build()<br>
version = versionBuilder.isSameAs(Version.2).build()
</p>
<h3>Where</h3>
<p>The project is found <a href="https://github.com/HenryssonDaniel/teacup-java-example-junit"
title="example">here</a>:</p>
</body>
</html>