-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subsequent Tests Do Not Run If beforeEach ever fails #7577
Comments
@alexmi256 thanks for filing the issue. I don't believe this is something that WebdriverIO controls. This is Mocha specific. Can you verify by checking the above test suite with Jasmine? |
could you try these recommendations of using retry ? |
I checked both Jasmine and Mocha using this test suite: describe('Example Suite', () => {
let testNum = 0
beforeEach(async () => {
console.log('Example BeforeEach')
if (testNum % 2 !== 0) {
throw new Error('ups')
}
})
afterEach(function() {
console.log('Example AfterEach')
testNum++
})
it('Test 1', () => {})
it('Test 2', () => {})
it('Test 3', () => {})
}) The spec reporter output is:
@alexmi256 can you explain which output you would expect? |
I would expect something being shown for Test 3, either pass/fail/skip. |
That is correct.
More a limitation of Mocha which WebdriverIO uses. I recommend to open an issue there and we can follow up. |
I've left additional comments in mochajs/mocha#4392, which seems to be a thing for quite a while |
Environment (please complete the following information):
Describe the bug
If the
beforeEach
of a suite ever fails, then the suite will stop executing any further tests.I believe this behavior was originally intended but ultimately results in a poor user experience especially related to wdio reporters
Given the suite
Only Test 1 & 2 will be run and thus Allure/JUnit test reporters will not report on Test 3.
This results in inconsistent test counts and may not be what the user desires.
This is especially true if the
beforeEach
setup requires network calls which can occasionally fail when you have many suites with many tests.Similarly, a user may wish to ensure that the page they're loading is in a testable state in order to fail early. Currently this is ill-advised not all tests are guaranteed to run.
To Reproduce
Expected behavior
Additional context
The text was updated successfully, but these errors were encountered: