-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.html
362 lines (314 loc) · 9.13 KB
/
README.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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>README</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
/*
This document has been created with Marked.app <http://markedapp.com>, Copyright 2011 Brett Terpstra
Please leave this notice in place, along with any additional credits below.
---------------------------------------------------------------
Some simple Github-like styles, with syntax highlighting CSS via Pygments (requires custom processor).
via https://github.com/alampros/Docter
*/
html {
margin:0;
padding:1em;
}
body{
-webkit-font-smoothing: antialiased;
font: 13.34px helvetica,arial,freesans,clean,sans-serif;
line-height: 1.4em;
color: #333;
border: none;
line-height: 1.5;
margin: 0 auto;
max-width: 900px;
text-align:left;
color:black;
background:#fff;
}
@media screen {
#wrapper { padding:9px; background:#F8F8F8; border:1px solid #E9E9E9;}
body.inverted, .inverted #wrapper {
color: #eee;
background:#333;
border-color:#555
}
.inverted h2 {
border-color:#555
}
}
h1 {
font-size: 170%;
border-top: 4px solid #aaa;
padding-top: .5em;
margin-top: 1.5em;
}
h1:first-child {
margin-top: 0 !important;
padding-top: .25em !important;
border-top: none !important;
}
h2 {
font-size: 150%;
margin-top: 1.5em;
border-top: 4px solid #e0e0e0;
padding-top: .5em;
}
h3 {
margin-top: 1em;
}
br+br {
line-height:0;
height:0;
display:none;
}
p {
margin: 1em 0!important;
line-height: 1.5em!important;
}
pre, code {
font: 12px 'Bitstream Vera Sans Mono','Courier',monospace;
}
pre {
-webkit-box-shadow: rgba(0, 0, 0, 0.0664062) 0px 1px 2px 0px inset;
background-color: #EEE;
border: #ddd 1px solid;
color: #444;
display: block;
margin: 12px 0;
overflow: auto;
padding: 5px;
white-space: pre;
max-width:100%;
overflow:auto;
}
code {
background-color: ghostWhite;
color: #444!important;
padding: 0 .2em;
border: 1px solid #DEDEDE;
}
pre code {
padding: 0!important;
font-size: 12px!important;
background-color: #EEE!important;
border: none!important;
overflow:visible;
}
a, a code {
color: #4183C4;
text-decoration:none;
}
table td {
border-bottom: 1px solid #DDD!important;
padding: .2em 1em!important;
}
.shadow{
-webkit-box-shadow:0 5px 15px #000;
-moz-box-shadow:0 5px 15px #000;
box-shadow:0 5px 15px #000;
}
.c{color:#998;font-style:italic;}
.err{color:#a61717;background-color:#e3d2d2;}
.k{font-weight:bold;}
.o{font-weight:bold;}
.cm{color:#998;font-style:italic;}
.cp{color:#999;font-weight:bold;}
.c1{color:#998;font-style:italic;}
.cs{color:#999;font-weight:bold;font-style:italic;}
.gd{color:#000;background-color:#fdd;}
.gd .x{color:#000;background-color:#faa;}
.ge{font-style:italic;}
.gr{color:#a00;}
.gh{color:#999;}
.gi{color:#000;background-color:#dfd;}
.gi .x{color:#000;background-color:#afa;}
.go{color:#888;}
.gp{color:#555;}
.gs{font-weight:bold;}
.gu{color:#800080;font-weight:bold;}
.gt{color:#a00;}
.kc{font-weight:bold;}
.kd{font-weight:bold;}
.kn{font-weight:bold;}
.kp{font-weight:bold;}
.kr{font-weight:bold;}
.kt{color:#458;font-weight:bold;}
.m{color:#099;}
.s{color:#d14;}
.na{color:#008080;}
.nb{color:#0086B3;}
.nc{color:#458;font-weight:bold;}
.no{color:#008080;}
.ni{color:#800080;}
.ne{color:#900;font-weight:bold;}
.nf{color:#900;font-weight:bold;}
.nn{color:#555;}
.nt{color:#000080;}
.nv{color:#008080;}
.ow{font-weight:bold;}
.w{color:#bbb;}
.mf{color:#099;}
.mh{color:#099;}
.mi{color:#099;}
.mo{color:#099;}
.sb{color:#d14;}
.sc{color:#d14;}
.sd{color:#d14;}
.s2{color:#d14;}
.se{color:#d14;}
.sh{color:#d14;}
.si{color:#d14;}
.sx{color:#d14;}
.sr{color:#009926;}
.s1{color:#d14;}
.ss{color:#990073;}
.bp{color:#999;}
.vc{color:#008080;}
.vg{color:#008080;}
.vi{color:#008080;}
.il{color:#099;}
.poetry pre {
font-family:Georgia, Garamond, serif !important;
font-style:italic;
font-size:110% !important;
line-height:1.6em;
display:block;
margin-left:1em;
}
.poetry pre code {
font-family:Georgia, Garamond, serif !important;
}
sup,sub,a.footnote {
font-size: 1.4ex;
height: 0;
line-height: 1;
vertical-align: super;
position: relative;
}
@media print {
body {
background:#fff;
}
#wrapper {
background: #fff;
border:none;
}
code {
background-color: #fff;
color: #444!important;
padding: 0 .2em;
border: 1px solid #DEDEDE;
}
pre code {
padding: 0!important;
font-size: 12px!important;
background-color: #fff!important;
border: none!important;
overflow:visible;
}
pre {
background: #fff;
white-space: pre-wrap;
white-space: pre-line;
}
}
</style>
</head>
<body class="normal">
<div id="wrapper">
<h1 id="readme">README</h1>
<p>Clone this repo:</p>
<pre><code>git clone git://github.com/Weltraumschaf/cacert-frontendtests.git
</code></pre>
<h2 id="nextstepstogetstarted">Next steps to get started</h2>
<ol>
<li><p>Install <a href="http://maven.apache.org/">Apache Maven</a></p>
<ul>
<li><p>Debian Linux:</p>
<p>$ sudo apt-get install maven2</p></li>
<li><p>Windows: [TBD]</p></li>
<li><p>Mac OS X: Maven is already installed.</p></li>
</ul></li>
<li><p>Install <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Sun Java JRE and JDK</a></p>
<ul>
<li><p>Debian Linux:</p>
<p>$ sudo apt-get install sun-java6-jre sun-java6-jdk</p></li>
<li><p>Windows: [TBD]</p></li>
<li><p>Mac OS X: Maven is already installed.</p></li>
</ul></li>
<li><p>Build the project (Make sure, you’re in the project root directory,
where the <kbd>pom.xml</kbd> file is located)</p>
<pre><code>$ mvn test
</code></pre></li>
</ol>
<p>Maven will download all needed dependencies declared in the <kbd>pom.xml</kbd> file,
build the project and execute all present unittests. If all went okay
maven will terminate with the message</p>
<pre><code>[INFO] BUILD SUCCESSFUL
</code></pre>
<p>and some runtime statistics.</p>
<h3 id="projectsetupinyouride">Project Setup in your IDE</h3>
<h4 id="netbeans">Netbeans</h4>
<p>Recommended IDE for developing frontend tests is <a href="http://www.netbeans.org">NetBeans</a> because
you just need to open the <kbd>pom.xml</kbd> and nothing else. With Eclipse
the use of Maven is a bit more hassle. For getting the JavaDoc and
sources of the dependeny open the project explorer in Netbeans and right
click on the folder <em>Dependencies</em> and just clock the apropriate menue
items.</p>
<h4 id="eclispe">Eclispe</h4>
<p>[TBD]</p>
<h2 id="howtowriteatest">How to write a test</h2>
<p>In the project view (in Netbeans) you will see the directoy ‘Source Packages’
and ‘Test Packages’. In the first one you will only find helper classes
(e.g. for loading personas, create fixtures etc.). In the latter one you will
find the the unit test classes (either for the helper classes or the frontent
tests). As unit test framework <a href="http://www.junit.org/">JUnit</a> is used. The frontent tests
itself are contained in the package <kbd>org.cacert.frontendtests</kbd>.
In this package you will add your tests. If you’re not familiar with packages in
Java read <a href="http://en.wikipedia.org/wiki/Java_package">this</a>.</p>
<p>Writing a test with JUnit follows nearly the same rules as in <a href="https://github.com/sebastianbergmann/phpunit/">PHPUnit</a>
(because PHPUnit is a JUnit clone). You also need to extend a base class. But you
will not extend the JUnits default <kbd>TestCase</kbd> but <kbd>AbstractTestCase</kbd>
from the package <kbd>org.cacert.frontendtests</kbd>. This class provides helper
methods for creating <a href="http://seleniumhq.org/docs/03_webdriver.html">Webdriver</a> instances, personas, fixtures or logged
in sessions.</p>
<h3 id="somejavahints:">Some Java hints:</h3>
<ul>
<li>Attend the <kbd>@Override</kbd> annotation, if you overwrite a method.
If you ommit this a compiler warning will be thrown.</li>
<li>No <kbd>function</kbd> keyword is needed for a method declaration, but
a return type is required.</li>
<li>You can ommit <kbd>this</kbd> inside your scope, but keep in mind that
local variables will shadow class fields.</li>
<li>Strings are double quoted <kbd>“string”</kbd>, single quotes are characters <kbd>‘c’</kbd>!</li>
<li>Annotations are something similar to interfaces and so need to be imported.</li>
</ul>
<p>An example for a test:</p>
<pre><code>package org.cacert.frontendtests;
import org.junit.Ignore;
// You do not need to import AbstractTestCase because
// you are in the same package!
public class MyFirstTest extends AbstractTestCase {
@Override
protected void setUp() {
// setup stuff
}
@Override
protected void tearDown() {
// teardown stuff
}
@Ignore("Not ready yet")
public void testSomething() {
// your test code goes here
}
}
</code></pre>
<p>Some nice examples about annotations just found <a href="http://www.frankwestphal.de/JUnit4.0.html">here</a>.</p>
</div>
</body>
</html>