forked from Codeception/codeception.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickstart.html
More file actions
154 lines (152 loc) · 5.73 KB
/
quickstart.html
File metadata and controls
154 lines (152 loc) · 5.73 KB
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
---
layout: bootstrap
title: Quick Start Codeception
---
<div class="page-header">
<h1>Codeception Quickstart Guide</h1>
</div>
<p class="lead">Codeception PHP Testing Framework is designed to work just out of the box.
This means its installation requires minimal steps and no external dependencies
preinstalled (except PHP, of course). Only one configuration step should
be taken and you are ready to test your web application from an eye of
actual user. </p>
<div class="row">
<div class="span4">
<div class="well">
<span class="badge badge-warning pull-right">Step 1</span>
<h4>1. Download</h4>
<p>Download and save the
<b>phar</b>archive to the root of your web application. </p>
<a class="btn btn-large btn-success"
href="/thanks"><span class="btn-label">Download Codeception</span></a>
<p class="muted">alternatively download it from console</p>
<div>
<p>
<code>wget http://codeception.com/codecept.phar</code>
</p>
</div>
</div>
</div>
<div class="span4">
<div class="well">
<span class="badge badge-warning pull-right">Step 2</span>
<h4>2. Install</h4>
<p>Open console directory where you saved codecept.phar file and execute:</p>
<div>
<p>
<code>php codecept.phar bootstrap</code>
</p>
</div>
<p class="muted">This creates
<b>codeception.yml</b> file and
<b>tests</b> directory.</p>
</div>
</div>
<div class="span4">
<div class="well">
<span class="badge badge-warning pull-right">Step 3</span>
<h4>3. Create Test</h4>
<p>Generate your first acceptance test. Acceptance tests emulate behavior
of a real user visiting your site.</p>
<div>
<p>
<code>php codecept.phar generate:cept acceptance Welcome</code>
</p>
</div>
<p class="muted">Codeception scenario tests are called Cepts.</p>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="span4">
<div class="well">
<span class="badge badge-warning pull-right">Step 4</span>
<h4>4. Write Basic Test</h4>
<p>It's now time to write your first test. Edit the file we've just created
<b>tests/acceptance/WelcomeCept.php</b>
</p>
<div>
<p></p>
<pre>
$I = new WebGuy($scenario);
$I->wantTo('ensure that frontpage works');
$I->amOnPage('/');
$I->see('Home');</pre>
<p></p>
</div>
<p class="muted">It will check that your frontpage contains the word
<b>Home</b> in it.</p>
</div>
</div>
<div class="span4">
<div class="well">
<span class="badge badge-warning pull-right">Step 5</span>
<h4>5. Configure Acceptance Tests</h4>
<p>Please make sure your local
<b>dev server</b>is running. Put application URL into:
<b>tests/acceptance.suite.yml</b> </p>
<div>
<pre>
class_name: WebGuy
modules:
enabled: [PhpBrowser, WebHelper]
config:
PhpBrowser:
url: '<b>{YOUR APP'S URL}</b>'
</pre>
</div>
</div>
</div>
<div class="span4">
<div class="well">
<span class="badge badge-warning pull-right">Final Step</span>
<h4>6. Run!</h4>
<p>Codeception are executed with 'run' command</p>
<div>
<p>
<code>php codecept.phar run</code>
</p>
</div>
<p class="muted">This will execute our Welcome test with
<b>PhpBrowser</b>. It's PHP script that can check HTML page contents, click
links, fill forms, and submit POST and GET requests. For more complex tests
that require a browser use Selenium with
<b>Selenium2</b> module.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span6">
<p>If you did everything right and your app has "Home" text on frontpage you
will see this in output</p>
<div>
<pre>
Suite acceptance started
Trying to <b>ensure that frontpage works</b> (WelcomeCept.php) - Ok
Suite functional started
Suite unit started
Time: 1 second, Memory: 21.00Mb
<b>OK (1 test, 1 assertions)</b>
</pre>
</div>
</div>
<div class="span6">
<a class="btn btn-large btn-info pull-right" href="/docs/04-AcceptanceTests"><span class="btn-label">Proceed Testing →</span></a>
<p class=" lead">Follow the Acceptance Testing chapter to learn how to test your
web application by clicking links, filling forms, as your regular users
do.</p>
<h4>Also to Read</h4>
<div>
<br>
</div>
<div>
<ul>
<li><a href="/install">Alternative Installations (PEAR, Composer)</a></li>
<li><a href="/docs/02-GettingStarted">A Complete Getting Started Guide</a></li>
<li><a href="/docs/01-Introduction">The difference between Acceptance Tests and Unit Tests</a></li>
</ul>
</div>
</div>
</div>