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: docs/guides/selectivity.mdx
+48-1Lines changed: 48 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,10 @@ After a file changes, on the next run only those tests that depend on the change
17
17
18
18
<Admonitiontype="info">
19
19
If at least one test fails, then on the next run all the same tests will be executed again —
20
-
Testplane will "remember" the new state only after a fully successful run.
20
+
Testplane will "remember" the new state only after a fully successful run. However, you can use
21
+
[`saveIncompleteDumpOnFail`][selectivity-config] to save the dump even on failure and then
22
+
complete it by re-running only the failed tests. See [Recovering from a failed selectivity
23
+
run](#recovering-incomplete-dump) below.
21
24
</Admonition>
22
25
23
26
## Setup
@@ -222,9 +225,53 @@ You can also disable selectivity manually using an environment variable:
222
225
testplane_selectivity_enabled=false # disable
223
226
```
224
227
228
+
## Recovering from a failed selectivity run {#recovering-incomplete-dump}
229
+
230
+
By default, if any test fails during a Testplane run, the selectivity dump is **not updated**. This means that if you ran Testplane to collect a selectivity dump (e.g. in CI) and only a few tests failed, you would need to re-run the **entire** test suite just to get a valid dump.
231
+
232
+
The `saveIncompleteDumpOnFail` option solves this problem. Here is the step-by-step workflow:
233
+
234
+
### 1. Run Testplane with `saveIncompleteDumpOnFail:true`
235
+
236
+
Enable selectivity in `enabled` or `writeOnly` mode with `saveIncompleteDumpOnFail:true` in your config:
237
+
238
+
```typescript
239
+
selectivity: {
240
+
enabled:true, // or "writeOnly"
241
+
saveIncompleteDumpOnFail:true,
242
+
}
243
+
```
244
+
245
+
Run Testplane as usual. If some tests fail, the dump will still be saved — but it is in an **incomplete state**. An incomplete dump may incorrectly skip some of the failed tests, so it should **not** be used directly for selective runs.
246
+
247
+
### 2. Re-run only the failed tests
248
+
249
+
Use the [`--last-failed-only`][last-failed] flag to re-run only the tests that failed:
250
+
251
+
```bash
252
+
npx testplane --last-failed-only
253
+
```
254
+
255
+
Make sure `saveIncompleteDumpOnFail:true` is still set in the config. This run will only execute the previously failed tests and update the incomplete dump with their results.
256
+
257
+
### 3. Repeat until all tests pass
258
+
259
+
You can repeat step 2 multiple times if needed — for example, if some tests are flaky and fail again. Each subsequent `--last-failed-only` run updates the dump incrementally.
260
+
261
+
### 4. Dump is complete
262
+
263
+
Once a run succeeds with no failures, the dump is considered **complete** and can safely be used for selective test execution.
264
+
265
+
<Admonition type="warning">
266
+
Do not use the incomplete dump (saved after a failed run) for selective test execution. An
267
+
incomplete dump may skip tests that actually need to be re-run. Always complete the dump by
268
+
re-running failed tests until the run is fully successful.
269
+
</Admonition>
270
+
225
271
## Configuration
226
272
227
273
Additional information about selectivity configuration is provided in the [browsers-selectivity][selectivity-config] section of the documentation.
## Восстановление после неудачного прогона селективности {#recovering-incomplete-dump}
229
+
230
+
По умолчанию, если хотя бы один тест упал во время прогона Testplane, дамп селективности **не обновляется**. Это означает, что если вы запускали Testplane для сбора дампа селективности (например, в CI) и упало лишь несколько тестов, вам пришлось бы перезапускать **весь** набор тестов для получения валидного дампа.
231
+
232
+
Опция `saveIncompleteDumpOnFail` решает эту проблему. Вот пошаговый процесс:
233
+
234
+
### 1. Запустите Testplane с `saveIncompleteDumpOnFail:true`
235
+
236
+
Включите селективность в режиме `enabled` или `writeOnly` с `saveIncompleteDumpOnFail:true` в конфигурации:
237
+
238
+
```typescript
239
+
selectivity: {
240
+
enabled:true, // или "writeOnly"
241
+
saveIncompleteDumpOnFail:true,
242
+
}
243
+
```
244
+
245
+
Запустите Testplane как обычно. Если некоторые тесты упадут, дамп все равно будет сохранен — но в **неполном состоянии**. Неполный дамп может некорректно пропускать некоторые из упавших тестов, поэтому его **нельзя** использовать напрямую для селективных прогонов.
246
+
247
+
### 2. Перезапустите только упавшие тесты
248
+
249
+
Используйте флаг [`--last-failed-only`][last-failed] для перезапуска только упавших тестов:
250
+
251
+
```bash
252
+
npx testplane --last-failed-only
253
+
```
254
+
255
+
Убедитесь, что `saveIncompleteDumpOnFail:true` по-прежнему установлен в конфигурации. Этот запуск выполнит только ранее упавшие тесты и обновит неполный дамп их результатами.
256
+
257
+
### 3. Повторяйте до полного успеха
258
+
259
+
Вы можете повторять шаг 2 несколько раз — например, если некоторые тесты нестабильны и падают снова. Каждый последующий запуск с `--last-failed-only` инкрементально обновляет дамп.
260
+
261
+
### 4. Дамп готов
262
+
263
+
Как только прогон завершится без падений, дамп считается **полным** и может безопасно использоваться для селективного запуска тестов.
264
+
265
+
<Admonition type="warning">
266
+
Не используйте неполный дамп (сохраненный после неудачного прогона) для селективного запуска
267
+
тестов. Неполный дамп может пропускать тесты, которые на самом деле нужно перезапустить. Всегда
268
+
дополняйте дамп, перезапуская упавшие тесты до полностью успешного прогона.
269
+
</Admonition>
270
+
225
271
## Конфигурация
226
272
227
273
Дополнительная информация о конфигурации селективности описана в разделе [browsers-selectivity][selectivity-config] документации.
0 commit comments