Testcafe: Allow configuring the quarantine mode

Created on 12 Jun 2019  路  10Comments  路  Source: DevExpress/testcafe

What is your Test Scenario?

Some test are flaky in CI and we would like to increase the number of retries when running in quarantine mode.

What are you suggesting?

A way to configure the number of retries when running the tests in quarantine mode: -q n

What alternatives have you considered?

Disabling the tests and trying to make the less flaky - but flakiness can depend on other factors like cpu / memory that are not possible to change.

Additional context

Would be nice to know the number of successful tries but not really a priority.

level 2 HELP WANTED enhancement

Most helpful comment

From my own experience, the most useful behaviour would be:

If a test succeeded in Quarantine Mode at least once, we should mark it as a PASS (even if majority of executions failed).

The main thinking behind this: If a test is in Quarantine Mode, it's because it's flaky, so it's not very realistic to expect that it will Pass majority of times. If it passes at least once, that's enough to conclude the functionality is working.

Yesterday I was having a quick look at TestCafe code and looks like this is the area that may need to be changed:

_shouldKeepInQuarantine () {
        const errors         = this.testRun.errs;
        const hasErrors      = !!errors.length;
        const attempts       = this.quarantine.attempts;
        const isFirstAttempt = this._isFirstQuarantineAttempt();

        attempts.push(errors);

        // Code below is just a draft/idea to finish Quarantine if there is at least 1 successful run. Not a final solution.
        if (errors.length == 0 && hasErrors == false && attempts > 0 && isFirstAttempt == false) {
            await this._endQuarantine();
        }

        return isFirstAttempt ? hasErrors : !this.quarantine.isThresholdReached();
    }

All 10 comments

Hello @arijo ,

Thank you for sharing your idea with us. We have decided to add this option聽in聽future Testcafe releases. In the meantime, you are welcome to submit your PR.

This is very important because default retry for -q is 3, which may be high for someone and takes longer to mark test as failed. Ideal retry for test is one more time for majority of the people. Can we prioritize this issue?

From our testing experiences, running a failed test just one more time doesn't reduce flakiness well. Current settings for quarantine mode feels balanced enough between robustness and time requirements. So we will be happy to accept a PR about this feature, but our team is busy with more important tasks now.

What I think would be helpful is to have an option to run the failed test again later and not directly after the first initial fail - given that network hiccups usually resolve itself in a few seconds/minutes.

Also, if my test succeeds only once in five runs, I'm still happy enough and would like to proceed with the next tests... But I guess that's something not many teams would accept as "stable"

Hello @dlangerenken ,

Thank you for sharing your idea with us. We will take it into account.

From my own experience, the most useful behaviour would be:

If a test succeeded in Quarantine Mode at least once, we should mark it as a PASS (even if majority of executions failed).

The main thinking behind this: If a test is in Quarantine Mode, it's because it's flaky, so it's not very realistic to expect that it will Pass majority of times. If it passes at least once, that's enough to conclude the functionality is working.

Yesterday I was having a quick look at TestCafe code and looks like this is the area that may need to be changed:

_shouldKeepInQuarantine () {
        const errors         = this.testRun.errs;
        const hasErrors      = !!errors.length;
        const attempts       = this.quarantine.attempts;
        const isFirstAttempt = this._isFirstQuarantineAttempt();

        attempts.push(errors);

        // Code below is just a draft/idea to finish Quarantine if there is at least 1 successful run. Not a final solution.
        if (errors.length == 0 && hasErrors == false && attempts > 0 && isFirstAttempt == false) {
            await this._endQuarantine();
        }

        return isFirstAttempt ? hasErrors : !this.quarantine.isThresholdReached();
    }

Hello @Farfurix,

Just wondering if this work will be prioritised at some point?

Thank you!

Same question here

We didn't plan to address this issue in the nearest sprints. In the meantime, you are welcome to submit your PR with this functionality.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lukas-Kullmann picture Lukas-Kullmann  路  3Comments

calisven picture calisven  路  3Comments

devmondo picture devmondo  路  3Comments

multivoltage picture multivoltage  路  3Comments

madroneropaulo picture madroneropaulo  路  3Comments