Skip to content

Commit ddf4f92

Browse files
Update Introduction.md
1 parent 48079b9 commit ddf4f92

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

docs/Introduction.md

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ Let's review those three test types in reverse order.
4040

4141
### Acceptance Tests
4242

43-
How does your client, manager, tester, or any other non-technical person know your website is working? By opening the browser, accessing the site, clicking on links, filling in the forms, and actually seeing the content on a web page. They have no idea of the programming language, framework, database, web-server,
44-
or why the application did (or did not) behave as expected.
43+
How does your client know your website is working? By opening the browser, accessing the site, clicking on links, filling in the forms, and actually seeing the content on a web page.
4544

4645
This is what acceptance tests are doing. They cover scenarios from a user's perspective.
4746
With acceptance tests, you can be confident that users, following all the defined scenarios, won't get errors.
@@ -51,13 +50,16 @@ With acceptance tests, you can be confident that users, following all the define
5150
#### Sample acceptance test
5251

5352
```php
54-
$I->amOnPage('/');
55-
$I->click('Sign Up');
56-
$I->submitForm('#signup', [
57-
'username' => 'MilesDavis',
58-
'email' => 'miles@davis.com'
59-
]);
60-
$I->see('Thank you for Signing Up!');
53+
public function trySignupForm(AcceptanceTester $I): void
54+
{
55+
$I->amOnPage('/');
56+
$I->click('Sign Up');
57+
$I->submitForm('#signup', [
58+
'username' => 'MilesDavis',
59+
'email' => 'miles@example.com'
60+
]);
61+
$I->see('Thank you for Signing Up!');
62+
}
6163
```
6264

6365
### Functional Tests
@@ -72,15 +74,21 @@ For functional tests, your application needs to be structured in order to run in
7274
#### Sample functional test
7375

7476
```php
75-
$I->amOnPage('/');
76-
$I->click('Sign Up');
77-
$I->submitForm('#signup', ['username' => 'MilesDavis', 'email' => 'miles@davis.com']);
78-
$I->see('Thank you for Signing Up!');
79-
$I->seeEmailIsSent('miles@davis.com', 'Thank you for your registration');
80-
$I->seeInDatabase('users', ['email' => 'miles@davis.com']);
77+
public function trySignupForm(FunctionalTester $I): void
78+
{
79+
$I->amOnPage('/');
80+
$I->click('Sign Up');
81+
$I->submitForm('#signup', [
82+
'username' => 'MilesDavis',
83+
'email' => 'miles@example.com'
84+
]);
85+
$I->see('Thank you for Signing Up!');
86+
$I->seeEmailIsSent('miles@example.com', 'Thank you for your registration');
87+
$I->seeInDatabase('users', ['email' => 'miles@example.com']);
88+
}
8189
```
8290

83-
> This looks very similar to acceptance tests. The behavior is the same, however, the test is executed inside PHP without launching a real browser.
91+
This looks very similar to acceptance tests. The behavior is the same, however, the test is executed in PHP without launching a real browser.
8492

8593
### Unit Tests
8694

@@ -96,19 +104,19 @@ Requirements and code can change rapidly,
96104
and unit tests should be updated every time to fit the requirements.
97105
The better you understand the testing scenario, the faster you can update it for new behavior.
98106

99-
#### Sample integration test
107+
#### Sample unit test
100108

101109
```php
102-
public function testSavingUser()
110+
public function testSavingUser(): void
103111
{
104112
$user = new User();
105-
$user->setName('Miles');
106-
$user->setSurname('Davis');
113+
$user->setFirstName('Miles');
114+
$user->setLastName('Davis');
107115
$user->save();
108-
$this->assertEquals('Miles Davis', $user->getFullName());
116+
$this->assertSame('Miles Davis', $user->getFullName());
109117
$this->tester->seeInDatabase('users', [
110-
'name' => 'Miles',
111-
'surname' => 'Davis'
118+
'firstName' => 'Miles',
119+
'lastName' => 'Davis'
112120
]);
113121
}
114122
```
@@ -119,6 +127,6 @@ The Codeception framework was developed to actually make testing fun.
119127
It allows writing unit, functional, integration, and acceptance tests in a single, coherent style.
120128

121129
All Codeception tests are written in a descriptive manner.
122-
Just by looking at the test body, you can clearly understand what is being tested and how it is performed.
130+
Just by looking at the test body, you can clearly understand what is being tested.
123131

124132
<div class="alert alert-warning"><a href="https://github.com/Codeception/codeception.github.com/edit/master/docs/Introduction.md"><strong>Improve</strong> this guide</a></div>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy