Rayrun
← Back to Discord Forum

Does beforeAll() re-run after a test case failure within workers = 1?

Linhtinh603posted in #help-playwright
Open in Discord
Linhtinh603
Linhtinh603

I have a beforeAll() function with execute db connection. I run test cases without parallel.

  • Test case 1: Print logs of beforeAll() and run test case failed.
  • Test cases 2: Still print logs of beforeAll() (after test case 1 failed)
  • Test case 3: Not print logs of beforeAll() after test case 2 run pass.
  • Test case 4: Not print logs of beforeAll() and print logs of AfterAll() after test case 3 pass.

Does beforeAll() re-run after a test case failure?

This thread is trying to answer question "Does beforeAll() re-run after a test case failure within workers = 1?"

1 reply
refactoreric

Yes, beforeAll will re-run if a test failed, because the whole worker will be killed and restarted (to make sure the worker is in a healthy state after a failure).

https://playwright.dev/docs/test-retries#failures

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].