Skip to content

Commit 3c79533

Browse files
committed
auto updated documentation
1 parent d6fd91e commit 3c79533

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1450
-2899
lines changed

docs/01-Introduction.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ Please, note that **any web site** can be covered with acceptance tests. Even if
2727

2828
#### Sample acceptance test
2929

30-
{% highlight php %}
31-
30+
```php
3231
<?php
3332
$I = new AcceptanceTester($scenario);
3433
$I->amOnPage('/');
3534
$I->click('Sign Up');
3635
$I->submitForm('#signup', array('username' => 'MilesDavis', 'email' => '[email protected]'));
3736
$I->see('Thank you for Signing Up!');
3837
?>
39-
40-
{% endhighlight %}
38+
```
4139

4240
#### Pros
4341

@@ -63,8 +61,7 @@ For functional tests your application should be prepared to be run in a test env
6361

6462
#### Sample functional test
6563

66-
{% highlight php %}
67-
64+
```php
6865
<?php
6966
$I = new FunctionalTester($scenario);
7067
$I->amOnPage('/');
@@ -74,8 +71,7 @@ $I->see('Thank you for Signing Up!');
7471
$I->seeEmailSent('[email protected]', 'Thank you for registration');
7572
$I->seeInDatabase('users', array('email' => '[email protected]'));
7673
?>
77-
78-
{% endhighlight %}
74+
```
7975

8076
#### Pros
8177

@@ -100,8 +96,7 @@ But Codeception provides some good tools to make your unit tests simpler and cle
10096

10197
#### Sample integration test
10298

103-
{% highlight php %}
104-
99+
```php
105100
<?php
106101
function testSavingUser()
107102
{
@@ -113,8 +108,7 @@ function testSavingUser()
113108
$this->unitTester->seeInDatabase('users',array('name' => 'Miles', 'surname' => 'Davis'));
114109
}
115110
?>
116-
117-
{% endhighlight %}
111+
```
118112

119113
#### Pros
120114

docs/02-GettingStarted.md

Lines changed: 32 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ Actor classes are not written but generated from suite configuration. When you c
1717

1818
If Actor classes are not created or updated as you expect, try to generate them manually with `build` command:
1919

20-
{% highlight bash %}
21-
20+
```bash
2221
$ php codecept.phar build
23-
24-
{% endhighlight %}
22+
```
2523

2624

2725
## Writing a Sample Scenario
@@ -32,26 +30,21 @@ Let's say, we created a file `tests/acceptance/SigninCept.php`
3230

3331
We can do that by running command:
3432

35-
{% highlight bash %}
36-
33+
```bash
3734
$ php codecept.phar generate:cept acceptance Signin
35+
```
3836

39-
{% endhighlight %}
40-
41-
{% highlight php %}
42-
37+
```php
4338
<?php
4439
$I = new AcceptanceTester($scenario);
4540
?>
46-
47-
{% endhighlight %}
41+
```
4842

4943
A Scenario always starts with Actor class initialization. After that, writing a scenario is just like typing `$I->` and choosing a proper action from the auto-completion list.
5044

5145
Let's sign in to our site. We assume that we have a 'login' page where we are getting authenticated by login and password. Then we are moved to a user page, where we see the text `Hello, %username%`. Let's look at how this scenario is written in Codeception.
5246

53-
{% highlight php %}
54-
47+
```php
5548
<?php
5649
$I = new AcceptanceTester($scenario);
5750
$I->wantTo('log in as regular user');
@@ -61,31 +54,25 @@ $I->fillField('Password','qwerty');
6154
$I->click('Login');
6255
$I->see('Hello, davert');
6356
?>
64-
65-
{% endhighlight %}
57+
```
6658

6759
Before we execute this test, we should make sure that the site is running on a local web server. Let's open the `tests/acceptance.suite.yml` file and replace the URL with the URL of your web application:
6860

69-
{% highlight yaml %}
70-
61+
``` yaml
7162
config:
7263
PhpBrowser:
7364
url: 'http://myappurl.local'
74-
75-
{% endhighlight %}
65+
```
7666
7767
After we configured URL we can run this test with `run` command:
7868

79-
{% highlight bash %}
80-
69+
``` bash
8170
$ php codecept.phar run
82-
83-
{% endhighlight %}
71+
```
8472

8573
Here is the output we should see:
8674

87-
{% highlight bash %}
88-
75+
``` bash
8976
Acceptance Tests (1) -------------------------------
9077
Trying log in as regular user (SigninCept.php) Ok
9178
----------------------------------------------------
@@ -99,21 +86,17 @@ Unit Tests (0) -------------------------------------
9986
Time: 1 second, Memory: 21.00Mb
10087
10188
OK (1 test, 1 assertions)
102-
103-
{% endhighlight %}
89+
```
10490

10591
Let's get a detailed output:
10692

107-
{% highlight bash %}
108-
93+
```bash
10994
$ php codecept.phar run acceptance --steps
110-
111-
{% endhighlight %}
95+
```
11296

11397
We should see a step-by-step report on the performed actions.
11498

115-
{% highlight bash %}
116-
99+
```bash
117100
Acceptance Tests (1) -------------------------------
118101
Trying to log in as regular user (SigninCept.php)
119102
Scenario:
@@ -128,8 +111,7 @@ Scenario:
128111
Time: 0 seconds, Memory: 21.00Mb
129112
130113
OK (1 test, 1 assertions)
131-
132-
{% endhighlight %}
114+
```
133115

134116
That was a very simple test that you can reproduce for your own site.
135117
By emulating the user's actions you can test all of your site the same way.
@@ -157,43 +139,33 @@ Codeception has a global configuration in `codeception.yml` and a config for eac
157139

158140
Tests can be started with the `run` command.
159141

160-
{% highlight bash %}
161-
142+
```bash
162143
$ php codecept.phar run
163-
164-
{% endhighlight %}
144+
```
165145

166146
With the first argument you can run tests from one suite.
167147

168-
{% highlight bash %}
169-
148+
```bash
170149
$ php codecept.phar run acceptance
171-
172-
{% endhighlight %}
150+
```
173151

174152
To run exactly one test, add a second argument. Provide a local path to the test, from the suite directory.
175153

176-
{% highlight bash %}
177-
154+
```bash
178155
$ php codecept.phar run acceptance SigninCept.php
179-
180-
{% endhighlight %}
156+
```
181157

182158
Alternatively you can provide full path to test file:
183159

184-
{% highlight bash %}
185-
160+
```bash
186161
$ php codecept.phar run tests/acceptance/SigninCept.php
187-
188-
{% endhighlight %}
162+
```
189163

190164
You can provide a directory path as well:
191165

192-
{% highlight bash %}
193-
166+
```bash
194167
$ php codecept.phar run tests/acceptance/backend
195-
196-
{% endhighlight %}
168+
```
197169

198170
Which will execute all tests from backend dir.
199171

@@ -203,21 +175,17 @@ To execute a group of tests that are not stored in the same dir you can organize
203175

204176
To generate JUnit XML output you can provide `--xml` option, and `--html` for HTML report.
205177

206-
{% highlight bash %}
207-
178+
```bash
208179
$ php codecept.phar run --steps --xml --html
209-
210-
{% endhighlight %}
180+
```
211181

212182
This command will run all tests for all suites, displaying the steps, and building HTML and XML reports. Reports will be store in `tests/_output/` directory.
213183

214184
And to learn all available options:
215185

216-
{% highlight bash %}
217-
186+
```bash
218187
$ php codecept.phar help run
219-
220-
{% endhighlight %}
188+
```
221189

222190
## Debugging
223191

0 commit comments

Comments
 (0)