You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2022-07-28-codeception-5.markdown
+52-2Lines changed: 52 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ tests/
26
26
Unit/
27
27
```
28
28
29
-
All suite names will have their own namespace, as well as actor and helper classes:
29
+
All suite names have their own namespace, as well as actor and helper classes:
30
30
31
31
```php
32
32
<?php
@@ -44,7 +44,53 @@ class LoginCest
44
44
}
45
45
```
46
46
47
-
This new directory structure will be generated by running `codecept bootstrap`. The directory structure is set with a new default config, so the previous directory structure is still valid.
47
+
This new directory structure will be generated by running `codecept bootstrap`.
48
+
49
+
### Upgrading from Codeception 4
50
+
51
+
Codeception 5 is compatible with the Codeception 4 directory structure. So if you don't want to change your file locations now, just keep your existing `codeception.yml`, and everything's fine.
52
+
53
+
However, if you want to upgrade to the new Codeception 5 directory structure (recommended), here's the new default `codeception.yml`:
54
+
55
+
```yaml
56
+
namespace: Tests
57
+
support_namespace: Support
58
+
paths:
59
+
tests: tests
60
+
output: tests/_output
61
+
data: tests/Support/Data
62
+
support: tests/Support
63
+
envs: tests/_envs
64
+
actor_suffix: Tester
65
+
extensions:
66
+
enabled:
67
+
- Codeception\Extension\RunFailed
68
+
```
69
+
70
+
Next steps:
71
+
72
+
1. Rename your suite configuration files:
73
+
`acceptance.suite.yml` => `Acceptance.suite.yml`
74
+
`functional.suite.yml`=> `Functional.suite.yml`
75
+
`unit.suite.yml`=> `Unit.suite.yml`
76
+
2. Inside those configuration files, update to the new namespace:
77
+
```yaml
78
+
modules:
79
+
enabled:
80
+
- Tests\Support\Helper\Unit
81
+
```
82
+
3. In your `composer.json`, update to the new namespace:
83
+
```json
84
+
"autoload-dev": {
85
+
"psr-4": {
86
+
"Tests\\": "tests/"
87
+
}
88
+
},
89
+
```
90
+
4. In your `tests/Support/Acceptance|Functional|UnitTester.php` files, update to the new namespace.
91
+
5. Run `vendor/bin/codecept build` to create the files in `tests/Support/_generated`.
92
+
6. Modify the namespaces in all your test/cest files.
93
+
7. Run the tests with capitalized suite names: `vendor/bin/codecept run Unit`
48
94
49
95
## Attributes
50
96
@@ -103,6 +149,10 @@ Also new functions were added:
103
149
* `codecept_pause()` - starts interactive pause anywhere in debug mode
104
150
* `codecept_debug()` - prints a variable to console using Symfony VarDumper
105
151
152
+
### Upgrading from Codeception 4
153
+
154
+
Just remove `hoa/console` from your `composer.json`.
155
+
106
156
## Sharding
107
157
108
158
The [Parallel Execution guide](/docs/ParallelExecution) has been rewritten and focused on a new feature: sharding. It is the simplest way to run slow tests (think of acceptance tests first) in parallel on multiple agents.
0 commit comments