Playwright · Senior · Question 72 of 77

Why should a large suite avoid beforeAll that creates shared state for a file?

Show the answer

Correct answer: After a failure the worker restarts, and state may be half-built

Explanation

beforeAll reruns in new workers and couples tests. Per-test fixtures or worker fixtures are more predictable.

Further reading

Problem with a question

Playwright · Senior · question 72

Test yourself

Take the Playwright · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz