-
Notifications
You must be signed in to change notification settings - Fork 131
/
quickstart.html
197 lines (168 loc) · 6.8 KB
/
quickstart.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
---
layout: bootstrap
title: Quickstart Codeception
---
<div class="row">
<div class="hero hero--quickstart">
<div class="wide">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-sm-12 text-center">
<h1>
Quickstart
</h1>
</div>
</div>
</div>
</div>
</div>
<div class="wide">
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-lg-6 col-lg-offset-3">
<div class="panel panel-info quickstart-panel">
<div class="panel-heading">
<h4 class="panel-title">1.Install</h4>
<a href="/install">Alternative Installations »</a>
</div>
<div class="panel-body text-center">
<div class="">
Install via Composer
<div class="highlight">
<pre>composer require "codeception/codeception" --dev</pre>
</div>
<p>
</div>
<!-- <p>Use <code>codecept</code> instead of codecept.phar in this case.</p> -->
</div> <!-- /.panel-body -->
</div> <!-- /.panel -->
</div> <!-- /.col -->
</div>
<div class="row">
<div class="col-sm-12 col-md-6">
<div class="panel panel-info">
<div class="panel-heading"><h4 class="panel-title">2. Bootstrap</h4></div>
<div class="panel-body">
<p>Execute:</p>
<div class="highlight">
<p>
<pre>php vendor/bin/codecept bootstrap</pre>
</div>
<p class="text-muted">This creates the global configuration file
<b>codeception.yml</b>, the <b>tests/</b> directory, and the default test suites.
</p>
</div> <!-- /.panel-body -->
</div> <!-- /.panel -->
<div class="panel panel-info">
<div class="panel-heading"><h4 class="panel-title">3. Create Test</h4></div>
<div class="panel-body">
<p>Generate your first acceptance test. Acceptance tests emulate the behavior
of a real user visiting your site.<br><a href="/docs/AcceptanceTests" class="btn btn-secondary">Acceptance Testing Guide »</a></p>
<div class="highlight">
<p>
<pre>php vendor/bin/codecept generate:cest Acceptance First</pre>
</div>
</div> <!-- /.panel-body -->
</div> <!-- /.panel -->
<div class="panel panel-info">
<div class="panel-heading">
<h4 class="panel-title">4. Write a Basic Test</h4>
</div>
<div class="panel-body">
<p>It's now time to write your first test. Edit the file we've just created
<b>tests/Acceptance/FirstCest.php</b>
</p>
<div>
{% highlight php %}
<?php
class FirstCest
{
public function frontpageWorks(AcceptanceTester $I)
{
$I->amOnPage('/');
$I->see('Home');
}
}
{% endhighlight %}
</div>
<p class="text-muted">It will check if your frontpage contains the word <b>Home</b>.</p>
</div> <!-- /.panel-body -->
</div> <!-- /.panel -->
<div class="panel panel-info">
<div class="panel-heading"><h4 class="panel-title">5. Configure Acceptance Tests</h4></div>
<div class="panel-body">
<p>Please make sure your local
<b>development server</b> is running. Put application URL into:
<b>tests/Acceptance.suite.yml</b> </p>
<div class="highlight">
<pre>
actor: AcceptanceTester
modules:
enabled:
- PhpBrowser:
url: {YOUR APP'S URL}
</pre>
</div>
</div> <!-- /.panel-body -->
</div> <!-- /.panel -->
<div class="panel panel-info">
<div class="panel-heading"><h4 class="panel-title">6. Run!</h4></div>
<div class="panel-body">
<p>Tests are executed with 'run' command</p>
<div class="highlight">
<p>
<pre>php vendor/bin/codecept run --steps</pre>
</div>
<p class="text-muted">This will execute our test with
<a href="https://codeception.com/docs/modules/PhpBrowser">PhpBrowser</a>. It's PHP script that can check HTML page contents, click
links, fill forms, and submit POST and GET requests. For tests that require a real browser (e.g. JavaScript) use
the <a href="https://codeception.com/docs/modules/WebDriver">WebDriver</a> module.</p>
</div> <!-- /.panel-body -->
</div> <!-- /.panel -->
</div> <!-- /.row -->
<div class="col-sm-12 col-md-6">
<div class="page">
<h3>Setup for a Single Test Suite</h3>
<p>Instead of the <code>bootstrap</code> command, you can set up just a single test suite.</p>
<h4>Acceptance Testing (only)</h4>
<div class="highlight">
<pre>php vendor/bin/codecept init Acceptance</pre>
</div>
<a href="/docs/AcceptanceTests" class="btn btn-secondary">Acceptance Testing Guide »</a>
<hr>
<h4>REST API Testing (only)</h4>
<div class="highlight">
<pre>php vendor/bin/codecept init Api</pre>
</div>
<a href="/docs/APITesting" class="btn btn-secondary">REST API Testing Guide »</a>
<hr>
<h4>Unit Testing (only)</h4>
<div class="highlight">
<pre>php vendor/bin/codecept init Unit</pre>
</div>
<a href="/docs/UnitTests" class="btn btn-secondary">Unit Testing Guide »</a>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-6">
<div class="panel panel-success">
<img src="/images/codecept_run.gif" alt="codeception run">
</div>
</div>
<div class="col-sm-12 col-md-6">
<div class="page">
<h4>» Next!</h4>
<p>Read Codeception Guides to learn how to use it.</p>
<div class="list-group">
<a class="list-group-item active" href="/docs/02-GettingStarted">A Complete Getting Started Guide</a>
<a class="list-group-item" href="/docs/03-AcceptanceTests">Continue with Acceptance Tests</a>
<a class="list-group-item" href="/docs/01-Introduction">The difference between Acceptance Tests and
Unit Tests</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>