@testomatio/reporter 0.6.10 → 0.7.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +5 -0
- package/README.md +16 -7
- package/lib/adapter/codecept.js +1 -1
- package/lib/adapter/cucumber/current.js +185 -0
- package/lib/adapter/cucumber/legacy.js +136 -0
- package/lib/adapter/cucumber.js +15 -135
- package/lib/adapter/cypress-plugin/index.js +4 -1
- package/lib/adapter/mocha.js +1 -0
- package/lib/adapter/webdriver.js +1 -0
- package/lib/junit-adapter/csharp.js +18 -0
- package/lib/xmlReader.js +71 -3
- package/package.json +12 -9
- package/testcafe/package-lock.json +863 -0
- package/testcafe/package.json +1 -1
- package/.eslintrc.js +0 -35
- package/.github/workflows/node.js.yml +0 -30
- package/.prettierrc.js +0 -12
- package/example/codecept/codecept.conf.js +0 -29
- package/example/codecept/index_test.js +0 -10
- package/example/codecept/jsconfig.json +0 -5
- package/example/codecept/sample_test.js +0 -6
- package/example/codecept/steps.d.ts +0 -16
- package/example/codecept/steps_file.js +0 -10
- package/example/core/index.js +0 -15
- package/example/jest/index.test.js +0 -9
- package/example/jest/jest.config.js +0 -188
- package/example/jest/package.json +0 -13
- package/example/jest/sample.test.js +0 -13
- package/example/jest/yarn.lock +0 -8
- package/example/mocha/test/index.test.js +0 -13
- package/tests/adapter/config/index.js +0 -10
- package/tests/adapter/examples/codecept/codecept.conf.js +0 -33
- package/tests/adapter/examples/codecept/index_test.js +0 -11
- package/tests/adapter/examples/codecept/jsconfig.json +0 -5
- package/tests/adapter/examples/codecept/output/Test_for_suite_2_@Tc2171bd2.failed.png +0 -0
- package/tests/adapter/examples/codecept/output/Test_issue_for_suite_1_@Tca70c8c4.failed.png +0 -0
- package/tests/adapter/examples/codecept/sample_test.js +0 -7
- package/tests/adapter/examples/codecept/steps_file.js +0 -10
- package/tests/adapter/examples/jasmine/index.test.js +0 -11
- package/tests/adapter/examples/jasmine/passReporterOpts.sh +0 -8
- package/tests/adapter/examples/jest/index.test.js +0 -11
- package/tests/adapter/examples/jest/jest.config.js +0 -4
- package/tests/adapter/examples/mocha/index.test.js +0 -13
- package/tests/adapter/examples/mocha/mocha.config.js +0 -4
- package/tests/adapter/index.test.js +0 -136
- package/tests/adapter/utils/index.js +0 -40
- package/tests/data/artifacts/failed_test.png +0 -0
- package/tests/data/artifacts/screenshot1.png +0 -0
- package/tests/data/cli/RunCest.php +0 -1024
- package/tests/data/cli/SnapshotCest.php +0 -97
- package/tests/data/codecept.xml +0 -150
- package/tests/data/codecept2.xml +0 -25
- package/tests/data/java.xml +0 -25
- package/tests/data/junit1.xml +0 -70
- package/tests/data/minitest.xml +0 -25
- package/tests/data/phpunit.xml +0 -65
- package/tests/data/pytest.xml +0 -13
- package/tests/data/src/services/search_service_test.rb +0 -146
- package/tests/util_test.js +0 -51
- package/tests/xmlReader_test.js +0 -232
|
@@ -1,1024 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
use Codeception\Attribute\DataProvider;
|
|
4
|
-
use Codeception\Attribute\Group;
|
|
5
|
-
use Codeception\Scenario;
|
|
6
|
-
|
|
7
|
-
final class RunCest
|
|
8
|
-
{
|
|
9
|
-
public function _before(CliGuy $I)
|
|
10
|
-
{
|
|
11
|
-
$I->amInPath('tests/data/sandbox');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public function runOneFile(CliGuy $I)
|
|
15
|
-
{
|
|
16
|
-
$I->wantTo('execute one test');
|
|
17
|
-
$I->executeCommand('run tests/dummy/FileExistsCept.php');
|
|
18
|
-
$I->seeInShellOutput("OK (");
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public function runOneFileWithColors(CliGuy $I)
|
|
22
|
-
{
|
|
23
|
-
$I->wantTo('execute one test');
|
|
24
|
-
$I->executeCommand('run --colors tests/dummy/FileExistsCept.php');
|
|
25
|
-
$I->seeInShellOutput("OK (");
|
|
26
|
-
$I->seeInShellOutput("\033[35;1mFileExistsCept:\033[39;22m Check config exists");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* https://github.com/Codeception/Codeception/issues/6103
|
|
31
|
-
*/
|
|
32
|
-
public function runSuiteWhenNameMatchesExistingDirectory(CliGuy $I)
|
|
33
|
-
{
|
|
34
|
-
$I->amInPath(codecept_data_dir('dir_matches_suite'));
|
|
35
|
-
$I->executeCommand('run api');
|
|
36
|
-
$I->seeInShellOutput('SuccessCest');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public function runTestsDoesntFail(CliGuy $I)
|
|
40
|
-
{
|
|
41
|
-
$I->amInPath(codecept_data_dir('dir_matches_suite'));
|
|
42
|
-
$I->executeCommand('run tests');
|
|
43
|
-
$I->seeInShellOutput('SuccessCest');
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public function runTestsWithFilterDoesntFail(CliGuy $I)
|
|
47
|
-
{
|
|
48
|
-
$I->amInPath(codecept_data_dir('dir_matches_suite'));
|
|
49
|
-
$I->executeCommand('run tests:^success');
|
|
50
|
-
$I->seeInShellOutput('SuccessCest');
|
|
51
|
-
|
|
52
|
-
$I->executeCommand('run tests/:^success');
|
|
53
|
-
$I->seeInShellOutput('SuccessCest');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public function filterTestsWithoutSpecifyingSuite(CliGuy $I)
|
|
57
|
-
{
|
|
58
|
-
$I->amInPath(codecept_data_dir('dir_matches_suite'));
|
|
59
|
-
$I->executeCommand('run :^success');
|
|
60
|
-
$I->seeInShellOutput('SuccessCest');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
#[Group('reports')]
|
|
64
|
-
public function runHtml(CliGuy $I)
|
|
65
|
-
{
|
|
66
|
-
$I->wantTo('execute tests with html output');
|
|
67
|
-
$I->executeCommand('run dummy --html');
|
|
68
|
-
$I->seeFileFound('report.html', 'tests/_output');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
#[Group('reports')]
|
|
73
|
-
public function runXmlReport(CliGuy $I)
|
|
74
|
-
{
|
|
75
|
-
$I->wantTo('check xml reports');
|
|
76
|
-
$I->executeCommand('run dummy --xml');
|
|
77
|
-
$I->seeFileFound('report.xml', 'tests/_output');
|
|
78
|
-
$I->seeInThisFile('<?xml');
|
|
79
|
-
$I->seeInThisFile('<testsuite name="dummy"');
|
|
80
|
-
$I->seeInThisFile('<testcase name="FileExists"');
|
|
81
|
-
$I->seeInThisFile('feature="');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
#[Group('reports')]
|
|
85
|
-
public function runXmlReportsInStrictMode(CliGuy $I)
|
|
86
|
-
{
|
|
87
|
-
$I->wantTo('check xml in strict mode');
|
|
88
|
-
$I->executeCommand('run dummy --xml -c codeception_strict_xml.yml');
|
|
89
|
-
$I->seeFileFound('report.xml', 'tests/_output');
|
|
90
|
-
$I->seeInThisFile('<?xml');
|
|
91
|
-
$I->seeInThisFile('<testsuite name="dummy"');
|
|
92
|
-
$I->seeInThisFile('<testcase name="FileExists"');
|
|
93
|
-
$I->dontSeeInThisFile('feature="');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
#[Group('reports')]
|
|
97
|
-
public function runPhpUnitXmlReport(CliGuy $I)
|
|
98
|
-
{
|
|
99
|
-
$I->wantTo('check phpunit xml reports');
|
|
100
|
-
$I->executeCommand('run dummy --phpunit-xml');
|
|
101
|
-
$I->seeInShellOutput('PHPUNIT XML report generated in');
|
|
102
|
-
$I->seeFileFound('phpunit-report.xml', 'tests/_output');
|
|
103
|
-
$I->seeInThisFile('<?xml');
|
|
104
|
-
$I->seeInThisFile(
|
|
105
|
-
'<testsuite name="dummy" tests="6" assertions="3" errors="0" failures="0" skipped="0" useless="0"'
|
|
106
|
-
. ' time='
|
|
107
|
-
);
|
|
108
|
-
$I->seeThisFileMatches('/<testsuite name="AnotherCest" file=".*?AnotherCest.php"/');
|
|
109
|
-
$I->seeThisFileMatches('/<testsuite name="AnotherTest" file=".*?AnotherTest.php"/');
|
|
110
|
-
$I->seeThisFileMatches(
|
|
111
|
-
'/<testsuite name="AnotherTest" file=".*?AnotherTest.php" tests="2" assertions="2" errors="0"'
|
|
112
|
-
. ' failures="0" skipped="0" useless="0" time=/'
|
|
113
|
-
);
|
|
114
|
-
//FileExistsCept file
|
|
115
|
-
$I->seeInThisFile('<testsuite name="FileExists"');
|
|
116
|
-
$I->seeInThisFile('<testcase name="FileExists"');
|
|
117
|
-
$I->seeInThisFile('feature="');
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
#[Group('reports')]
|
|
121
|
-
public function runPhpUnitXmlReportsInStrictMode(CliGuy $I)
|
|
122
|
-
{
|
|
123
|
-
$I->wantTo('check phpunit xml in strict mode');
|
|
124
|
-
$I->executeCommand('run dummy --phpunit-xml -c codeception_strict_xml.yml');
|
|
125
|
-
$I->seeInShellOutput('PHPUNIT XML report generated in');
|
|
126
|
-
$I->seeFileFound('phpunit-report.xml', 'tests/_output');
|
|
127
|
-
$I->seeInThisFile('<?xml');
|
|
128
|
-
$I->seeInThisFile(
|
|
129
|
-
'<testsuite name="dummy" tests="6" assertions="3" errors="0" failures="0" skipped="0"'
|
|
130
|
-
. ' useless="0" time='
|
|
131
|
-
);
|
|
132
|
-
$I->seeThisFileMatches('/<testsuite name="AnotherCest" file=".*?AnotherCest.php"/');
|
|
133
|
-
$I->seeThisFileMatches('/<testsuite name="AnotherTest" file=".*?AnotherTest.php"/');
|
|
134
|
-
$I->seeThisFileMatches(
|
|
135
|
-
'/<testsuite name="AnotherTest" file=".*?AnotherTest.php" tests="2" assertions="2" errors="0"'
|
|
136
|
-
. ' failures="0" skipped="0" useless="0" time=/'
|
|
137
|
-
);
|
|
138
|
-
//FileExistsCept file
|
|
139
|
-
$I->seeInThisFile('<testsuite name="FileExists"');
|
|
140
|
-
$I->seeInThisFile('<testcase name="FileExists"');
|
|
141
|
-
$I->dontSeeInThisFile('feature="');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
#[Group('reports')]
|
|
145
|
-
public function runCustomReport(CliGuy $I)
|
|
146
|
-
{
|
|
147
|
-
$I->executeCommand('run dummy --ext=MyReportPrinter -c codeception_custom_report.yml');
|
|
148
|
-
$I->seeInShellOutput('FileExistsCept: Check config exists');
|
|
149
|
-
$I->dontSeeInShellOutput('Ok');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
#[Group('reports')]
|
|
153
|
-
public function runCompactReport(CliGuy $I)
|
|
154
|
-
{
|
|
155
|
-
$I->executeCommand('run dummy --report');
|
|
156
|
-
$I->seeInShellOutput('FileExistsCept: Check config exists........................................Ok');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
public function runOneGroup(CliGuy $I)
|
|
160
|
-
{
|
|
161
|
-
$I->executeCommand('run skipped -g notorun');
|
|
162
|
-
$I->seeInShellOutput('Skipped Tests (1)');
|
|
163
|
-
$I->seeInShellOutput("IncompleteMeCept");
|
|
164
|
-
$I->dontSeeInShellOutput("SkipMeCept");
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
public function skipRunOneGroup(CliGuy $I)
|
|
168
|
-
{
|
|
169
|
-
$I->executeCommand('run skipped --skip-group notorun');
|
|
170
|
-
$I->seeInShellOutput('Skipped Tests (2)');
|
|
171
|
-
$I->seeInShellOutput("SkipMeCept");
|
|
172
|
-
$I->dontSeeInShellOutput("IncompleteMeCept");
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
#[Group('attrs')]
|
|
176
|
-
public function runOneGroupByAttr(CliGuy $I)
|
|
177
|
-
{
|
|
178
|
-
$I->executeCommand('run Attrs -g g1');
|
|
179
|
-
$I->seeInShellOutput("Valid test");
|
|
180
|
-
$I->seeInShellOutput("OK (1 test");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
#[Group('attrs')]
|
|
184
|
-
public function runWithBeforeAfter(CliGuy $I)
|
|
185
|
-
{
|
|
186
|
-
$I->executeCommand('run Attrs --steps -g g1');
|
|
187
|
-
$I->seeInShellOutput("open1");
|
|
188
|
-
$I->seeInShellOutput("open2");
|
|
189
|
-
$I->seeInShellOutput("close1");
|
|
190
|
-
$I->seeInShellOutput("OK (1 test");
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
#[Group('attrs')]
|
|
195
|
-
public function runWithExamples(CliGuy $I)
|
|
196
|
-
{
|
|
197
|
-
$I->executeCommand('run Attrs --steps -g e1');
|
|
198
|
-
$I->seeInShellOutput("OK (2 test");
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
#[Group('attrs')]
|
|
203
|
-
public function runWithDataprovider(CliGuy $I)
|
|
204
|
-
{
|
|
205
|
-
$I->executeCommand('run Attrs --steps -g d1');
|
|
206
|
-
$I->seeInShellOutput("OK (2 test");
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
#[Group('attrs')]
|
|
210
|
-
public function runWithDepends(CliGuy $I)
|
|
211
|
-
{
|
|
212
|
-
$I->executeCommand('run Attrs --steps -g dp');
|
|
213
|
-
$I->seeInShellOutput("This test depends on Attrs\BasicScenarioCest:validTest to pass");
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
#[Group('attrs')]
|
|
217
|
-
public function runWithUnitSkipped(CliGuy $I)
|
|
218
|
-
{
|
|
219
|
-
$I->executeCommand('run Attrs --steps -g uskip');
|
|
220
|
-
$I->seeInShellOutput("Skipped: 1");
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
#[Group('attrs')]
|
|
224
|
-
public function runWithUnitIncomplete(CliGuy $I)
|
|
225
|
-
{
|
|
226
|
-
$I->executeCommand('run Attrs --steps -g uincomplete');
|
|
227
|
-
$I->seeInShellOutput("Incomplete: 1");
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
public function skipGroupOfCest(CliGuy $I)
|
|
231
|
-
{
|
|
232
|
-
$I->executeCommand('run dummy');
|
|
233
|
-
$I->seeInShellOutput('Optimistic');
|
|
234
|
-
$I->seeInShellOutput('Dummy Tests (6)');
|
|
235
|
-
$I->executeCommand('run dummy --skip-group ok');
|
|
236
|
-
$I->seeInShellOutput('Pessimistic');
|
|
237
|
-
$I->seeInShellOutput('Dummy Tests (5)');
|
|
238
|
-
$I->dontSeeInShellOutput('Optimistic');
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
public function runTwoSuites(CliGuy $I)
|
|
242
|
-
{
|
|
243
|
-
$I->executeCommand('run skipped,dummy --no-exit');
|
|
244
|
-
$I->seeInShellOutput("Skipped Tests (3)");
|
|
245
|
-
$I->seeInShellOutput("Dummy Tests (6)");
|
|
246
|
-
$I->dontSeeInShellOutput("Remote Tests");
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
public function skipSuites(CliGuy $I)
|
|
250
|
-
{
|
|
251
|
-
$I->executeCommand(
|
|
252
|
-
'run dummy --skip skipped --skip remote --skip remote_server --skip order --skip unit '
|
|
253
|
-
. '--skip powers --skip math --skip messages'
|
|
254
|
-
);
|
|
255
|
-
$I->seeInShellOutput("Dummy Tests");
|
|
256
|
-
$I->dontSeeInShellOutput("Remote Tests");
|
|
257
|
-
$I->dontSeeInShellOutput("Remote_server Tests");
|
|
258
|
-
$I->dontSeeInShellOutput("Order Tests");
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
public function runOneTestFromUnit(CliGuy $I)
|
|
262
|
-
{
|
|
263
|
-
$I->executeCommand('run tests/dummy/AnotherTest.php:testFirst');
|
|
264
|
-
$I->seeInShellOutput("AnotherTest: First");
|
|
265
|
-
$I->seeInShellOutput('OK');
|
|
266
|
-
$I->dontSeeInShellOutput('AnotherTest: Second');
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
public function runOneTestFromCest(CliGuy $I)
|
|
270
|
-
{
|
|
271
|
-
$I->executeCommand('run tests/dummy/AnotherCest.php:optimistic');
|
|
272
|
-
$I->seeInShellOutput("Optimistic");
|
|
273
|
-
$I->dontSeeInShellOutput('Pessimistic');
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
public function runTestWithDataProviders(CliGuy $I)
|
|
277
|
-
{
|
|
278
|
-
$I->executeCommand('run tests/unit/DataProvidersTest.php');
|
|
279
|
-
$I->seeInShellOutput('Is triangle | "real triangle"');
|
|
280
|
-
$I->seeInShellOutput('Is triangle | #0');
|
|
281
|
-
$I->seeInShellOutput('Is triangle | #1');
|
|
282
|
-
$I->seeInShellOutput('DataProvidersTest');
|
|
283
|
-
$I->seeInShellOutput("OK");
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
public function filterTestsByDataProviderCaseNumber(CliGuy $I)
|
|
287
|
-
{
|
|
288
|
-
$I->executeCommand('run tests/unit/DataProvidersTest.php:#1');
|
|
289
|
-
$I->seeInShellOutput('Is triangle | #1');
|
|
290
|
-
$I->dontSeeInShellOutput('Is triangle | "real triangle"');
|
|
291
|
-
$I->dontSeeInShellOutput('Is triangle | #0');
|
|
292
|
-
$I->seeInShellOutput('DataProvidersTest');
|
|
293
|
-
$I->seeInShellOutput("OK (1 test, 1 assertion)");
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
public function filterTestsByDataProviderCaseNumberRange(CliGuy $I)
|
|
297
|
-
{
|
|
298
|
-
$I->executeCommand('run tests/unit/DataProvidersTest.php:#0-1');
|
|
299
|
-
$I->seeInShellOutput('Is triangle | #0');
|
|
300
|
-
$I->seeInShellOutput('Is triangle | #1');
|
|
301
|
-
$I->dontSeeInShellOutput('Is triangle | "real triangle"');
|
|
302
|
-
$I->seeInShellOutput('DataProvidersTest');
|
|
303
|
-
$I->seeInShellOutput("OK (2 tests, 2 assertions)");
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
public function filterTestsByDataProviderCaseName(CliGuy $I)
|
|
307
|
-
{
|
|
308
|
-
$I->executeCommand('run tests/unit/DataProvidersTest.php:@"real.*"');
|
|
309
|
-
$I->seeInShellOutput('Is triangle | "real triangle"');
|
|
310
|
-
$I->dontSeeInShellOutput('Is triangle | #0');
|
|
311
|
-
$I->dontSeeInShellOutput('Is triangle | #1');
|
|
312
|
-
$I->seeInShellOutput('DataProvidersTest');
|
|
313
|
-
$I->seeInShellOutput("OK (1 test, 1 assertion)");
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
public function filterCestsByDataProviderNumber(CliGuy $I)
|
|
317
|
-
{
|
|
318
|
-
$I->executeCommand('run tests/scenario/DataProviderCest.php:withProtectedDataProvider#1');
|
|
319
|
-
$I->seeInShellOutput('dummy.suite.yml');
|
|
320
|
-
$I->dontSeeInShellOutput('unit.suite.yml');
|
|
321
|
-
$I->dontSeeInShellOutput('summary.suite.yml');
|
|
322
|
-
$I->seeInShellOutput("OK (1 test, 1 assertion)");
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
public function filterCestsByExampleNumber(CliGuy $I)
|
|
326
|
-
{
|
|
327
|
-
$I->executeCommand('run tests/scenario/DataProviderCest.php:withDataProviderAndExample#0');
|
|
328
|
-
$I->seeInShellOutput('skipped.suite.yml');
|
|
329
|
-
$I->dontSeeInShellOutput('dummy.suite.yml');
|
|
330
|
-
$I->dontSeeInShellOutput('unit.suite.yml');
|
|
331
|
-
$I->dontSeeInShellOutput('summary.suite.yml');
|
|
332
|
-
$I->seeInShellOutput("OK (1 test, 1 assertion)");
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
public function runOneGroupWithDataProviders(CliGuy $I)
|
|
336
|
-
{
|
|
337
|
-
$I->executeCommand('run unit -g data-providers');
|
|
338
|
-
$I->seeInShellOutput('Is triangle | "real triangle"');
|
|
339
|
-
$I->seeInShellOutput('Is triangle | #0');
|
|
340
|
-
$I->seeInShellOutput('Is triangle | #1');
|
|
341
|
-
$I->seeInShellOutput('DataProvidersTest');
|
|
342
|
-
$I->seeInShellOutput("OK");
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
public function runTestWithFailFastDefault(CliGuy $I)
|
|
346
|
-
{
|
|
347
|
-
$I->executeCommand('run unit --skip-group error --skip-group multiple-fail --no-exit');
|
|
348
|
-
$I->seeInShellOutput('FailingTest: Me');
|
|
349
|
-
$I->seeInShellOutput("PassingTest: Me");
|
|
350
|
-
$I->executeCommand('run unit --fail-fast --skip-group error --skip-group multiple-fail --no-exit');
|
|
351
|
-
$I->seeInShellOutput('There was 1 failure');
|
|
352
|
-
$I->dontSeeInShellOutput("PassingTest: Me");
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
public function runTestWithFailFastCustom(CliGuy $I)
|
|
356
|
-
{
|
|
357
|
-
$I->executeCommand('run unit MultipleFailingTest.php --fail-fast=2 --no-exit');
|
|
358
|
-
$I->seeInShellOutput('There were 2 failures');
|
|
359
|
-
$I->executeCommand('run unit MultipleFailingTest.php --no-exit');
|
|
360
|
-
$I->seeInShellOutput('There were 3 failures');
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
#[Group('reports')]
|
|
364
|
-
public function runWithCustomOutputPath(CliGuy $I)
|
|
365
|
-
{
|
|
366
|
-
$I->executeCommand('run dummy --xml myverycustom.xml --html myownhtmlreport.html');
|
|
367
|
-
$I->seeFileFound('myverycustom.xml', 'tests/_output');
|
|
368
|
-
$I->seeInThisFile('<?xml');
|
|
369
|
-
$I->seeInThisFile('<testsuite name="dummy"');
|
|
370
|
-
$I->seeInThisFile('<testcase name="FileExists"');
|
|
371
|
-
$I->seeFileFound('myownhtmlreport.html', 'tests/_output');
|
|
372
|
-
$I->dontSeeFileFound('report.xml', 'tests/_output');
|
|
373
|
-
$I->dontSeeFileFound('report.html', 'tests/_output');
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
public function runTestsWithDependencyInjections(CliGuy $I)
|
|
377
|
-
{
|
|
378
|
-
$I->executeCommand('run math');
|
|
379
|
-
$I->seeInShellOutput('MathCest: Test addition');
|
|
380
|
-
$I->seeInShellOutput('MathCest: Test subtraction');
|
|
381
|
-
$I->seeInShellOutput('MathCest: Test square');
|
|
382
|
-
$I->seeInShellOutput('MathTest: All');
|
|
383
|
-
$I->seeInShellOutput('OK (');
|
|
384
|
-
$I->dontSeeInShellOutput('fail');
|
|
385
|
-
$I->dontSeeInShellOutput('error');
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
public function runErrorTest(CliGuy $I)
|
|
389
|
-
{
|
|
390
|
-
$I->executeCommand('run unit ErrorTest --no-exit');
|
|
391
|
-
$I->seeInShellOutput('There was 1 error');
|
|
392
|
-
$I->seeInShellOutput('Array to string conversion');
|
|
393
|
-
$I->seeInShellOutput('ErrorTest.php');
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
public function runTestWithException(CliGuy $I)
|
|
397
|
-
{
|
|
398
|
-
$I->executeCommand('run unit ExceptionTest --no-exit -v');
|
|
399
|
-
$I->seeInShellOutput('There was 1 error');
|
|
400
|
-
$I->seeInShellOutput('Helllo!');
|
|
401
|
-
$I->expect('Exceptions are not wrapped into ExceptionWrapper');
|
|
402
|
-
$I->dontSeeInShellOutput('PHPUnit_Framework_ExceptionWrapper');
|
|
403
|
-
$I->seeInShellOutput(\RuntimeException::class);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
public function runTestsWithSteps(CliGuy $I)
|
|
407
|
-
{
|
|
408
|
-
$I->executeCommand('run scenario SuccessCept --steps');
|
|
409
|
-
$I->seeInShellOutput(
|
|
410
|
-
<<<EOF
|
|
411
|
-
Scenario --
|
|
412
|
-
I am in path "."
|
|
413
|
-
I see file found "scenario.suite.yml"
|
|
414
|
-
PASSED
|
|
415
|
-
EOF
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* @param CliGuy $I
|
|
421
|
-
*/
|
|
422
|
-
public function runTestWithFailedScenario(CliGuy $I, $scenario)
|
|
423
|
-
{
|
|
424
|
-
if (!extension_loaded('xdebug')) {
|
|
425
|
-
$scenario->skip("Xdebug not loaded");
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
$I->executeCommand('run scenario FailedCept --steps --no-exit');
|
|
429
|
-
$I->seeInShellOutput(
|
|
430
|
-
<<<EOF
|
|
431
|
-
FailedCept: Fail when file is not found
|
|
432
|
-
Signature: FailedCept
|
|
433
|
-
Test: tests/scenario/FailedCept.php
|
|
434
|
-
Scenario --
|
|
435
|
-
I am in path "."
|
|
436
|
-
I see file found "games.zip"
|
|
437
|
-
FAIL
|
|
438
|
-
EOF
|
|
439
|
-
);
|
|
440
|
-
$I->expect('to see scenario trace');
|
|
441
|
-
$I->seeInShellOutput(
|
|
442
|
-
<<<EOF
|
|
443
|
-
Scenario Steps:
|
|
444
|
-
|
|
445
|
-
2. \$I->seeFileFound("games.zip") at tests/scenario/FailedCept.php:6
|
|
446
|
-
1. \$I->amInPath(".") at tests/scenario/FailedCept.php:5
|
|
447
|
-
|
|
448
|
-
EOF
|
|
449
|
-
);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
public function runTestWithSubSteps(CliGuy $I, Scenario $scenario)
|
|
453
|
-
{
|
|
454
|
-
if (!extension_loaded('xdebug')) {
|
|
455
|
-
$scenario->skip("Xdebug not loaded");
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
$file = "codeception" . DIRECTORY_SEPARATOR . "c3";
|
|
459
|
-
$I->executeCommand('run scenario SubStepsCept --steps');
|
|
460
|
-
$I->seeInShellOutput(
|
|
461
|
-
<<<EOF
|
|
462
|
-
Scenario --
|
|
463
|
-
I am in path "."
|
|
464
|
-
I see code coverage files are present
|
|
465
|
-
I see file found "c3.php"
|
|
466
|
-
I see file found "composer.json"
|
|
467
|
-
I see in this file "{$file}"
|
|
468
|
-
EOF
|
|
469
|
-
);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
public function runDependentCest(CliGuy $I)
|
|
473
|
-
{
|
|
474
|
-
$I->executeCommand('run order DependentCest --no-exit');
|
|
475
|
-
$I->seeInShellOutput('Skipped: 1');
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
public function runDependentTest(CliGuy $I)
|
|
479
|
-
{
|
|
480
|
-
$I->executeCommand('run unit DependsTest --no-exit');
|
|
481
|
-
$I->seeInShellOutput('Skipped: 1');
|
|
482
|
-
$I->executeCommand('run unit --no-exit');
|
|
483
|
-
$I->seeInShellOutput('Skipped: 2');
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
public function runGherkinTest(CliGuy $I)
|
|
487
|
-
{
|
|
488
|
-
$I->executeCommand('run scenario File.feature --steps');
|
|
489
|
-
$I->seeInShellOutput(
|
|
490
|
-
<<<EOF
|
|
491
|
-
In order to test a feature
|
|
492
|
-
As a user
|
|
493
|
-
I need to be able to see output
|
|
494
|
-
EOF
|
|
495
|
-
);
|
|
496
|
-
$I->seeInShellOutput('Given i have terminal opened');
|
|
497
|
-
$I->seeInShellOutput('When i am in current directory');
|
|
498
|
-
$I->seeInShellOutput('Then there is a file "scenario.suite.yml"');
|
|
499
|
-
$I->seeInShellOutput('And there are keywords in "scenario.suite.yml"');
|
|
500
|
-
$I->seeInShellOutput(
|
|
501
|
-
<<<EOF
|
|
502
|
-
| actor | ScenarioGuy |
|
|
503
|
-
| enabled | Filesystem |
|
|
504
|
-
EOF
|
|
505
|
-
);
|
|
506
|
-
$I->seeInShellOutput('PASSED');
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
public function reportsCorrectFailedStep(CliGuy $I)
|
|
510
|
-
{
|
|
511
|
-
$I->executeCommand('run scenario File.feature -v');
|
|
512
|
-
$I->seeInShellOutput('OK, but incomplete');
|
|
513
|
-
$I->seeInShellOutput("Step definition for `I have only idea of what's going on here` not found in contexts");
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
public function runFailingGherkinTest(CliGuy $I)
|
|
517
|
-
{
|
|
518
|
-
$I->executeCommand('run scenario Fail.feature -v --no-exit');
|
|
519
|
-
$I->seeInShellOutput('Step I see file "games.zip"');
|
|
520
|
-
$I->seeInShellOutput('Step I see file "tools.zip"');
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
public function runGherkinScenarioWithMultipleStepDefinitions(CliGuy $I)
|
|
524
|
-
{
|
|
525
|
-
$I->executeCommand('run scenario "File.feature:Check file once more" --steps');
|
|
526
|
-
$I->seeInShellOutput('When there is a file "scenario.suite.yml"');
|
|
527
|
-
$I->seeInShellOutput('Then i see file "scenario.suite.yml"');
|
|
528
|
-
$I->dontSeeInShellOutput('Step definition for `I see file "scenario.suite.yml"` not found in contexts');
|
|
529
|
-
$I->seeInShellOutput('PASSED');
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
public function runGherkinScenarioOutline(CliGuy $I)
|
|
533
|
-
{
|
|
534
|
-
$I->executeCommand('run scenario FileExamples.feature -v');
|
|
535
|
-
$I->seeInShellOutput('OK (3 tests');
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* @param CliGuy $I
|
|
540
|
-
* @after checkExampleFiles
|
|
541
|
-
*/
|
|
542
|
-
public function runTestWithAnnotationExamples(CliGuy $I)
|
|
543
|
-
{
|
|
544
|
-
$I->executeCommand('run scenario ExamplesCest:filesExistsAnnotation --steps');
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/**
|
|
548
|
-
* @param CliGuy $I
|
|
549
|
-
* @after checkExampleFiles
|
|
550
|
-
*/
|
|
551
|
-
public function runTestWithJsonExamples(CliGuy $I)
|
|
552
|
-
{
|
|
553
|
-
$I->executeCommand('run scenario ExamplesCest:filesExistsByJson --steps');
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
/**
|
|
557
|
-
* @param CliGuy $I
|
|
558
|
-
* @after checkExampleFiles
|
|
559
|
-
*/
|
|
560
|
-
public function runTestWithArrayExamples(CliGuy $I)
|
|
561
|
-
{
|
|
562
|
-
$I->executeCommand('run scenario ExamplesCest:filesExistsByArray --steps');
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
private function checkExampleFiles(CliGuy $I)
|
|
566
|
-
{
|
|
567
|
-
$I->seeInShellOutput('OK (3 tests');
|
|
568
|
-
$I->seeInShellOutput('I see file found "scenario.suite.yml"');
|
|
569
|
-
$I->seeInShellOutput('I see file found "dummy.suite.yml"');
|
|
570
|
-
$I->seeInShellOutput('I see file found "unit.suite.yml"');
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
public function runTestWithComplexExample(CliGuy $I)
|
|
574
|
-
{
|
|
575
|
-
$I->executeCommand('run scenario ExamplesCest:filesExistsComplexJson --debug');
|
|
576
|
-
$I->seeInShellOutput('Files exists complex json | {"path":"."');
|
|
577
|
-
$I->seeInShellOutput('OK (1 test');
|
|
578
|
-
$I->seeInShellOutput('I see file found "scenario.suite.yml"');
|
|
579
|
-
$I->seeInShellOutput('I see file found "dummy.suite.yml"');
|
|
580
|
-
$I->seeInShellOutput('I see file found "unit.suite.yml"');
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
public function reportersConfigurationSectionIsNotSupported(CliGuy $I)
|
|
584
|
-
{
|
|
585
|
-
$I->executeCommand('run scenario --report -o "reporters: report: PHPUnit_Util_Log_TeamCity" --no-exit');
|
|
586
|
-
$I->seeInShellOutput(
|
|
587
|
-
"WARNING: 'reporters' option is not supported! Custom reporters must be reimplemented as extensions."
|
|
588
|
-
);
|
|
589
|
-
$I->seeInShellOutput('............Ok');
|
|
590
|
-
$I->dontSeeInShellOutput('##teamcity[testStarted');
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
public function overrideModuleOptions(CliGuy $I)
|
|
594
|
-
{
|
|
595
|
-
$I->executeCommand('run powers PowerIsRisingCept --no-exit');
|
|
596
|
-
$I->seeInShellOutput('FAILURES');
|
|
597
|
-
$I->executeCommand('run powers PowerIsRisingCept -o "modules: config: PowerHelper: has_power: true" --no-exit');
|
|
598
|
-
$I->dontSeeInShellOutput('FAILURES');
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
public function runTestWithAnnotationExamplesFromGroupFileTest(CliGuy $I)
|
|
602
|
-
{
|
|
603
|
-
$I->executeCommand('run scenario -g groupFileTest1 --steps');
|
|
604
|
-
$I->seeInShellOutput('OK (3 tests');
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
public function testsWithConditionalFails(CliGuy $I)
|
|
608
|
-
{
|
|
609
|
-
$I->executeCommand('run scenario ConditionalCept --no-exit');
|
|
610
|
-
$I->seeInShellOutput('There were 3 failures');
|
|
611
|
-
$I->seeInShellOutput('Fail File "not-a-file" not found');
|
|
612
|
-
$I->seeInShellOutput('Fail File "not-a-dir" not found');
|
|
613
|
-
$I->seeInShellOutput('Fail File "nothing" not found');
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
public function runTestWithAnnotationDataprovider(CliGuy $I)
|
|
617
|
-
{
|
|
618
|
-
$I->executeCommand('run scenario -g dataprovider --steps');
|
|
619
|
-
$I->seeInShellOutput('OK (18 tests');
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
public function runFailedTestAndCheckOutput(CliGuy $I)
|
|
623
|
-
{
|
|
624
|
-
$I->executeCommand('run scenario FailedCept', false);
|
|
625
|
-
$testPath = implode(DIRECTORY_SEPARATOR, ['tests', 'scenario', 'FailedCept.php']);
|
|
626
|
-
$I->seeInShellOutput('1) FailedCept: Fail when file is not found');
|
|
627
|
-
$I->seeInShellOutput('Test ' . $testPath);
|
|
628
|
-
$I->seeInShellOutput('Step See file found "games.zip"');
|
|
629
|
-
$I->seeInShellOutput('Fail File "games.zip" not found at ""');
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
public function runTestWithCustomSetupMethod(CliGuy $I)
|
|
633
|
-
{
|
|
634
|
-
$I->executeCommand('run powers PowerUpCest');
|
|
635
|
-
$I->dontSeeInShellOutput('FAILURES');
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
public function runCestWithTwoFailedTest(CliGuy $I)
|
|
639
|
-
{
|
|
640
|
-
$I->executeCommand('run scenario PartialFailedCest', false);
|
|
641
|
-
$I->seeInShellOutput('See file found "testcasetwo.txt"');
|
|
642
|
-
$I->seeInShellOutput('See file found "testcasethree.txt"');
|
|
643
|
-
$I->seeInShellOutput('Tests: 3,');
|
|
644
|
-
$I->seeInShellOutput('Failures: 2.');
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
public function runInvalidDataProvider(CliGuy $I)
|
|
648
|
-
{
|
|
649
|
-
$I->executeCommand('run unit InvalidDataProviderTest.php', false);
|
|
650
|
-
$I->seeInShellOutput('There was 1 error');
|
|
651
|
-
$I->seeInShellOutput('[PHPUnit\Framework\Error] The data provider specified for InvalidDataProviderTest::testInvalidDataProvider is invalid');
|
|
652
|
-
$I->seeInShellOutput('Tests: 1,');
|
|
653
|
-
$I->seeInShellOutput('Errors: 1.');
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* @group shuffle
|
|
658
|
-
* @param CliGuy $I
|
|
659
|
-
*/
|
|
660
|
-
public function showSeedNumberOnShuffle(CliGuy $I)
|
|
661
|
-
{
|
|
662
|
-
$I->executeCommand('run unit -o "settings: shuffle: true"', false);
|
|
663
|
-
$I->seeInShellOutput('Seed');
|
|
664
|
-
$I->executeCommand('run unit', false);
|
|
665
|
-
$I->dontSeeInShellOutput('Seed');
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
* @group shuffle
|
|
670
|
-
* @param CliGuy $I
|
|
671
|
-
* @param Scenario $scenario
|
|
672
|
-
*/
|
|
673
|
-
public function showSameOrderOfFilesOnSeed(CliGuy $I, Scenario $scenario)
|
|
674
|
-
{
|
|
675
|
-
if (DIRECTORY_SEPARATOR === '\\') {
|
|
676
|
-
$scenario->skip('Failing on Windows. Need to investigate');
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
$I->executeCommand('run unit -o "settings: shuffle: true"', false);
|
|
680
|
-
$I->seeInShellOutput('Seed');
|
|
681
|
-
|
|
682
|
-
$output = $I->grabFromOutput('/---\n((.|\n)*?)---/m');
|
|
683
|
-
$output = preg_replace('#\(\d\.\d+s\)#m', '', $output);
|
|
684
|
-
|
|
685
|
-
$seed = $I->grabFromOutput('~\[Seed\] (.*)~');
|
|
686
|
-
|
|
687
|
-
$I->executeCommand('run unit -o "settings: shuffle: true" --seed ' . $seed, false);
|
|
688
|
-
$newOutput = $I->grabFromOutput('/---\n((.|\n)*?)---/m');
|
|
689
|
-
$newOutput = preg_replace('#\(\d\.\d+s\)#m', '', $newOutput);
|
|
690
|
-
|
|
691
|
-
$I->assertSame($output, $newOutput, 'order of tests is the same');
|
|
692
|
-
|
|
693
|
-
$I->executeCommand('run unit -o "settings: shuffle: true"', false);
|
|
694
|
-
|
|
695
|
-
$newOutput = $I->grabFromOutput('/---\n((.|\n)*?)---/m');
|
|
696
|
-
$newOutput = preg_replace('#\(\d\.\d+s\)#m', '', $newOutput);
|
|
697
|
-
|
|
698
|
-
$I->assertNotSame($output, $newOutput, 'order of tests is the same');
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
public function runCustomBootstrap(CliGuy $I)
|
|
702
|
-
{
|
|
703
|
-
$I->wantTo('execute one test');
|
|
704
|
-
$I->executeCommand('run dummy --bootstrap tests/_init.php');
|
|
705
|
-
$I->seeInShellOutput('--INIT--');
|
|
706
|
-
$I->seeInShellOutput("'hello' => 'world'");
|
|
707
|
-
$I->seeInShellOutput("OK (");
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
public function throwErrorIfBootstrapNotFound(CliGuy $I)
|
|
711
|
-
{
|
|
712
|
-
$I->wantTo('execute one test');
|
|
713
|
-
$I->executeCommand('run dummy --bootstrap tests/init.php --no-exit 2>&1', false);
|
|
714
|
-
$I->dontSeeInShellOutput('--INIT--');
|
|
715
|
-
$I->seeInShellOutput("can't be loaded");
|
|
716
|
-
$I->dontSeeInShellOutput("OK (");
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
public function runBootstrapInGlobalConfig(CliGuy $I)
|
|
720
|
-
{
|
|
721
|
-
$I->wantTo('execute one test');
|
|
722
|
-
$I->executeCommand('run dummy -c codeception.bootstrap.yml');
|
|
723
|
-
$I->seeInShellOutput('--INIT--');
|
|
724
|
-
$I->seeInShellOutput("'hello' => 'world'");
|
|
725
|
-
$I->seeInShellOutput("OK (");
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
public function runBootstrapInSuiteConfig(CliGuy $I)
|
|
729
|
-
{
|
|
730
|
-
$I->wantTo('execute one test');
|
|
731
|
-
$I->executeCommand('run dummy.bootstrap');
|
|
732
|
-
$I->seeInShellOutput('--INIT--');
|
|
733
|
-
$I->seeInShellOutput("'hello' => 'world'");
|
|
734
|
-
$I->seeInShellOutput("OK (");
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
public function runTestsWithGrep(CliGuy $I)
|
|
738
|
-
{
|
|
739
|
-
$I->executeCommand('run dummy --grep Another --no-ansi');
|
|
740
|
-
$I->dontSeeInShellOutput('GroupEventsCest');
|
|
741
|
-
$I->seeInShellOutput('AnotherCest');
|
|
742
|
-
|
|
743
|
-
$I->executeCommand('run dummy --grep Optimistic --no-ansi');
|
|
744
|
-
$I->seeInShellOutput('OK (1 test');
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
public function runTestsWithFilter(CliGuy $I)
|
|
748
|
-
{
|
|
749
|
-
$I->executeCommand('run dummy --filter Another --no-ansi');
|
|
750
|
-
$I->dontSeeInShellOutput('GroupEventsCest');
|
|
751
|
-
$I->seeInShellOutput('AnotherCest');
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
public function runTestsByShards(CliGuy $I)
|
|
755
|
-
{
|
|
756
|
-
$I->executeCommand('run dummy --shard=1/3 --no-ansi');
|
|
757
|
-
$I->seeInShellOutput('OK (2 tests');
|
|
758
|
-
$I->seeInShellOutput('[Shard 1/3');
|
|
759
|
-
preg_match_all('~\+\s(\w+:\s[\w\s]+)~', $I->grabShellOutput(), $matches);
|
|
760
|
-
$tests1 = $matches[1];
|
|
761
|
-
|
|
762
|
-
$I->executeCommand('run dummy --shard=2/3');
|
|
763
|
-
$I->seeInShellOutput('OK (2 tests');
|
|
764
|
-
$I->seeInShellOutput('[Shard 2/3');
|
|
765
|
-
|
|
766
|
-
preg_match_all('~\+\s(\w+:\s[\w\s]+)~', $I->grabShellOutput(), $matches);
|
|
767
|
-
$tests2 = $matches[1];
|
|
768
|
-
|
|
769
|
-
$I->executeCommand('run dummy --shard=3/3');
|
|
770
|
-
$I->seeInShellOutput('OK (2 tests');
|
|
771
|
-
$I->seeInShellOutput('[Shard 3/3');
|
|
772
|
-
|
|
773
|
-
preg_match_all('~\+\s(\w+:\s[\w\s]+)~', $I->grabShellOutput(), $matches);
|
|
774
|
-
$tests3 = $matches[1];
|
|
775
|
-
|
|
776
|
-
$I->assertEmpty(array_intersect($tests1, $tests2), 'same tests in shards');
|
|
777
|
-
$I->assertEmpty(array_intersect($tests2, $tests3), 'same tests in shards');
|
|
778
|
-
$I->assertEmpty(array_intersect($tests1, $tests3), 'same tests in shards');
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
#[Group('reports')]
|
|
782
|
-
public function runHtmlWithPhpBrowserCheckReport(CliGuy $I)
|
|
783
|
-
{
|
|
784
|
-
$I->wantTo('execute tests with PhpBrowser with html output and check html');
|
|
785
|
-
$I->executeFailCommand('run phpbrowser_html_report --html');
|
|
786
|
-
$I->seeResultCodeIsNot(0);
|
|
787
|
-
|
|
788
|
-
$expectedRelReportPath = 'tests/_output';
|
|
789
|
-
$expectedReportFilename = 'CodeceptionIssue5568Cest.failureShouldCreateHtmlSnapshot.fail.html';
|
|
790
|
-
$expectedReportAbsFilename = implode(DIRECTORY_SEPARATOR, [
|
|
791
|
-
getcwd(),
|
|
792
|
-
$expectedRelReportPath,
|
|
793
|
-
$expectedReportFilename
|
|
794
|
-
]);
|
|
795
|
-
$I->seeInShellOutput('Html: ' . $expectedReportAbsFilename);
|
|
796
|
-
$I->seeInShellOutput('Response: ' . $expectedReportAbsFilename);
|
|
797
|
-
$I->seeFileFound('report.html', $expectedRelReportPath);
|
|
798
|
-
$I->seeInThisFile("See <a href='" . $expectedReportFilename . "' target='_blank'>HTML snapshot</a> of a failed page");
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
private function htmlReportRegexCheckProvider(): array
|
|
802
|
-
{
|
|
803
|
-
return [
|
|
804
|
-
[
|
|
805
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'twoCommentStepsInARow'))
|
|
806
|
-
->addStep('no metaStep')
|
|
807
|
-
->addStep('no metaStep')
|
|
808
|
-
],
|
|
809
|
-
[
|
|
810
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'twoCommentStepsInARowViaPageObjectActor'))
|
|
811
|
-
->addStep('no metaStep')
|
|
812
|
-
->addStep('no metaStep')
|
|
813
|
-
],
|
|
814
|
-
[
|
|
815
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'twoCommentStepsWithOneSubStepInBetween'))
|
|
816
|
-
->addStep('no metaStep')
|
|
817
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
818
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
819
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
820
|
-
->addStep('no metaStep')
|
|
821
|
-
],
|
|
822
|
-
[
|
|
823
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'commentStepsWithDifferentSubStepsInBetweenAndAfter'))
|
|
824
|
-
->addStep('no metaStep')
|
|
825
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
826
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
827
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
828
|
-
->addStep('no metaStep')
|
|
829
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
830
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
831
|
-
],
|
|
832
|
-
[
|
|
833
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'differentSubSteps'))
|
|
834
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
835
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
836
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
837
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
838
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
839
|
-
],
|
|
840
|
-
[
|
|
841
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'commentStepsWithDifferentSubStepsOnceNestedInBetweenAndAfter'))
|
|
842
|
-
->addStep('no metaStep')
|
|
843
|
-
->addMetaStep('Page\DemoPageObject: demo action1 with nested no metastep')
|
|
844
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
845
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
846
|
-
->addStep('no metaStep inside a method')
|
|
847
|
-
->addStep('no metaStep')
|
|
848
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
849
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
850
|
-
],
|
|
851
|
-
[
|
|
852
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'commentStepsWithDifferentSubStepsOnceNestedInBetweenAndAfter2'))
|
|
853
|
-
->addStep('no metaStep')
|
|
854
|
-
->addMetaStep('Page\DemoPageObject: demo action1 with nested no metastep2')
|
|
855
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
856
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
857
|
-
->addStep('no metaStep inside a private internal method')
|
|
858
|
-
->addStep('no metaStep')
|
|
859
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
860
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
861
|
-
],
|
|
862
|
-
[
|
|
863
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'nestedSubStepFollowedByOtherSubStep'))
|
|
864
|
-
->addMetaStep('Page\DemoPageObject: demo action1 with nested no metastep')
|
|
865
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
866
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
867
|
-
->addStep('no metaStep inside a method')
|
|
868
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
869
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
870
|
-
],
|
|
871
|
-
[
|
|
872
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'nestedSubStepFollowedByOtherSubStep2'))
|
|
873
|
-
->addMetaStep('Page\DemoPageObject: demo action1 with nested no metastep2')
|
|
874
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
875
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
876
|
-
->addStep('no metaStep inside a private internal method')
|
|
877
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
878
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
879
|
-
],
|
|
880
|
-
[
|
|
881
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'twoIdentialSubStepsInARow'))
|
|
882
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
883
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
884
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
885
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
886
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
887
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
888
|
-
],
|
|
889
|
-
[
|
|
890
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'twoIdentialSubStepsInARowFollowedByAnotherSubStep'))
|
|
891
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
892
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
893
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
894
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
895
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
896
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
897
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
898
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
899
|
-
],
|
|
900
|
-
[
|
|
901
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'twoIdentialSubStepsWithAnotherSubStepInBetween'))
|
|
902
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
903
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
904
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
905
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
906
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
907
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
908
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
909
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
910
|
-
],
|
|
911
|
-
[
|
|
912
|
-
'testHtmlReportRegexBuilder' => (new TestHtmlReportRegexBuilder('CodeceptionIssue4413Cest', 'subStepFollowedByTwoIdentialSubSteps'))
|
|
913
|
-
->addMetaStep('Page\DemoPageObject: demo action2')
|
|
914
|
-
->addStep("I don't see file found", 'thisFileAgainDoesNotExist')
|
|
915
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
916
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
917
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
918
|
-
->addMetaStep('Page\DemoPageObject: demo action1')
|
|
919
|
-
->addStep("I don't see file found", 'thisFileDoesNotExist')
|
|
920
|
-
->addStep("I don't see file found", 'thisFileAlsoDoesNotExist')
|
|
921
|
-
]
|
|
922
|
-
];
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
#[Group('reports')]
|
|
926
|
-
#[DataProvider('htmlReportRegexCheckProvider')]
|
|
927
|
-
public function runHtmlCheckReport(CliGuy $I, \Codeception\Example $example, Scenario $scenario)
|
|
928
|
-
{
|
|
929
|
-
/** @var TestHtmlReportRegexBuilder $testBuilder */
|
|
930
|
-
$testBuilder = $example['testHtmlReportRegexBuilder'];
|
|
931
|
-
$testClass = $testBuilder->getTestClass();
|
|
932
|
-
$testCase = $testBuilder->getTestCase();
|
|
933
|
-
|
|
934
|
-
$test = $testClass . ':' . $testCase;
|
|
935
|
-
$I->wantTo('verify that all steps are rendered correctly in HTML report (' . $test . ')');
|
|
936
|
-
$I->executeCommand('run html_report ' . $test . '$ --html');
|
|
937
|
-
$I->seeFileFound('report.html', 'tests/_output');
|
|
938
|
-
|
|
939
|
-
// Check HTML report in sufficient detail:
|
|
940
|
-
$builder = (new HtmlReportRegexBuilder())->addTest($testBuilder);
|
|
941
|
-
$I->seeThisFileMatches($builder->build());
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
// Helper classes for test 'runHtmlCheckReport':
|
|
947
|
-
|
|
948
|
-
class HtmlReportRegexBuilder
|
|
949
|
-
{
|
|
950
|
-
private $regex;
|
|
951
|
-
|
|
952
|
-
public function build(): string
|
|
953
|
-
{
|
|
954
|
-
return '/' . $this->regex . '/s';
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
public function addTest(TestHtmlReportRegexBuilder $testBuilder): self
|
|
958
|
-
{
|
|
959
|
-
$this->regex .= $testBuilder->build();
|
|
960
|
-
return $this;
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
class TestHtmlReportRegexBuilder
|
|
965
|
-
{
|
|
966
|
-
private string $testClass;
|
|
967
|
-
|
|
968
|
-
private string $testCase;
|
|
969
|
-
|
|
970
|
-
private $stepsRegex;
|
|
971
|
-
|
|
972
|
-
public function __construct(string $testClass, string $testCase)
|
|
973
|
-
{
|
|
974
|
-
$this->testClass = $testClass;
|
|
975
|
-
$this->testCase = $testCase;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
public function getTestClass(): string
|
|
979
|
-
{
|
|
980
|
-
return $this->testClass;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
public function getTestCase(): string
|
|
984
|
-
{
|
|
985
|
-
return $this->testCase;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
/**
|
|
989
|
-
* Allows for nice output in @dataProvider usage.
|
|
990
|
-
*/
|
|
991
|
-
public function __toString(): string
|
|
992
|
-
{
|
|
993
|
-
return $this->getTestClass() . ':' . $this->getTestCase();
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
public function addStep(string $step, ?string $arg = null): self
|
|
997
|
-
{
|
|
998
|
-
$this->stepsRegex .= '.*?' . 'stepName ' . '.*?' . $step;
|
|
999
|
-
if ($arg) {
|
|
1000
|
-
$this->stepsRegex .= '.*?' . '>"' . $arg . '"';
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
return $this;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
public function addMetaStep(string $step): self
|
|
1007
|
-
{
|
|
1008
|
-
$this->addStep(preg_quote($step));
|
|
1009
|
-
$this->stepsRegex .= '.*?substeps ';
|
|
1010
|
-
return $this;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
public function build(): string
|
|
1014
|
-
{
|
|
1015
|
-
$regex = 'scenarioRow .*?' . $this->testClass . ' .*? ' . \Codeception\Test\Descriptor::getTestCaseNameAsString($this->testCase);
|
|
1016
|
-
if ($this->stepsRegex) {
|
|
1017
|
-
$regex .= ' .*?scenarioRow ' . $this->stepsRegex . '.*?';
|
|
1018
|
-
} else {
|
|
1019
|
-
$regex .= '.*?';
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
return $regex;
|
|
1023
|
-
}
|
|
1024
|
-
}
|